tkowalcz / tjahzi

Java clients, log4j2 and logback appenders for Grafana Loki
MIT License
106 stars 18 forks source link

Logger and thread name labels for logback appender. #107

Closed jeantil closed 1 year ago

jeantil commented 1 year ago

Hello,

I am trying to get a logger and thread labels using the logback appender. It looks like it is possible for log4j using log4j patterns (requested in https://github.com/tkowalcz/tjahzi/issues/56 and introduced in https://github.com/tkowalcz/tjahzi/pull/62) but not in logback.

I have found the predefined level label, I managed to have labels sourced from environment such as

<label>
 <name>server</name>
 <value>${HOSTNAME}</value>
</label>

I also have mdc labels

<mdcLogLabel>
  host
</mdcLogLabel>

but none of these allow me to tag the log line with logger or thread name.

Looking at the definition of ch.qos.logback.classic.spi.ILoggingEvent, both properties are information at the same level as loglevel

tkowalcz commented 1 year ago

Thank you for a thorough analysis and code contribution. Please allow me a few day to investigate it and evaluate the PR. Much appreciated.