• 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

Multiple instances of Log4J ?

 
Ranch Hand
Posts: 209
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've a tomcat server running multiple webapps.
They share some common libraries that I've placed in {tomcatroot}/shared/lib, and the libraries use Log4J for logging.
I'm trying to make each app to log to a different file. However, since they are calling the same library, and thus the same logger, all the logging get merged.
My attempts to solve this problem.
1. Put log4j.jar inside {tcroot}/shared/lib , and use separate initialization servlets/config file for each web app. The result is that logging goes to the last initialized webapp.
2. Put log4j.jar into WEB-INF/lib of each webapp, and use init servlets/conf file. That didn't work, as I get ClassNotFoundException for log4j, thrown from the libraries inside {tcroot}/shared/lib
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not try both? Thus, a log4j lib for the shared libs and log4j libs for each of the webapps
Hope it helps.....
 
What? What, what, what? What what tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic