[logback-dev] [JIRA] Updates for LOGBACK-1620: log messages in contextDestroyed does not work anymore

QOS.CH (JIRA) noreply-jira at qos.ch
Fri Mar 11 22:17:00 CET 2022


logback / LOGBACK-1620 [Open]
log messages in contextDestroyed does not work anymore

==============================

Here's what changed in this issue in the last few minutes.
This issue has been created
This issue is now assigned to you.

View or comment on issue using this link
https://jira.qos.ch/browse/LOGBACK-1620

==============================
 Issue created
------------------------------

John Pace created this issue on 11/Mar/22 10:02 PM
Summary:              log messages in contextDestroyed does not work anymore
Issue Type:           Bug
Affects Versions:     1.2.3
Assignee:             Logback dev list
Created:              11/Mar/22 10:02 PM
Priority:             Major
Reporter:             John Pace
Description:
  I am using slf4j 1.7.31 and logback 1.2.3 to log messages in a application for Apache Tomcat. I added the annotation @WebListener to one class, which handle various tasks on start/shutdown of the application. Here are the important parts of this class:
  {code}@WebListener
  public class AutoLoad implements ServletContextListener {
  
  private static final Logger log = LoggerFactory.getLogger(AutoLoad.class);
  
  public void contextInitialized(ServletContextEvent event) {
   log.info("Starting {}", APP_NAME);
   }
  
  public void contextDestroyed(ServletContextEvent event) {
   log.info("Shutting down {}", APP_NAME);
   if (LoggerFactory.getILoggerFactory() instanceof LoggerContext) {
   ((LoggerContext) LoggerFactory.getILoggerFactory()).stop();
   }
   } 
  }\{code}
  
  I always see the starting-message. But since some versions of logback I no longer see the shutdown-message. It still works, if I replace logback with slf4j-simple.
  
  This is possibly related: I had to add this line
  > LoggerFactory.getILoggerFactory()).stop();
  because I suddently got warning on shutdown.


==============================
 This message was sent by Atlassian Jira (v8.8.0#808000-sha1:e2c7e59)



More information about the logback-dev mailing list