From b2038dcc68ab4b8b9210bbaf25225f2dddb99db1 Mon Sep 17 00:00:00 2001 From: Costin Manolache Date: Fri, 7 Jun 2002 00:22:54 +0000 Subject: [PATCH] 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 --- .../logging/impl/Log4JCategoryLog.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/java/org/apache/commons/logging/impl/Log4JCategoryLog.java b/src/java/org/apache/commons/logging/impl/Log4JCategoryLog.java index e5ec777..344c6da 100644 --- a/src/java/org/apache/commons/logging/impl/Log4JCategoryLog.java +++ b/src/java/org/apache/commons/logging/impl/Log4JCategoryLog.java @@ -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 $ - * $Revision: 1.5 $ - * $Date: 2002/06/06 22:09:09 $ + * $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.6 $ + * $Date: 2002/06/07 00:22:54 $ * * ==================================================================== * @@ -75,7 +75,7 @@ import java.util.Enumeration; * @author Scott Sanders * @author Rod Waldhoff * @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 { @@ -94,12 +94,21 @@ public final class Log4JCategoryLog implements Log { // ------------------------------------------------------------ Constructor + public Log4JCategoryLog() { + if( ! initialized ) { + initialize(); + } + } + /** * Base constructor */ public Log4JCategoryLog(String name) { - this( Category.getInstance(name)); + if( ! initialized ) { + initialize(); + } + this.category=Category.getInstance(name); } /** For use with a log4j factory @@ -122,7 +131,7 @@ public final class Log4JCategoryLog implements Log { // commons-logging patterns ). ConsoleAppender app=new ConsoleAppender(new PatternLayout( LAYOUT ), ConsoleAppender.SYSTEM_ERR ); - app.setName("stderr"); + app.setName("commons-logging"); root.addAppender( app ); root.setPriority( Priority.INFO );