You have to be careful about what properties you feed to log4j..... I
did get this approach working with the roller plugin. Look for the
roller-custom.properties file in the plugins/roller/trunk stuff
have to run again, more later
david jencks
On Mar 6, 2008, at 11:52 AM, Adam Ruggles wrote:
The problem with the ServletContextListener approach is that it
takes over
the log4j for all apps.
For instance, I have two web apps running in geronimo. They share
a common
code base. I need each one to manage their own logging. Right now
using
the Listener approach, the following occurs.
WebApp 1 starts up and begins logging com.my.package
Everything looks good so far.
WebApp2 starts up and begins logging com.my.package. Now WebApp 1
is no
longer writing out to the log files and WebApp2's logs contains
logging
information from WebApp1 and WebApp2.
By the way in both cases the geronimo.log file is affected as well.
djencks wrote:
The solution I know of is to include a log4j.properties file if you
want to run on servers that do not use log4j internally but to have
your ServletContextListener read an app specific properties file that
sets up the appender for your app and other such customizations and
feeds the info to log4j programatically.
Roller uses this technique.
I'm not sure exactly what the log4j API for this is and have to run
now, if you can't find it I can look more later.
thanks
david jencks
On Mar 6, 2008, at 9:22 AM, Adam Ruggles wrote:
I used Spring to create the listener like you've described here.
It works,
but the only problem is that I have multiple web apps and I'd like
them to
maintain their own log, however using this method causes the last
web app to
load to take over the logging.
Łukasz Budnik wrote:
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 <[EMAIL PROTECTED]> wrote:
On Tue, Feb 5, 2008 at 11:10 AM, Adam Ruggles
<[EMAIL PROTECTED]>
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
--
View this message in context: http://www.nabble.com/Geronimo-2-
Log4j-question-tp12865061s134p15879047.html
Sent from the Apache Geronimo - Users mailing list archive at
Nabble.com.
--
View this message in context: http://www.nabble.com/Geronimo-2-
Log4j-question-tp12865061s134p15882415.html
Sent from the Apache Geronimo - Users mailing list archive at
Nabble.com.