java logging nightmare and log4j not behaving as expected with spring + tomcat6 -


I have a spring app that is configured via log4j (xml) and runs on Tomcat 6 That is, until we got the bunch of dependence through Maven, at some point the whole application started entering only the part that was declared in log4.xml

"Here is a little thing" why logging in the Java world Need to be tough? Why suddenly an application which is fine, why start behaving so strange and why it is difficult to debug it?

I was studying and trying to solve this issue for days, but no luck till now, hopefully some experts here can give me some insight on this. P>

I have added the log4j debug option to check whether the log4j file is reading the file and its values ​​and it is part of it

  log4j: org.springframework Level value for .web [debug] is set to log4j: org.springframework.web level at DEBUG log4j: org.apache.log4j.logger Capture retrieving log4j: [org.compass]'s setting [true] is the level value for log4j: org.compass [debug] Log4j: org.compass level set DEBUG  

As you can see that debug is capable of compass and spring.web but it only shows "INFO" level for both packages. In my log4j config file, only a simple console adapter

   & Lt; Layout class = "org.apache.log4j.PatternLayout" & gt; & Lt; Param name = "conversion pattern" value = "% - 5p:% c -% m% n" /> & Lt; / Layout & gt; & Lt; / Appender & gt;  

What is the trick to doing this work? Is this my misunderstanding here? Does anyone tell me in the right direction, and how can I make more bullet proof this logging mess? This can not be log4j, which is logging in, and so your log4j config will be ignored. Spring logs using Commons logging, which is an API that can pass through various logging frameworks including Lodge 4J. To determine which implementation is used, Commons logging appears in the classpath.

If you have a dependency that has dragged your logging implementation in classpath, then commons logging can now use other implementations.

I suggest setting a breakpoint in the call for the logging feature, and which logging implementation is used to find out the execution.


Comments