• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with shared access to Log4j in Tomcat

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using log4j in 2 wep apps running in the Tomcat container. Instead of each app having its own copy of lo4j*.jar, I kept the jar file in $TOMCAT/shared/lib. The apps, however, had their own log4j config files.

I observed that my logging statements (from both web apps) are going in a single log file (the one which is configured for the app that is deployed most recently). It seems that the LoggerFactory instance is a singleton and its first log4j configuration is overwritten by the next one. Is that the case?

I have other libraries in $TOMCAT/shared/lib that depend on log4j. But I don't want to keep 3 copies of the jar file (2 for the web apps + 1 for shared/lib libraries) in Tomcat. Do I have an option?

Regards
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic