geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Łukasz Budnik" <lukasz.bud...@gmail.com>
Subject Re: Geronimo 2/Log4j question
Date Wed, 27 Feb 2008 11:58:27 GMT
Hi!

I had the very same problem with G2.0.0, currently I'm using G2.1 and
to tell the truth I don't know whether this issue still exists because
I use a very simple work around that works always and for my case is
sufficient.

Simply in WAR create a new class, implement the ServletContextListener
interface and override contextInitialized method like this:

public void contextInitialized(ServletContextEvent ctx) {
		String prefix = ctx.getServletContext().getRealPath("/");
		String file =
ctx.getServletContext().getInitParameter("log4j-configuration-file");
		if (file != null) {
			DOMConfigurator.configure(prefix + "WEB-INF/" + file);
		}
	}

it works in G2.0.0 and G2.1

If You manage to use Log4j without this workaround, let me know please ;)

best regards
Łukasz

On 27/02/2008, Jacek Laskowski <jacek@laskowski.net.pl> wrote:
> On Tue, Feb 5, 2008 at 11:10 AM, Adam Ruggles <a.ruggles@gmail.com> wrote:
>  >
>  >  I am also having this issue.  In tomcat I just needed a log4j.xml in my
>  >  classpath, however geronimo seems to ignore it.
>  >
>  >  The only solution I've found is to have Spring configure log4j through the
>  >  web.xml but that takes over all logging in geronimo.  I need to have
>  >  separate logging for each of my web apps.
>
>  Have you tried to inverse-classloading and/or hidden-classes elements
>  in your plan so log4j and its configuration in Geronimo is for
>  Geronimo stuff and yours is for your stuff?
>
>  Jacek
>
>
>  --
>  Jacek Laskowski
>  http://www.JacekLaskowski.pl
>
Mime
View raw message