• 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

Interesting log4j problem.

 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please help me in the following issue.

I have a tomcat running having three web context's in that.All the applications running in that context are using of log4j.All the applications have initialized (ie. configuration using PropertyConfigurator)the logging system individually.So when we take a instance of the Logger using

Logget myLogger = Logger.getLogger("myLogger");
Then how does log4j determines that which configuration file to follow.
As I think the implementation of LogManager should be a singleton.Then in one JVM there should be one instance of LogManager , so does it resolve this issue.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Singletons are single to the classloader (not the JVM).
Tomcat uses separate classloaders in each context.
It also has some common classloaders for tomcat/shared/classes, tomcat/shared/lib, tomcat/common/classes, and tomcat/common/lib.

Whether or not your apps shard the same logger depends on where you place your log4j jar file.
 
Slime does not pay. Always keep your tiny ad dry.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic