Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-857

Inheritance across multiple logback.xml files

    XMLWordPrintable

Details

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 1.0.12
    • logback-core
    • None

    Description

      I'd like to propose the following feature:

      Currently logback prints a warning if multiple logback.xml files are found on the classpath. Instead, I suggest introducing an inheritance mechanism whereby configuration found earlier on the classpath overrides configuration found later on the classpath.

      You might want to add an option to prevent further inheritance (meaning, ignore any configuration files found later on in the classpath). I don't have a use for such an option yet but others might.

      Why do I need this feature? I developed a framework that runs applications inside child classloaders. The classloader allows applications to see the framework but not its dependencies (so as to not pollute its classpath). I'd like to provide logback.xml in the parent classpath (for any logging carried out by the framework) but users can do their own logging in the child classloader (with their own logbackx.xml). Next, I'd like to allow the child logback.xml to override the parent logback.xml so that if users wish to modify logging done by the framework they are able to do so directly from their own configuration file instead of having to modify the framework JAR file.

      I hope you understand what I mean. If not, please ask and I'll clarify further.

      Attachments

        Activity

          People

            logback-dev Logback dev list
            cowwoc Gili
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: