commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maher Martin" <>
Subject RE: [Logging] Problem with Log4J configuration
Date Mon, 07 Jul 2003 12:57:18 GMT

I forgot to attach the properties file.

-----Original Message-----
From: Maher Martin 
Sent: Monday, July 07, 2003 2:52 PM
To: Jakarta Commons Users List
Subject: [Logging] Problem with Log4J configuration


I'm having problems configuring the Logging instance with my Logging Properties. I'm using
the following configuration mechanism:

1) I added the Log4J jar file to the classpath

2) I added the file to the classpath (see attached file)
(Note: the property org.apache.commons.logging.LogFactory on the first line instructs the
logger to use the Log4JFactory )

3) I attempt to use the logger using the following code:

        Log _log = LogFactory.getLog(this.class.getName());


I expect the output to look like the following:

[07 Jul 2003 13:50:41,864] DEBUG [main] (com.webasto.commonstest.Test) - DEBUG 
[07 Jul 2003 13:50:41,864] ERROR [main] (com.webasto.commonstest.Test) - ERROR 
[07 Jul 2003 13:50:41,864] FATAL [main] (com.webasto.commonstest.Test) - FATAL 
[07 Jul 2003 13:50:41,864]  INFO [main] (com.webasto.commonstest.Test) - INFO 
[07 Jul 2003 13:50:41,874]  WARN [main] (com.webasto.commonstest.Test) - WARN

However I get the following output:

0 [main] ERROR commonstest.Test  - ERROR 
10 [main] FATAL commonstest.Test  - FATAL 
10 [main] INFO commonstest.Test  - INFO 
10 [main] WARN commonstest.Test  - WARN 

It seems from the output above that the properties are not being passed to Log4J. However
I checked that they are being loaded from the properties file using the following code:

        Log4jFactory fact = (Log4jFactory) LogFactory.getFactory();
        String[] attributeNames = fact.getAttributeNames();

        for (int i = 0; i < attributeNames.length; i++) {
            String name = attributeNames[i];
            String value = (String) fact.getAttribute(name);
            System.out.println("CONFIG: Name:" + name + ", Value:" + value);

I checked the properties file directly with Log4J and the log messages were outputted as expected.

I'm using commons-logging version 1.0.2 and Log4J version 1.2.8.

Thanks in advance,

Martin Maher

To unsubscribe, e-mail:
For additional commands, e-mail:

  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message