Quartz scheduler not displaying Log4j messages

两盒软妹~` 提交于 2019-12-06 00:23:23

You're missing essentialy two points:

  1. Your configuration file is a properties file, not an XML. So you should save it as 'log4j.properties';
  2. Make sure the file mentioned in the item 1 is in the application's classpath (assuming a recent log4j implementation is being used).

Good luck,

Douglas

Also try updating your log4j config with this line

log4j.logger.org.quartz=debug, stdout

You can configure you code either programatically (as in the main method of your QuartzReport class), either with a configuration file (your properties file).

Newer versions of Log4j will try to load a file named log4j.properties from you classpath and use it to configure you logger automatically.

In your case, the BasicConfigurator.configure() call will override any definitions in you properties file (i.e., you properties file is being ignored). And the output displayed by the log respects the pattern you provided in the PatternLayout constructor. More details on how to define such pattern can be found in the PatternLayout class documentation.

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