[logback-dev] [JIRA] (LOGBACK-1306) Detect logback.ContextSelector in System environment
QOS.CH (JIRA)
noreply-jira at qos.ch
Tue May 30 21:06:00 CEST 2017
Richard Sand created LOGBACK-1306:
-------------------------------------
Summary: Detect logback.ContextSelector in System environment
Key: LOGBACK-1306
URL: https://jira.qos.ch/browse/LOGBACK-1306
Project: logback
Issue Type: Improvement
Components: logback-classic
Affects Versions: 1.3.0, 1.2.4
Environment: Any
Reporter: Richard Sand
Assignee: Logback dev list
Attachments: ContextSelectorStaticBinder.patch
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!
--
This message was sent by Atlassian JIRA
(v7.3.1#73012)
More information about the logback-dev
mailing list