Howdy,

>Can anyone expand on this further and explain how to use a Log4j logger
>reference in beans that do not have a notion of what the underlying
servlet
>context is?  The only way I can see how to get this to work is to pass
the
>logger reference as an argument in the bean's constructor.

You initialize the log4j system somewhere, e.g. a servlet context
listener's contextInitialized() method.  Then in your classes you just
have a Logger member variable:
private static final Logger LOGGER =
Logger.getLogger(MyClass.class.getName());

And you use this logger as you want.  It's typical to name the logger
the same as the class, but not required.  All of this is in the log4j
docs.  The classes don't need to know how log4j is configured, and they
definitely don't get a Logger passed to them (unless you're doing some
very strange things).

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to