You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2006/12/15 23:16:20 UTC
DO NOT REPLY [Bug 41186] New: - AsyncAppender in 1.2.14 DiscardSummary events create NullPointerExceptions in layouts
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41186>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=41186
Summary: AsyncAppender in 1.2.14 DiscardSummary events create
NullPointerExceptions in layouts
Product: Log4j
Version: 1.2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Appender
AssignedTo: log4j-dev@logging.apache.org
ReportedBy: gopaczewski@orbitz.com
The 1.2.14 version of the AsyncAppender creates LoggingEvent's from
DiscardSummary objects with null fqnOfCategoryClass. This causes layouts that
call getLocationInformation() on the LoggingEvent to throw a NullPointerException:
Exception in thread "Dispatcher-Thread-6"
java.lang.NullPointerException
at java.lang.String.lastIndexOf(Unknown Source)
at java.lang.String.lastIndexOf(Unknown Source)
at org.apache.log4j.spi.LocationInfo.<init>(LocationInfo.java:119)
at
org.apache.log4j.spi.LoggingEvent.getLocationInformation(LoggingEvent.java:191)
at
org.apache.log4j.helpers.PatternParser$ClassNamePatternConverter.getFullyQualifiedName(PatternParser.java:538)
at
org.apache.log4j.helpers.PatternParser$NamedPatternConverter.convert(PatternParser.java:511)
at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:64)
at org.apache.log4j.PatternLayout.format(PatternLayout.java:503)
at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301)
at org.apache.log4j.WriterAppender.append(WriterAppender.java:159)
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
at
org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
at org.apache.log4j.AsyncAppender$Dispatcher.run(AsyncAppender.java:578)
at java.lang.Thread.run(Unknown Source)
This kills off the Dispatcher thread, reverting to synchronous logging.
Steps to Reproduce:
1. Configure an appender with a PatternLayout that retrieves LocationInfo:
<appender name="TestAppender" class="org.apache.log4j.FileAppender">
<param name="file" value="/tmp/afile.log" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%C:%L %m%n" />
</layout>
</appender>
2. Configure a second AsyncAppender that references the first appender as follows:
<appender name="MyAsyncAppender" class="org.apache.log4j.AsyncAppender">
<param name="locationInfo" value="true" />
<param name="blocking" value="false" />
<param name="bufferSize" value="1" />
<appender-ref ref="TestAppender" />
</appender>
3. Create a scenario where the buffer in the AsyncAppender fills up, generating
discard events. (Should be pretty easy with a bufferSize=1)
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 41186] - AsyncAppender in 1.2.14 DiscardSummary events create NullPointerExceptions in layouts
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41186>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=41186
------- Additional Comments From gopaczewski@orbitz.com 2006-12-18 06:27 -------
Thanks for resolving so quickly. Is there an ETA for 1.2.15 at this point?
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 41186] - AsyncAppender in 1.2.14 DiscardSummary events create NullPointerExceptions in layouts
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41186>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=41186
------- Additional Comments From carnold@apache.org 2007-04-20 20:36 -------
The underlying problem, a NullPointerException on a call to LoggingEvent.getLocationInformation()
when FQCN is null was also reported in Chainsaw running on log4j 1.2. The initial suggestion was to
backport a log4j 1.3 change so that getLocationInfo() would return null. However, the log4j 1.2 pattern
layout does not check for a null when calling getLocationInformation() and only making that change
(and reverting the previous change) will just move the NPE to a slightly different place in the test case.
I added a new unit test that calls getLocationInformation() when FQCN is null and checks that all the
accessors return "?". The behavior should be identical to passing a bogus class name. The change
committed in rev 530974 is sufficient to pass the unit tests for the original reported bug without the
earlier change to AsyncAppender. However, think it is safer to leave the bogus FQCN in
AsyncAppender.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 41186] - AsyncAppender in 1.2.14 DiscardSummary events create NullPointerExceptions in layouts
Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41186>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=41186
carnold@apache.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From carnold@apache.org 2006-12-15 16:11 -------
Committed rev 487725 on trunk, 487224 on 1.2 branch. Passing null for the fully qualified category (aka
logger) name in the LoggingEvent constructor would cause a NPE in the 1.2 code base, but not 1.3.
Addressed problem by passing in a string that should not match any class name in a stack trace which
should result in the class name and location being reported as "?" in both branches.
Added tests to both test suites. Surprised that very few of the AsyncAppender tests had been ported back
to log4j 1.2, but only backported essential support classes.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org