Ok here it is this I'm creating a FileLogger and its a singleton by design, I need to log messages to the file, once I have the new file I need to append the log message to the end of the file. Unfortunately I do not know how to do this and this is the only part that I am missing is these two stinking methods which are clearly empty. So if anyone could lend some assistance it would be greatly appreciated.
import java.util.*; import java.text.*; import java.io.*; public class FileLogger extends SimpleLogger { private File logFile; private int logEntryNo = 0; private static FileLogger instance; public static FileLogger getInstance(String logFilePath){ if (instance == null) instance = new FileLogger(logFilePath); return instance; } public FileLogger(String logFilePath){ logFile = new File(logFilePath); try{ logFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } public void add(String data){ DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); Date date = new Date(); String dateTime = dateFormat.format(date); try{ if (logFile.createNewFile()){ FileWriter fileWriter = new FileWriter(logFile); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); bufferedWriter.write("[" + dateTime + "]#" + ++logEntryNo + ": " + data); bufferedWriter.newLine(); bufferedWriter.close(); } else{ FileWriter fileWriter = new FileWriter(logFile,true); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); bufferedWriter.write("[" + dateTime + "]#" + ++logEntryNo + ": " + data); bufferedWriter.newLine(); bufferedWriter.close(); } } catch (IOException e) { e.printStackTrace(); } } @Override public void log(Level logLevel, String component, String msg) throws LoggerException { } @Override public void log(Level error, String component, Throwable t) throws LoggerException{ // TODO Auto-generated method stub } }