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

LogbackValve configuration from resource

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.1.3
    • Fix Version/s: 1.1.6
    • Component/s: logback-access
    • Labels:
      None

      Description

      To use logback access with Spring Boot and its embedded Tomcat I find myself having to set up the LogbackValve programmatically.

      My app's configuration is packaged as a resource inside the application jar, however ch.qos.logback.access.tomcat.LogbackValve has only a setFilename method that requires a path to a normal java.io.File.

      I propose to refactor the class and add the possibility to read from classpath resources as well. In alternative moving the configuration reading operation to a dedicated method that a subclass can override would be enough.
      The second approach should be trivial and I could provide a patch if desired.

        Issue Links

          Activity

          Hide
          abatkin Adam Batkin added a comment -

          See also: https://github.com/qos-ch/logback/pull/288 (appears to do almost the same thing)

          Show
          abatkin Adam Batkin added a comment - See also: https://github.com/qos-ch/logback/pull/288 (appears to do almost the same thing)
          Hide
          abatkin Adam Batkin added a comment -

          And also the actual PR for this issue: https://github.com/qos-ch/logback/pull/263

          Show
          abatkin Adam Batkin added a comment - And also the actual PR for this issue: https://github.com/qos-ch/logback/pull/263
          Hide
          noreply.ceki@qos.ch Ceki Gulcu added a comment - - edited

          Fixed in a recent commit.

          LogbackValve code was changed to look for the specified file (conf/logback-access.xml by default) under ${catalina.base} and ${catalina.home} second. If both lookups fail, the file is looked up as a resource.

          Show
          noreply.ceki@qos.ch Ceki Gulcu added a comment - - edited Fixed in a recent commit. LogbackValve code was changed to look for the specified file (conf/logback-access.xml by default) under ${catalina.base} and ${catalina.home} second. If both lookups fail, the file is looked up as a resource.

            People

            • Assignee:
              noreply.ceki@qos.ch Ceki Gulcu
              Reporter:
              aratto Andrea Ratto
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: