Closed danieltaub closed 2 years ago
Hi,
can you provide more details about your environment? Where did you define app
, hostname
etc.?
This configuration works for app
:
<configuration packages="pl.tkowalcz.tjahzi.log4j2">
<Properties>
<Property name="app">test</Property>
</Properties>
<appenders>
<Loki name="Loki">
...
<Label name="app" value="${app}"/>
</Loki>
</appenders>
...
also setting hostname like this (before log4j is initialised): System.setProperty("hostname", "test");
works for ${sys:hostname}
.
Very strange, when using the library with spring it's seems not to work for some reason
If you provide me more details about your spring setup or some bootstrap class (with dependency information) I will investigate.
I'm using spring-boot 2.6.2
and the latest log4j2 version 2.17.1
Tested the lookups with other appenders such as the json appender and it's also seems not to work, so look like it's not related to the loki appender...
When trying the below configuration, the lookup donse't parse the lookup and just putting the lookup name as the label value. I'm using the appender latest version and applied all the configs as the docs.
using log4j2 via spring library, and run it as container in k8s. so the lookups should be valid, even copy the example from the docs dosen't work