1
0

Avalon Logger was broken by Serialization changes 13 months ago. Fixing and made not Serializable

since it cannot be Serializable if a Logger is explicitly passed in.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@139050 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Peter A Royal Jr
2004-09-27 16:21:40 +00:00
parent 77f3dd0e7c
commit 7e6c9ff377
2 changed files with 8 additions and 13 deletions

View File

@@ -16,7 +16,7 @@
--> -->
$Id: RELEASE-NOTES.txt,v 1.7 2004/06/01 20:39:50 rdonkin Exp $ $Id: RELEASE-NOTES.txt,v 1.8 2004/09/27 16:21:40 proyal Exp $
Commons Logging Package Commons Logging Package
Version 1.0.4 Version 1.0.4
@@ -52,7 +52,7 @@ NEW FEATURES:
[AvalonLogger] Added AvalonLogger, which wraps the logger used by the [AvalonLogger] Added AvalonLogger, which wraps the logger used by the
Avalon framework. As with other implementations, this Avalon framework. As with other implementations, this
is compiled only if the appropriate dependencies are is compiled only if the appropriate dependencies are
satisfied. satisfied. This implementation is *NOT* Serializable
[Jdk13LumberjackLogger] [Jdk13LumberjackLogger]
Added Jdk13LumberjackLogger, which wraps the implementation Added Jdk13LumberjackLogger, which wraps the implementation
@@ -104,6 +104,8 @@ BUG FIXES:
exceptions when looking up system properties that are exceptions when looking up system properties that are
not accessible. not accessible.
[AvalonLogger] Fix NullPointerException when it when providing a
default logger.
DEPRECATIONS: DEPRECATIONS:

View File

@@ -16,7 +16,6 @@
package org.apache.commons.logging.impl; package org.apache.commons.logging.impl;
import java.io.Serializable;
import org.apache.avalon.framework.logger.Logger; import org.apache.avalon.framework.logger.Logger;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@@ -41,16 +40,14 @@ import org.apache.commons.logging.Log;
* </ul> * </ul>
* *
* @author <a href="mailto:neeme@apache.org">Neeme Praks</a> * @author <a href="mailto:neeme@apache.org">Neeme Praks</a>
* @version $Revision: 1.9 $ $Date: 2004/06/01 19:56:20 $ * @version $Revision: 1.10 $ $Date: 2004/09/27 16:21:40 $
*/ */
public class AvalonLogger implements Log, Serializable { public class AvalonLogger implements Log {
/** Ancesteral avalon logger */ /** Ancesteral avalon logger */
private static Logger defaultLogger = null; private static Logger defaultLogger = null;
/** Avalon logger used to perform log */ /** Avalon logger used to perform log */
private transient Logger logger = null; private transient Logger logger = null;
/** The name of this logger */
private String name = null;
/** /**
* Constructs an <code>AvalonLogger</code> that outputs to the given * Constructs an <code>AvalonLogger</code> that outputs to the given
@@ -58,7 +55,6 @@ public class AvalonLogger implements Log, Serializable {
* @param logger the avalon logger implementation to delegate to * @param logger the avalon logger implementation to delegate to
*/ */
public AvalonLogger(Logger logger) { public AvalonLogger(Logger logger) {
this.name = name;
this.logger = logger; this.logger = logger;
} }
@@ -70,17 +66,14 @@ public class AvalonLogger implements Log, Serializable {
public AvalonLogger(String name) { public AvalonLogger(String name) {
if (defaultLogger == null) if (defaultLogger == null)
throw new NullPointerException("default logger has to be specified if this constructor is used!"); throw new NullPointerException("default logger has to be specified if this constructor is used!");
this.logger = getLogger(); this.logger = defaultLogger.getChildLogger(name);
} }
/** /**
* Gets the Avalon logger implementation used to perform logging. * Gets the Avalon logger implementation used to perform logging.
* @return avalon logger implementation * @return avalon logger implementation
*/ */
public Logger getLogger() { private final Logger getLogger() {
if (logger == null) {
logger = defaultLogger.getChildLogger(name);
}
return logger; return logger;
} }