The 'logger.info(message);' line in my code creates this output:
Dec 17, 2013 12:54:50 PM greenhouse.GreenhouseControls$ControllerException
I would like to print that line to a text file using a PrintWriter. This is what I have so far:
public ControllerException(String message, int errorcode) {
super(message);
this.errorcode=errorcode;
Logger logger = Logger.getLogger(ControllerException.class.getName());
logger.info(message);
String fileName = "error.log";
try {
PrintWriter outputStream = new PrintWriter(fileName);
outputStream.println("Time: " + ????); // Not sure what to put here..
outputStream.println("Reason: " + message);
outputStream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
What can I include in the print line statement in place of the question marks to achieve this?