[logback-dev] [JIRA] Created: (LBCLASSIC-311) Facade method for configuration by xml: Programmatic configuration should be a single line

Geoffrey De Smet (JIRA) noreply-jira at qos.ch
Sun Dec 4 16:28:12 CET 2011


Facade method for configuration by xml: Programmatic configuration should be a single line
------------------------------------------------------------------------------------------

                 Key: LBCLASSIC-311
                 URL: http://jira.qos.ch/browse/LBCLASSIC-311
             Project: logback-classic
          Issue Type: New Feature
          Components: joran
    Affects Versions: 1.0.0
            Reporter: Geoffrey De Smet
            Assignee: Logback dev list


>From a user's perspective, it doesn't a bit overkill to copy paste all this stuff:

{code}
    LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    
    try {
      JoranConfigurator configurator = new JoranConfigurator();
      configurator.setContext(context);
      // Call context.reset() to clear any previous configuration, e.g. default 
      // configuration. For multi-step configuration, omit calling context.reset().
      context.reset(); 
      configurator.doConfigure(getClass.getResource("/com/domain/project/logback.xml"));
    } catch (JoranException je) {
      // StatusPrinter will handle this
    }
    StatusPrinter.printInCaseOfErrorsOrWarnings(context);
{code}

It would be nicer if we had a simple static facade method, on JoranConfigurator or LoggerContext, that does all that stuff:

{code}
JoranConfigurator.configure(getClass.getResource("/com/domain/project/logback.xml"));
{code}

We shouldn't need to understand the internals and the lifecycle of the JoranConfigurator.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the logback-dev mailing list