Details
-
Task
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
2.0-rc1
-
None
-
Standard JRE, servlet context, and extensible for other containers like OSGi
Description
Currently, the code for initialization is a bit scattered due to the servlet context initialization being added far later than the core stuff. The LoggerContext initialization code needs to be refactored to allow drop-in implementations based on the usage context. For example, the default init/destroy path is based in the LoggerContextFactory a shutdown hook thread to stop it. The web context uses a ServletContextListener (or more specifically, the web initialization class) to construct and destroy the LoggerContext. An OSGi bundle might wish to use a BundleActivator to start and stop the LoggerContext. There may be other usage scenarios not covered such as in an EJB, etc.
The code for selecting a context is already modular in this way via the ContextSelector interface. I'd like to see something similar for the starting and stopping of a LoggerContext. See, for example, how it's done in logback (or slf4j if that's where it's implemented) or other logging frameworks (if any alternatives really exist).
Attachments
Issue Links
- is related to
-
LOG4J2-570 Memory Leak
- Resolved