[JAVA] Logback log is not output when the server application is closed

background Updated various plug-in versions with system replacement While checking the operation, notice that the log at the time of system shutdown is not output.

Constitution java9、Tomcat9、logback+slf4j、Springframework

Factors of occurrence Change logback version from 1.0.13 to 1.2.3.

Location of occurrence The listener class that implemented javax.servlet.ServletContextListener # contextDestroyed was logging when the system was shut down.

Action 1 logback context outage Added context stop according to logback site https://logback.qos.ch/manual/configuration_ja.html#stopContext

However, this alone does not solve the problem.

Action 2 Add logbackDisableServletContainerInitializer to web.xml There was an answer on the English page, although it was not on the Japanese translation page https://logback.qos.ch/manual/configuration.html#webShutdownHook

After adding the setting of Action 2, the log is output safely.

Recommended Posts

Logback log is not output when the server application is closed
When the project is not displayed in eclipse
When the server does not start with rails s
When there is no output to stdout in docker log
The idea of cutting off when the error is not resolved
[Rails] When the layout change of devise is not reflected
How to get the log when install4j does not start
Put the date (e.g. yyyy-MM-dd) in the log file output by logback
How to output the value when there is an array in the array
Investigation method when the CPU of the server running java is heavy
Incident (rails) that is logged out when user editing of the application
When the bean class name is duplicated
Explanation until the original application is completed
Possibility when deploying to EC2 but nothing is displayed in the error log
[Twitter API] Countermeasures when "It is not safe" appears on the https site
How to set when "The constructor Empty () is not visible" occurs in junit