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

Use of default values in appender-refs

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: logback-classic
    • Labels:
      None
    • Environment:

      All

      Description

      This is referenced also here: http://old.nabble.com/Appender-Ref-Default-Value-to28605941.html

      Please can we have the ability to specify default values for appender-refs. I have a use case where we need to "bake-in" the appender during build-time. I can do this at the moment for logger level by bringing in a property file (called override.properties) that can reset the logging level (which is dependent on the deployment environment and other factors).

      Here is a little example:

      <property resource="override.properties" />

      <logger name="bar.foo" level="$

      {bar.foo.log.level:-info}

      " additivity="false">
      <appender-ref ref="console"/>
      </logger>

      The bar.foo.log.level is defined in the override.properties file. The correct file gets inserted for each build type.

      I would like to do the following as well:

      <logger name="bar.foo" level="$

      {bar.foo.log.level:-info}

      " additivity="false">
      <appender-ref ref="$

      {bar.foo.log.appender:-console}

      "/>
      </logger>

      So that I can tell the override where to log to (console for development or log file, or smtp, or jms, or db for other environments).

      This would be so neato if implemented

      Thank you.

      =david=

        Attachments

          Activity

            People

            • Assignee:
              ceki Ceki Gülcü
              Reporter:
              dharrigan David Harrigan
            • Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: