Hi,

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 commons-logging.properties 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());

        _log.debug("DEBUG");
        _log.error("ERROR");
        _log.fatal("FATAL");
        _log.info("INFO");
        _log.trace("TRACE");
        _log.warn("WARN");


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to