2

I'm struggling with my client since he does not want any of our webapp's related messages to log to catalina.out.

I've so far redirected all System out/err to my log4j instance. This is great. But now I face the standard java libraries which uses JUL.

I've found hints which I don't like since it involves using SLF4J as primary log (JUL to LOG4j) but we are at production level of our project and we are not changing the logger.

Also, Tomcat 6 allows to use LOG4J which seems a bit drastic as a solution. I've also found a bridge (JUL to LOG4J bridge) but it's not verbose enough for me to know how to proceed.

How can I pickup only the logs generated by my deployed webapp to be sent to my LOG4J configured out file, even if they are from any java lib like rt.jar?

Community
  • 1
  • 1
code-gijoe
  • 6,949
  • 14
  • 67
  • 103
  • Maybe you will need to reconfigured the Tomcat instance. Is it possible for you to do this? I have studied the Tomcat 7 log system some months ago. If it is not different from the 6 version, maybe you could change the server configuration in order to retrive the app log information. –  Apr 24 '12 at 15:05
  • Using the mentioned JUL to LOG4J bridge seems rather obvious to me from the JavaDoc, have you tried calling `JULLog4jBridge.assimilate()`, which should redirect all JUL logging to LOG4J afterwards? – Heri Apr 24 '12 at 20:24
  • I don't want all Tomcat logs to sent to my webapp log, only logs derived by my app – code-gijoe Apr 25 '12 at 13:49

0 Answers0