How to logging output in console to file?

倖福魔咒の 提交于 2019-12-04 05:56:54

问题


The NetBeans generate code like Logger.getLogger(svr.class.getName()).log(Level.SEVERE, null, ex); to output exception in catch.It will display in console. After I deploy my project,I cannot see any exception info.How to output those error messages to file and in console when console is available?

Thanks folks.


回答1:


The logging system in NetBeans is based on the standard JDK's java.util.logging and complies to it as much as possible. In order to output error messages to a file, you can provide your own logging properties file on the classpath of your project.

See the following links for more info :

  • Netbeans logging : http://bits.netbeans.org/dev/javadoc/org-openide-util/org/openide/util/doc-files/logging.html

  • Java Util logging with logging properties file sample : http://www.javapractices.com/topic/TopicAction.do?Id=143



来源:https://stackoverflow.com/questions/5882868/how-to-logging-output-in-console-to-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!