users@glassfish.java.net

Re: Log$j and Glassfish

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Mon, 22 May 2006 14:57:09 -0700

Hi Jason,

Jason Lee wrote On 05/15/06 10:19,:

> Google gives me a number of links regarding GF and log4j, mostly
> telling me that I don't need log4j, as the JDK logger will write
> everything to the server log, but that's not the behavior we'd like to
> see. We have a number of web applications that are all configured to
> log, via log4j, to an application-specific directory, which we prefer
> as it allows us to keep the logging for each app plus the server
> different. Is there a way to allow our applications to sue log4j?
> We've actually coded the apps using commons logging, which may be
> what's working against us, in case that matters. Thanks.

sorry for the delayed response.

Bundling commons-logging (1.1) and log4j (1.2.13) in my webapp, and
having the log output redirected to an application specific file,
works for me.

Which GlassFish build are you using?

If you're using a GlassFish build prior to b41, what you are trying to do
will not work, because GlassFish used to bundle its own commons-logging.jar
in the domain's lib directory, and this commons-logging.jar did not bundle
any log4j wrapper classes and also took precedence over any locally
bundled commons-logging.jar. As a result of this, log4j was never
discovered,
and the default (jdk) logger, configured to log to the server.log, was used.

As of b41, we've renamed all of GlassFish's org.apache.commons packages,
including org.apache.commons.logging, to com.sun.org.apache.commons, to
avoid any collisions with locally bundled versions of these packages.

What does your log4j.properties file look like, and where in your WAR does
it reside?

Thanks,


Jan

>
> --
> Jason Lee
> Programmer/Analyst
>