Here you can find the source of logToFile(String string, String logFile)
public static void logToFile(String string, String logFile)
//package com.java2s; //License from project: Open Source License import java.io.FileWriter; import java.io.IOException; public class Main { public static void logToFile(String string, String logFile) { logToFile(string, logFile, true, true); }/* w w w. j ava 2s . c o m*/ public static void logToFile(String string, String logFile, boolean append, boolean consoleprint) { if (consoleprint) System.out.println(string); FileWriter out = null; try { out = new FileWriter(logFile, append); out.write("\n"); out.write(string); out.close(); } catch (IOException e) { e.printStackTrace(); } } }