I think the root logger is configured so that when jetspeed use Log4J its fully initialised.
Since Jboss also make use of Log4J, by the time it loads jetspeed, Log4J is already initialised. So effectively jetspeed goes and overwrites Jboss's Log4J configuration.
One way of solving this problem is if we check if Log4J is initialised and if it is, only configure Jetspeed specific loggers (org.apache.jetspeed. namespace) . If its not then configure everything from root logger. This way it will work on tomcat which doesn't use Log4J and also on Jboss which uses Log4J.
There are some example code at http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/UsefulCode
I have implemented this method to solve a similar problem. See code below
public synchronized static void configure() { if (!isConfigured()) { // Log4J not configured, configure the root logger BasicConfigurator.configure(); Logger root = Logger.getRootLogger(); root.setLevel(Level.WARN);
}
// Configure our Application specific loggers.
Properties p = new Properties();
try {
p.load(getClass().getResourceAsStream("/mylog4j.properties"));
PropertyConfigurator.configure(p);
} catch (Exception e) {
System.err.println(e.getMessage());
}
}
private synchronized static boolean isConfigured() {
Enumeration enum = Logger.getRoot().getAllAppenders();
if ((enum != null) && (!(enum instanceof org.apache.log4j.helpers.NullEnumeration))) {
return true;
} else {
Enumeration loggers = LogManager.getCurrentLoggers();
while (loggers.hasMoreElements()) {
Logger c = (Logger) loggers.nextElement();
if (!(c.getAllAppenders() instanceof org.apache.log4j.helpers.NullEnumeration))
return true;
}
}
return false;
}
Roshan
From: "Philipp Hug" <[EMAIL PROTECTED]> Reply-To: "Jetspeed Developers List" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Subject: Jetspeed's Log4j settings disable JBoss logging Date: Thu, 22 Jan 2004 11:38:29 +0100
The current settings in Log4j.properties disable logging in JBoss. Is there a reason to keep this line? log4j.rootLogger = INFO, jetspeed
Is there any interest to improve the out-of-the-box experience for jboss deployments? If yes, I could probably help.
Philipp
_________________________________________________________________
Check out the new MSN 9 Dial-up � fast & reliable Internet access with prime features! http://join.msn.com/?pgmarket=en-us&page=dialup/home&ST=1
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
