java - 本地能打出日志 但是打成jar包到服务器上 就不产生日志了?
PHPz
PHPz 2017-04-18 10:29:52
0
1
634

PropertyConfigurator.configure("src/main/resources/log4j.properties");

是因为 打成jar包了 所以不识别这个路径吗????

PHPz
PHPz

学习是最好的投资!

reply all(1)
迷茫

Have you built a Maven project? If so, it is correct to place log4j.properties in the src/main/resources directory. Reading and log printing records are no problem, but there is a problem with your reading path. The correct way to write it is It is "PropertyConfigurator.configure("log4j.properties");". For problems that do not generate logs, please do the following checks:
1. If the local setting is ConsoleAppender (console printing), change it to DailyRollingFileAppender (write to the specified log file);
2. Check whether the path of the log file output is changed and correct.

Of course, it’s best to paste the content of log4j.properties and take a look

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template