我想将atomikos日志级别设置为高于INFO。 Tomcat的catalina.out日志文件会写入许多INFO消息,导致事务需要很长时间才能完成。
在启动期间,catalina.out包含:
18:11:51,481 INFO [main] AbstractUserTransactionService:16 - USING com.atomikos.icatch.console_log_level = WARN
在交易期间,以下内容多次写入catalina.out。
18:12:05,072 INFO [http-8080-1] CompositeTransactionImp:16 - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@7b60ad0 ) for transaction 127.0.0.1.tm0000100018
18:12:05,072 INFO [http-8080-1] AtomikosConnectionProxy:16 - atomikos connection proxy for Pooled connection wrapping physical connection org.postgresql.jdbc4.Jdbc4Connection@37955233: calling prepareStatement...
18:12:05,073 INFO [http-8080-1] AtomikosConnectionProxy:16 - atomikos connection proxy for Pooled connection wrapping physical connection org.postgresql.jdbc4.Jdbc4Connection@37955233: isClosed()...
18:12:05,073 INFO [http-8080-1] AtomikosConnectionProxy:16 - atomikos connection proxy for Pooled connection wrapping physical connection org.postgresql.jdbc4.Jdbc4Connection@37955233: calling getWarnings...
18:12:05,073 INFO [http-8080-1] AtomikosConnectionProxy:16 - atomikos connection proxy for Pooled connection wrapping physical connection org.postgresql.jdbc4.Jdbc4Connection@37955233: calling clearWarnings...
18:12:05,073 INFO [http-8080-1] AtomikosConnectionProxy:16 - atomikos connection proxy for Pooled connection wrapping physical connection org.postgresql.jdbc4.Jdbc4Connection@37955233: close()...
我曾尝试在conf / logging.properties中将atomikos级别设置为WARN,但仍在编写INFO日志。我甚至从logging.properties中删除了ConsoleHandler,但catalina.out仍在写入。
在我的webapp目录中,我更新了log4j.xml以包含以下内容,但仍然获取日志。
<logger name="com.atomikos">
<level value="ERROR"/>
</logger>
答案 0 :(得分:2)
在Atomikos 3.7中,设置以下系统属性:
com.atomikos.icatch.console_log_level=WARN
有关所有Atomikos JTA属性的信息,请参阅this link
从Atomikos 3.8开始,通过SLF4j可以大大改进与log4j的集成。