NetBeans Logger

I am developing NetBeans as an IDE for Java. When Netbeans surrounds a statement in a try-catch block, it uses something like Logger.getLogger(MyTestClass.class.getName()).log(Level.SEVERE, null, ex); in the catch area. My questions

  • What and where is the log file created by this sentence?
  • Should I create it? If so, how?

Greetings!

+1
source share
1 answer

The registrar is always available. You can create it with a custom name. You write a record to a file (using FileHandler):

 Logger logger = Logger.getLogger("MyLog"); fh = new FileHandler("C:/temp/test/MyLogFile.log"); logger.addHandler(fh); 

By default, the record is written to the console. you can enable java console: http://www.java.com/en/download/help/javaconsole.xml

hope this helps

+3
source

Source: https://habr.com/ru/post/1445780/


All Articles