users@glassfish.java.net

Re: Commons Logging and Log4J

From: Kristian Rink <kawazu_at_zimmer428.net>
Date: Fri, 22 Aug 2008 10:56:46 +0200

Hi Henning;


glassfish_at_javadesktop.org schrieb:
> Thanks for your detailed input on the isssue!

You're welcome. :)


> I did not try to remove the app I only re-deployed it - will try whether
> the configuration file changes are applied after doing so....

I am not sure whether redeploying the application really does the trick
here, but this is the same it is in tomcat as well - we're using maven2,
deploying to tomcat then and now we also did a "tomcat:undeploy
tomcat:deploy" rather than just a "tomcat:redeploy" in order to get changes
like these applied.

[...]
> subject this was the first time I read about it here and there... Do I
> get you right: You're using SLF4J in combination with log4j to realize
> logging in your own applications? How about SLF4J integration into
> Glassfish? Painless?

Well, not completely right. :) We use slf4j to do logging in our
applications in order to be independent of the actual logging
implementation. ;) So most of our applications just are built against the
slfj4 API, with those who are modules deployable to an application server or
(as .jar files) for standalone use including an slf4j-* implementation to do
the logging using a given technology (slf4j-jdk14 for modules dumped to
glassfish, slf4j-log4j for modules deployed to tomcat, either one of these
or maybe even slf4j-simple for applications). This, actually, is why we
initially considered switching to c-l/slf4j: Being all too much depending
upon a specific implementation (which in worst case is third-party and/or
not allowed somewhere - I also know folks who don't want to use log4j at all
for whichever reasons ...) generally does make things difficult, and logging
possibly is the very least place where such difficulties should be taken as
granted. ;)



> Are you able to provide some sample code for the JMX log4j config
> reloader bean?

Sure, for the Spring approach to do this have a look at this post:

http://springtips.blogspot.com/2007/07/changing-log4j-logging-levels.html ,

this is pretty much how we did it, as well, and how we still use it in
situations in which logging configurations can't be done in a more
straightforward way (running standalone or in tomcat). ;)


Cheers & good luck,
Kristian

-- 
Kristian Rink
cell    :  +49 176 2447 2771
business: http://www.planconnect.de
personal: http://pictorial.zimmer428.net
"we command the system. calling all recievers.
we are noisy people for a better living".
(covenant - "monochrome")