[英]How to change the log level for eclipselink in tomcat without code changes?
Sorry, if this is a dup. 抱歉,如果这是一个dup。 Seems like it should be, but I didn't find it. 似乎应该如此,但我没有找到它。
My logging works fine when I add the following to persistence.xml: 将以下内容添加到persistence.xml时,我的日志记录工作正常:
<property name="eclipselink.logging.level" value="FINE"/>
<property name="eclipselink.logging.level.sql" value="FINE"/>
<property name="eclipselink.logging.logger" value="ServerLogger"/>
However, I would like to only turn this logging on occasionally. 但是,我只想偶尔打开此日志记录。 Perhaps, turn it on only if there is a issue. 也许只有在出现问题时才打开它。
If there way to change this setting at runtime, with no code changes. 如果可以在运行时更改此设置,则无需更改代码。 Note: I am using Tomcat and I use log4j for my current program logging. 注意:我正在使用Tomcat,并且将log4j用于当前程序记录。
GC_ GC_
If you are using ServerLogger, EclipseLink will default to your server's logging mechanism, but only if the ServerPlatform class within EclipseLink supports one. 如果使用ServerLogger,则EclipseLink将默认为服务器的日志记录机制,但前提是EclipseLink中的ServerPlatform类支持该机制。 Tomcat isn't a EE server and so you don't likely have a ServerPlatform class for it, so this is a meaningless property and will default to DefaultLogger which writes to the system.out. Tomcat不是EE服务器,因此您可能没有ServerPlatform类,因此它是无意义的属性,默认为DefaultLogger,它将写入system.out。
You can specify java logging , but to specifically integrate with log4J, see the article here 您可以指定java logging ,但是要专门与log4J集成,请参阅此处的文章。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.