Hi,

>but I am trying to keep my EJBs pure so that I would not be tied to one
app
>server (actually a constraint on my project). I also wanted to manage
the
>logging via mbeans. Right now I don't see any clear way to use log4j in
>enterprise beans and easily manage the logging at run time.

Here's what we do:

- Obtain loggers in the simplest way:
Logger.getLogger(Foo.class.getName());
- Use loggers normally within the beans.
- We wrote a simple servlet that lets you name a package / class and set
the logging level for it.  This servlet is really very simple and easy
to write.  Only two form fields (class name and logging level) and a
submit button for the UI.  Very simple logger =
Logger.getLogger(whatever was specified in the class name field) and
logger.setLevel(whatever was specified in the level field).  

This has worked for us for runtime changes in tomcat standalone,
JBoss-tomcat, and JBoss-Jetty, without any container problems (because
of course this approach is container-independent).  

I think the MBean is a nice solution as well, but it may be a bit harder
to implement.  We also didn't want to tie ourselves to a container that
supports JMX, because at the time we developed this JMX support wasn't
to be taken for granted ;)  

Maybe it will work for you too.  Good luck,

Yoav Shapira
Millennium ChemInformatics
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:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to