The below line of code I am trying to write the events in a log file but no file is being created and I am also not getting any kind of error at all.
My log class:
public class Logs {
static FileHandler fileTxt;
static SimpleFormatter formatterTxt;
static public void logging() throws IOException {
Logger logger = Logger.getLogger("");
logger.setLevel(Level.INFO);
fileTxt = new FileHandler("c:/SimleTaskEvents.txt");
formatterTxt = new SimpleFormatter();
fileTxt.setFormatter(formatterTxt);
logger.addHandler(fileTxt);
}
}
Hank Greenberg
05-Oct-2013You should write to the log first logger.info("my logging line");