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/11/03 16:51:34 UTC

DO NOT REPLY [Bug 40889] New: - repeated entries in log after failure

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=40889>.
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=40889

           Summary: repeated entries in log after failure
           Product: Log4j
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Appender
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: kustanowitz@choicemedia.com


I found that after a failed log entry (JdbcAppender) in mysql (I believe 5.0 
but I'm not sure), mysql does in fact write the entry, but an error must be 
returned at some point because it's not removed from the buffer.

This happened after writing non-ascii characters to the field, or after 
exceeding the 255 character limit I had set on the field.

I fixed this by moving "removes.add(logEvent);" to be BEFORE the execute(sql); 
statement, which ensures it will always get removed, even if an error occurs.

Since this is not necessarily the desired behavior for all apps, I would 
recommend exposing this as a setting on the class, controlled via some 
variable like "removeFromBufferOnError" or something more creative.

This is my first posting to a jakarta project -- thanks for all the hard work 
that makes our lives easier!

-- 
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 40889] - repeated entries in log after failure

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=40889>.
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=40889





------- Additional Comments From bayard@apache.org  2006-12-21 13:56 -------
I'm not a log4j developer, but happened to be looking at this at work.

It seems to me that chiefly MySQL is at fault here if it is indeed throwing an
error and yet still writing it to the db. 

It seems that log4j could solve this by changing the execute() method to be in
charge of adding to the removes.add(..) call, and then having a setAutoCommit in
there so that a rollback is performed if an Exception is thrown (and the
removes.add(...) is not done). This change of responsibility might be bad for
subclasses; so the other option would be to change execute() to take a
Connection parameter and put flushBuffer() in charge of the Connection.

-- 
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