aspose file tools*
The moose likes BEA/Weblogic and the fly likes Using LogManager Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Using LogManager" Watch "Using LogManager" New topic
Author

Using LogManager

Brian Nice
Ranch Hand

Joined: Nov 02, 2000
Posts: 195
In my servlet init() code, I created some Logger objects and registered them with a LogManager using:

(class variable)
private final static LogManager logMgr = LogManager.getLogManager();

(in init() method)
Logger classLogger = Logger.getLogger("loggername"); logMgr.addLogger(classLogger);

Then my servlet calls an action class which has as a class variable:

private static Logger logger = LogManager.getLogManager().getLogger("loggername");

and my action class then logs messages using

logger.info("Message to log...");

I deployed this code on a single server and it worked fine. Then I deployed it on a clustered environment and whenever I tried to retrieve the Logger from the LogManager, it was null, and gave a null pointer exception.

Why in a clustered environment do I not have access to the same LogManager object as my servlet? Is this a classLoader problem? How would I be able to register my Loggers with a LogManager that can be accessed from any module - web or ejb?

Thanks Brian
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using LogManager
 
Similar Threads
JDK 1.4 Logger
logging API in 1.4
Logger (set log level)
question about java logging.
Good logging system for WebApp (Struts)