logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rich Gibbs <rich.gi...@enhansiv.com>
Subject RE: Rolling appender, that contains standard err/out
Date Fri, 06 Dec 2002 03:24:09 GMT

I just came across this in the 1.2.7 release similar code ran without a
problem in the 1.0.2 release I believe...

The output is as follows:

0 [main] INFO testing.Main  - The log object is org.apache.log4j.Logger
10 [main] INFO testing.Main  - Starting main()
10 [main] INFO testing.Main  - init(1)...

It seems that calling the PropertyConfigurator with a String, or just
properties after some categories are initialized, causes the initial
categories to not print any longer. 

Any ideas?  I looked through the bug database, but I did not see anything
that looked related...



package testing;

import org.apache.log4j.*;

 * Test Basic initialization, prior to initializing based on a specific
 * application file.
public class Main {
	 * The category to be used in this class for testing purposes...
	 * In the real life example, the category at this level is static
and initialized
	 * here.  Additonal categories are initialized for every class, but
	 * actual properties path can't be determined till later, at which
point it
	 * needs to be used.
	private static Category log;


        log = Category.getInstance(Main.class );
        log.info("The log object is " + log.getClass().getName());

	public static void main(String[] args) {
			log.info( "Starting main()" );
			Main m = new Main();
			log.info( "Still works" );
	private void init()

      log.info( "init(1)..." );
      Category log2 = Category.getInstance(Main.class);

      String logPropertiesPath = "J:\\log4jTesting\\log.properties";
      log.info( "init(2)..." );
      log.info( "does log still work?" );

        PropertyConfigurator.configureAndWatch( logPropertiesPath );
        log.debug( "3 logPropertiesPath(realPath)=" + logPropertiesPath );

The contents of the log.properties file...

log4j.rootCategory=WARN, stdout
# stdout is set to be a ConsoleAppender.


# stdout uses PatternLayout.
log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n

#struts debugging

#enhansiv debugging

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