开发者

Hibernate interfering with Javamail logging

开发者 https://www.devze.com 2023-03-04 09:07 出处:网络
I am building an application using Javamail. For logging purposes, I set: properties.put(\"mail.debug\", true);

I am building an application using Javamail.

For logging purposes, I set:

properties.put("mail.debug", true);

That enabled logging for Javamail and gives me a lot of useful debugging info.

Now, I installed Hibernate which also prints a lot of info to the console (except for the SQL statements it uses) but all out of sudden, the 开发者_开发百科Javamail logging info disappeared.

I am not sure what the cause is but I assume that Hibernate has something to do with this.

Does anyone know how to solve or at least debug this issue?


I replaced my entire log4j config file with this and that solved the problem:

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=hibernate.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

log4j.rootLogger=info, stdout
log4j.logger.net.sf.hibernate=debug

log4j.logger.net.sf.hibernate.ps.PreparedStatementCache=debug

log4j.logger.org.hibernate.SQL=debug 

log4j.logger.org.hibernate.type=trace 


By disappeared , do you mean it is not in your log at all or you just can't see it on the console because hibernate is logging a lot?

You can try setting the log of hibernate to INFO.

properties.put("log4j.logger.org.hibernate", "INFO");
0

精彩评论

暂无评论...
验证码 换一张
取 消