Make sure we are initialized for all constructors. Change the name of the
default appender. I still have some problems with log4j's JMX if I construct the logger via API ( i.e. no log4j.properties ) - but that shouldn't affect too many people, so I'll leave it. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@138888 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/Attic/Log4JCategoryLog.java,v 1.5 2002/06/06 22:09:09 costin Exp $
|
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/Attic/Log4JCategoryLog.java,v 1.6 2002/06/07 00:22:54 costin Exp $
|
||||||
* $Revision: 1.5 $
|
* $Revision: 1.6 $
|
||||||
* $Date: 2002/06/06 22:09:09 $
|
* $Date: 2002/06/07 00:22:54 $
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*
|
*
|
||||||
@@ -75,7 +75,7 @@ import java.util.Enumeration;
|
|||||||
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
|
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
|
||||||
* @author Rod Waldhoff
|
* @author Rod Waldhoff
|
||||||
* @author Robert Burrell Donkin
|
* @author Robert Burrell Donkin
|
||||||
* @version $Id: Log4JCategoryLog.java,v 1.5 2002/06/06 22:09:09 costin Exp $
|
* @version $Id: Log4JCategoryLog.java,v 1.6 2002/06/07 00:22:54 costin Exp $
|
||||||
*/
|
*/
|
||||||
public final class Log4JCategoryLog implements Log {
|
public final class Log4JCategoryLog implements Log {
|
||||||
|
|
||||||
@@ -94,12 +94,21 @@ public final class Log4JCategoryLog implements Log {
|
|||||||
|
|
||||||
// ------------------------------------------------------------ Constructor
|
// ------------------------------------------------------------ Constructor
|
||||||
|
|
||||||
|
public Log4JCategoryLog() {
|
||||||
|
if( ! initialized ) {
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base constructor
|
* Base constructor
|
||||||
*/
|
*/
|
||||||
public Log4JCategoryLog(String name) {
|
public Log4JCategoryLog(String name) {
|
||||||
this( Category.getInstance(name));
|
if( ! initialized ) {
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
this.category=Category.getInstance(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** For use with a log4j factory
|
/** For use with a log4j factory
|
||||||
@@ -122,7 +131,7 @@ public final class Log4JCategoryLog implements Log {
|
|||||||
// commons-logging patterns ).
|
// commons-logging patterns ).
|
||||||
ConsoleAppender app=new ConsoleAppender(new PatternLayout( LAYOUT ),
|
ConsoleAppender app=new ConsoleAppender(new PatternLayout( LAYOUT ),
|
||||||
ConsoleAppender.SYSTEM_ERR );
|
ConsoleAppender.SYSTEM_ERR );
|
||||||
app.setName("stderr");
|
app.setName("commons-logging");
|
||||||
|
|
||||||
root.addAppender( app );
|
root.addAppender( app );
|
||||||
root.setPriority( Priority.INFO );
|
root.setPriority( Priority.INFO );
|
||||||
|
|||||||
Reference in New Issue
Block a user