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 2009/01/15 16:51:23 UTC

DO NOT REPLY [Bug 46539] New: The QuietWriter class does not live up to its published contract

https://issues.apache.org/bugzilla/show_bug.cgi?id=46539

           Summary: The QuietWriter class does not live up to its published
                    contract
           Product: Log4j
           Version: 1.2
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Keywords: JDK1.5
          Severity: major
          Priority: P2
         Component: Other
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: Joseph.Greene@ge.com


The QuietWriter class (in org.apache.log4j.helpers) does not live up to its
published contract.  The javadocs says that "QuietWriter does not throw
exceptions when things go wrong...", however, it will allow Runtime Exceptions
to bubble up.

I propose that QuietWriter catch Exception (not just IOException) to fullfil
its contract.

This is a real problem running log4j with java 1.5 and the assorted
CharsetEncoder state problems.  

java.lang.IllegalStateException: Current state = FLUSHED, new state = CODING
        at
java.nio.charset.CharsetEncoder.throwIllegalStateException(CharsetEncoder.java:941)
        at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:537)
        at sun.nio.cs.StreamEncoder$CharsetSE.implWrite(StreamEncoder.java:384)
        at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:136)
        at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:146)
        at java.io.OutputStreamWriter.write(OutputStreamWriter.java:204)
        at java.io.Writer.write(Writer.java:126)
        at org.apache.log4j.helpers.QuietWriter.write(QuietWriter.java:47)
        at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301)
        at
org.apache.log4j.DailyRollingFileAppender.subAppend(DailyRollingFileAppender.java:358)
        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.append(AsyncAppender.java:87)
        at
org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
        at
org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
        at org.apache.log4j.Category.callAppenders(Category.java:203)
        at org.apache.log4j.Category.forcedLog(Category.java:388)
        at org.apache.log4j.Category.log(Category.java:853)
        at
org.apache.commons.logging.impl.Log4JLogger.warn(Log4JLogger.java:157)

In this example The CharsetEncoder threw an IllegalStateException causing the
AsyncAppender's Dispatcher thread to die.  Now the appender is synchronous but
another IllegalStateException bubbled out of the application code.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
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 46539] The QuietWriter class does not live up to its published contract

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46539

Curt Arnold <ca...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #1 from Curt Arnold <ca...@apache.org> 2009-10-08 21:47:28 PDT ---
Committed in revs 823408 and 823409.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org