Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've got a web-app deployed to a Tomcat 7 server. My application uses log4j and a file appender. However, not all logging messages are getting written to the file.

On my classpath, I have:

log4j-1.2.14.jar
slf4j-api-1.6.1.jar
slf4j-log4j12-1.6.1.jar

My log4j.properties file is working fine on my local machine and is deploy properly.

I see application generated error messages being written to catalina.out that are not getting written to my log4j log. The log messages in catalina.out look to be coming from some other logging framework because the output pattern is in a different format than my log4j pattern. The logging that I'm seeing in the catalina.log is like:

Nov 4, 2011 11:05:31 AM org.apache.myfaces.shared_impl.util.StateUtils reconstruct
SEVERE

And my log4j pattern is like:

2011-11-03 16:42:09,336 ["http-bio-8080"-exec-13] ERROR

Some logging appears in my log4j file log, but not all of it. From what I've read, slf4j just needs those jars for it to funnel log output. Any ideas?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
436 views
Welcome To Ask or Share your Answers For Others

1 Answer

It looks like the StateUtils class is using java.util.logging (jul). It stands to reason that other myfaces classes also use jul. Thus, you would probably want to funnel jul logs through SLF4J. Have a look at bridging legacy APIs, in particular the jul-to-slf4j bridge.

Please see SLF4JBridgeHandler javadocs for usage instructions when installing jul-to-slf4j.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...