You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Matt Sicker (JIRA)" <ji...@apache.org> on 2014/03/24 16:30:43 UTC

[jira] [Created] (LOG4J2-577) Refactor LoggerContext initialization/destruction code

Matt Sicker created LOG4J2-577:
----------------------------------

             Summary: Refactor LoggerContext initialization/destruction code
                 Key: LOG4J2-577
                 URL: https://issues.apache.org/jira/browse/LOG4J2-577
             Project: Log4j 2
          Issue Type: Task
          Components: Configurators, Core
    Affects Versions: 2.0-rc1
         Environment: Standard JRE, servlet context, and extensible for other containers like OSGi
            Reporter: Matt Sicker
            Assignee: Matt Sicker


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).



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org