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

Detect logback.ContextSelector in System environment

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.3.0-alpha0
    • Fix Version/s: None
    • Component/s: logback-classic
    • Labels:
    • Environment:

      Any

      Description

      We have a use case where it is very useful to allow ContextSelectorStaticBinder to discover the logback.ContextSelector from the environment properties as opposed to the System properties. It comes up when you have multiple apps running in the same container and need to specify an alternate ContextSelector for only one of the apps, whereas the System property would affect all apps (and the container itself). The patch is trivial and is attached to this issue.  Basically, in ContextSelectorStaticBinder.init(), instead of:

      String contextSelectorStr = OptionHelper.getSystemProperty(ClassicConstants.LOGBACK_CONTEXT_SELECTOR);

      The patch does:

      String contextSelectorStr = OptionHelper.getEnv(ClassicConstants.LOGBACK_CONTEXT_SELECTOR);
      if (contextSelectorStr == null) {
         contextSelectorStr = OptionHelper.getSystemProperty(ClassicConstants.LOGBACK_CONTEXT_SELECTOR);
      }

      The patch can be applied to 1.2.4-SNAPSHOT (is that a thing?) or 1.3.0-SNAPSHOT, the ContextSelectorStaticBinder is the same in both.

      Thank you!

        Attachments

          Activity

            People

            • Assignee:
              ceki Ceki Gülcü
              Reporter:
              rsand Richard Sand
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: