ceki 2004/05/11 06:31:07
Modified: src/java/org/apache/log4j/xml UtilLoggingXMLDecoder.java
XMLDecoder.java
src/java/org/apache/log4j/varia LogFilePatternReceiver.java
src/java/org/apache/log4j/spi LoggingEvent.java
src/java/org/apache/log4j/pattern
ClassNamePatternConverter.java
Log:
- Changes to UtilLoggingXMLDecoder, XMLDecoder, LogFilePatternReceiver
ensuring that a non-null location information is set when events are read back.
- Cosmetic changes
Revision Changes Path
1.10 +3 -1
logging-log4j/src/java/org/apache/log4j/xml/UtilLoggingXMLDecoder.java
Index: UtilLoggingXMLDecoder.java
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/log4j/xml/UtilLoggingXMLDecoder.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- UtilLoggingXMLDecoder.java 10 May 2004 09:40:08 -0000 1.9
+++ UtilLoggingXMLDecoder.java 11 May 2004 13:31:07 -0000 1.10
@@ -366,7 +366,9 @@
LocationInfo info = null;
if ((fileName != null) || (className != null) || (methodName != null) ||
(lineNumber != null)) {
info = new LocationInfo(fileName, className, methodName, lineNumber);
- }
+ } else {
+ info = LocationInfo.NA_LOCATION_INFO;
+ }
LoggingEvent loggingEvent = new LoggingEvent();
loggingEvent.setLogger(logger);
1.11 +3 -1 logging-log4j/src/java/org/apache/log4j/xml/XMLDecoder.java
Index: XMLDecoder.java
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/xml/XMLDecoder.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XMLDecoder.java 10 May 2004 09:40:08 -0000 1.10
+++ XMLDecoder.java 11 May 2004 13:31:07 -0000 1.11
@@ -377,7 +377,9 @@
LocationInfo info = null;
if ((fileName != null) || (className != null) || (methodName != null) ||
(lineNumber != null)) {
info = new LocationInfo(fileName, className, methodName, lineNumber);
- }
+ } else {
+ info = LocationInfo.NA_LOCATION_INFO;
+ }
LoggingEvent loggingEvent = new LoggingEvent();
loggingEvent.setLogger(logger);
1.8 +2 -0
logging-log4j/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java
Index: LogFilePatternReceiver.java
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/log4j/varia/LogFilePatternReceiver.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- LogFilePatternReceiver.java 10 May 2004 09:30:15 -0000 1.7
+++ LogFilePatternReceiver.java 11 May 2004 13:31:07 -0000 1.8
@@ -580,6 +580,8 @@
|| (lineNumber != null)) {
info =
new LocationInfo(eventFileName, className, methodName, lineNumber);
+ } else {
+ info = LocationInfo.NA_LOCATION_INFO;
}
properties.put(Constants.HOSTNAME_KEY, "file");
1.58 +6 -2 logging-log4j/src/java/org/apache/log4j/spi/LoggingEvent.java
Index: LoggingEvent.java
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/spi/LoggingEvent.java,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- LoggingEvent.java 11 May 2004 09:38:22 -0000 1.57
+++ LoggingEvent.java 11 May 2004 13:31:07 -0000 1.58
@@ -328,8 +328,12 @@
/**
- * Set the location information for this logging event. The collected
- * information is cached for future use.
+ * Get the location information for this logging event. If location
+ * information is null at the time of its invocation, this method extracts
+ * location information. The collected information is cached for future use.
+ *
+ * <p>Note that after serialisation, it is impossible to correctly extract
+ * location information. In that case null is returned.</p>
*/
public LocationInfo getLocationInformation() {
if (locationInfo == null && fqnOfLoggerClass != null) {
1.5 +3 -7
logging-log4j/src/java/org/apache/log4j/pattern/ClassNamePatternConverter.java
Index: ClassNamePatternConverter.java
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/log4j/pattern/ClassNamePatternConverter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ClassNamePatternConverter.java 10 May 2004 22:24:22 -0000 1.4
+++ ClassNamePatternConverter.java 11 May 2004 13:31:07 -0000 1.5
@@ -19,17 +19,13 @@
import org.apache.log4j.spi.LoggingEvent;
/**
- *
+ * Most of the work is done in the parent class [EMAIL PROTECTED]
NamedPatternConverter}.
+ * This class is only responsible of returning the full name name of the caller
+ * class.
*
* @author Ceki Gülcü
*/
public class ClassNamePatternConverter extends NamedPatternConverter {
- // We assume that each PatternConveter instance is unique within a layout,
- // which is unique within an appender. We further assume that callas to the
- // appender method are serialized (per appender).
- StringBuffer buf;
- int precision;
-
public ClassNamePatternConverter() {
super();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]