Home > DeveloperSection > Forums > Writing events to log text file using java
Kate Smith
Kate Smith

Total Post:24

Posted on    October-05-2013 7:57 AM

 Java Java 

 1 Reply(s)
 794  View(s)
Rate this:

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("");
    fileTxt = new FileHandler("c:/SimleTaskEvents.txt");
    formatterTxt = new SimpleFormatter();

Hank Greenberg
Hank Greenberg

Total Post:12

Posted on    October-05-2013 9:03 AM

You should write to the log first logger.info("my logging line");

Don't want to miss updates? Please click the below button!

Follow MindStick