Uploaded image for project: 'Fedora Repository Project'
  1. Fedora Repository Project
  2. FCREPO-1186

Fedora overrides logback configuration for other webapps as well

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Fedora 3.5, Fedora 3.6.2
    • Fix Version/s: Fedora 3.7
    • Component/s: legacy - Fedora
    • Labels:
      None
    • Environment:
      Tomcat 6 (but probably other web containers, too)

      Description

      The class org.fcrepo.utilities.LogConfig initializes the logback configuration with its initFromFile method. It does so, however, by setting the system property logback.configurationFile if it is not already set. This leads to one of the following problems:

      • If the property is already set, the fedora logback configuration is not used.
      • If the property is not already set, Fedora sets it, overriding any logback.xml files that may be on the classpath, even for other web applications.

      A better way to programmatically load a logback configuration, just for your own webapplication, would be to use a ServletContextListener and have it execute something like the following in its contextInitialized method:

             LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
             JoranConfigurator configurator = new JoranConfigurator();
             configurator.setContext(lc);
             lc.reset();
             configurator.doConfigure(externalConfigFile);
             logger.info("Configured Logback with config file from: {}", externalConfigFile.getAbsolutePath());
      

        Attachments

          Activity

            People

            • Assignee:
              ajs6f@virginia.edu A. Soroka
              Reporter:
              janvanmansum Jan van Mansum
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: