0

I have created a logger using:

private final static Logger logger = Logger.getLogger(newClass.class.getName());

but where can see the generated log file in my system/workspace ?

Leo
  • 5,017
  • 6
  • 32
  • 55

1 Answers1

1

By Default, it will not write those messages into a log file.

You will have to specify a file Handler to which the log messages to write.

Handler handler = new FileHandler("logfile.log", size, rt_cnt);
Logger.getLogger("").addHandler(handler);

Based on the file name and location which you are providing in the FileHandler constructor, it will create the file and write the message

Andromeda
  • 12,659
  • 20
  • 77
  • 103
  • should I write this handler in the same java file(where I created the logger) or in a separate property file? – Leo Aug 28 '14 at 10:20
  • you can write it in the same class. If you want to make it generic and to use across multiple java files then its better to write in a properties files and load the same through LogManager. – Andromeda Aug 28 '14 at 10:30