---------- Forwarded Message ----------
Subject: [Patch] Make sure Avalon Facade and reflection work well together
Date: Tue, 27 May 2003 06:19 pm
From: Peter Donald <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Hi,
Attached is a patch that makes sure that the correct logger object is named
as caller in log messages. Based on submission by Peter Severin
<[EMAIL PROTECTED]> originally sent to Avalon list
--
Cheers,
Peter Donald
-----------------------------------------------
"You can't depend on your eyes when your
imagination is out of focus." -Mark Twain
-----------------------------------------------
-------------------------------------------------------
--
Cheers,
Peter Donald
--------------------------------
These aren't the droids you're
looking for. Move along.
--------------------------------
Index: src/java/org/apache/log4j/varia/Log4JAvalonLogger.java
===================================================================
RCS file:
/home/cvspublic/jakarta-log4j/src/java/org/apache/log4j/varia/Log4JAvalonLogger.java,v
retrieving revision 1.1
diff -u -r1.1 Log4JAvalonLogger.java
--- src/java/org/apache/log4j/varia/Log4JAvalonLogger.java 1 May 2003 18:08:00
-0000 1.1
+++ src/java/org/apache/log4j/varia/Log4JAvalonLogger.java 27 May 2003 08:07:28
-0000
@@ -62,6 +62,13 @@
* @version CVS $Revision: 1.1 $ $Date: 2003/05/01 18:08:00 $
*/
public final class Log4JAvalonLogger implements Logger {
+
+ /**
+ * Constant for name of class to use when recording caller
+ * of log method.
+ */
+ private static final String FQCN = Log4JAvalonLogger.class.getName();
+
//underlying implementation
private final org.apache.log4j.Logger m_logger;
@@ -80,7 +87,7 @@
* @param message the message
*/
public final void debug(final String message) {
- m_logger.debug(message);
+ m_logger.log(FQCN, Level.DEBUG, message, null );
}
/**
@@ -90,7 +97,7 @@
* @param throwable the throwable
*/
public final void debug(final String message, final Throwable throwable) {
- m_logger.debug(message, throwable);
+ m_logger.log( FQCN, Level.DEBUG, message, throwable);
}
/**
@@ -108,7 +115,7 @@
* @param message the message
*/
public final void info(final String message) {
- m_logger.info(message);
+ m_logger.log( FQCN, Level.INFO, message, null );
}
/**
@@ -118,7 +125,7 @@
* @param throwable the throwable
*/
public final void info(final String message, final Throwable throwable) {
- m_logger.info(message, throwable);
+ m_logger.log( FQCN, Level.INFO, message, throwable );
}
/**
@@ -136,7 +143,7 @@
* @param message the message
*/
public final void warn(final String message) {
- m_logger.warn(message);
+ m_logger.log( FQCN, Level.WARN, message, null );
}
/**
@@ -146,7 +153,7 @@
* @param throwable the throwable
*/
public final void warn(final String message, final Throwable throwable) {
- m_logger.warn(message, throwable);
+ m_logger.log( FQCN, Level.WARN, message, throwable );
}
/**
@@ -164,7 +171,7 @@
* @param message the message
*/
public final void error(final String message) {
- m_logger.error(message);
+ m_logger.log( FQCN, Level.ERROR, message, null );
}
/**
@@ -174,7 +181,7 @@
* @param throwable the throwable
*/
public final void error(final String message, final Throwable throwable) {
- m_logger.error(message, throwable);
+ m_logger.log( FQCN, Level.ERROR, message, throwable );
}
/**
@@ -192,7 +199,7 @@
* @param message the message
*/
public final void fatalError(final String message) {
- m_logger.fatal(message);
+ m_logger.log( FQCN, Level.FATAL, message, null );
}
/**
@@ -203,7 +210,7 @@
*/
public final void fatalError(
final String message, final Throwable throwable) {
- m_logger.fatal(message, throwable);
+ m_logger.log( FQCN, Level.FATAL, message, throwable );
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]