[ 
https://issues.apache.org/jira/browse/CASSANDRA-10447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14945255#comment-14945255
 ] 

Paulo Motta commented on CASSANDRA-10447:
-----------------------------------------

The shutdown hook seems to be implemented correctly on 
[DelayingShutdownHook|https://github.com/qos-ch/logback/blob/master/logback-core/src/main/java/ch/qos/logback/core/hook/DelayingShutdownHook.java],
 that calls {{ContextBase.stop()}}. Even though the 
[ContextBase|https://github.com/qos-ch/logback/blob/master/logback-core/src/main/java/ch/qos/logback/core/ContextBase.java]
 {{stop()}} implementation only shutdowns an executor service, it seems the 
[LoggerContext|https://github.com/qos-ch/logback/blob/master/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java],
 which overrides {{ContextBase.stop()}}, closes all appenders when invoked by 
{{DelayingShutdownHook}}.

In what situations is the problem occurring, is there an easy way to reproduce? 
Maybe shutdown hooks are never triggered during unit tests? We need first to 
clarify if this is specific to the test configuration or if it also happens in 
the production configuration too. I'm happy to review and help with this.

> Async logging configuration doesn't result in data flushing when shutdown 
> hook runs
> -----------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-10447
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10447
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Ariel Weisberg
>            Assignee: Ariel Weisberg
>             Fix For: 3.0.0 rc2
>
>
> Stefania discovered that tests that don't produce a lot of log output end up 
> producing 0 debug output to files because the data is not flushed as part of 
> the shutdown hook. I traced through and it looks like the shutdown hook 
> doesn't actually invoke code that does anything useful. It shuts down an 
> executor service in the logging context but doesn't call stop on any 
> appenders.
> A hackish thing we can do is use a status listener to collect all the 
> appenders and then stop them when the shutdown hook runs. Even adding a small 
> delay to the shutdown hook (no code changes on our part) would in let the 
> async appender flush in 90% of cases.
> We still need to fix it for test which uses a different config file and for 
> which a small delay is not desirable.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to