[logback-dev] [JIRA] Commented: (LBCLASSIC-260) Recording appender that dumps debug messages only when error occurs

Ceki Gulcu (JIRA) noreply-jira at qos.ch
Mon May 7 10:53:27 CEST 2012


    [ http://jira.qos.ch/browse/LBCLASSIC-260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12422#action_12422 ] 

Ceki Gulcu commented on LBCLASSIC-260:
--------------------------------------

Thank you for yet another great idea and associated implementation. 

Looking at RecordingAppender, I see that you are using ThreadLocal variables which allow the appender to  dump events per thread. 

Are you aware LBCLASSIC-183 ? If my memory serves me correctly, Tomcat dislikes ThreadLocal classes, such as the ch.qos.logback.classic.util.CopyOnInheritThreadLocal class, when loaded by the web-app class loader. I am unsure if this restriction applies to values whose class is loaded by the web-app class loader. In other words, it is possible that using ch.qos.logback.core.helpers.CyclicBuffer, the value type for the ThreadLocal in RecordingAppender, might be problematic in Tomcat.  Redeploying an application which uses  RecordingAppender in Tomcat should tell us whether  LBCLASSIC-183 applies.

> Recording appender that dumps debug messages only when error occurs
> -------------------------------------------------------------------
>
>                 Key: LBCLASSIC-260
>                 URL: http://jira.qos.ch/browse/LBCLASSIC-260
>             Project: logback-classic
>          Issue Type: New Feature
>          Components: appender
>    Affects Versions: 0.9.28
>            Reporter: Tomasz Nurkiewicz
>            Assignee: Logback dev list
>
> Provide built-in utility appender that silently stores last few logging messages and dumps them (forwards to a target appender) only when an error occurs. Older logging events are replaced with new ones. This is a configuration example:
> <configuration>
>   <appender name="REC" class="ch.qos.logback.classic.RecordingAppender">
>     <appender-ref ref="STDOUT"/>
>     <maxEvents>1000</maxEvents>
>     <dumpThreshold>WARN</dumpThreshold>
>     <expiryTimeMs>15000</expiryTimeMs>
>   </appender>
>   <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
>     <encoder>
>       <pattern>%-4relative [%thread] %-5level - %msg%n</pattern>
>     </encoder>
>   </appender>
>   <root level="DEBUG">
>     <appender-ref ref="REC"/>
>   </root>
> </configuration>
> Such an appender is crafted manually by several users, it would be nice to provide it out of the box. I already implemented this feature (100% test coverage):
> https://github.com/nurkiewicz/logback/tree/recording-appender

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the logback-dev mailing list