Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Support logback context properties #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hholierhoek
Copy link
Contributor

Hi,

I have a scenario where some configuration (log pattern in my case) is coming from a shared properties file. But each app needs to provide its own app name which is referenced in the pattern.

This PR adds support for configuring properties in the logger context, as one can do with a logback.xml.

if (logbackConfig.hasPath("properties")) {
if (logbackConfig.getValue("properties") instanceof ConfigObject) {
final ConfigObject propertyConfigs = (ConfigObject) logbackConfig.getValue("properties");
for (Entry<String, ConfigValue> entry : propertyConfigs.toConfig().entrySet()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of propertyConfigs.toConfig().entrySet() here will flatten any objects so one doesn't have to quote a property named 'x.y.z'.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant