I want to use LevelChangePropagator as logback contextListener, as described in the logback manual. However in my project logback is configured using groovy, and there's nothing in the official documentation about configuring contextListener in groovy. Logback provides a tool to translate xml configuration into a groovy configuration. I tried it, but it just skipped the contextListener part.
I've found exactly one answer to my question in the logback mailing lists, but solution doesn't seem to be working for me.
EDIT:
I've created an issue in logback JIRA about missing documentation: http://jira.qos.ch/browse/LOGBACK-979. Still, maybe someone knows the answer?
Setting the location of the configuration file via a system property. You may specify the location of the default configuration file with a system property named "logback. configurationFile" . The value of this property can be a URL, a resource on the class path or a path to a file external to the application.
debug=true to enable debugging of the logback setup. Unfortunately, there is no way to enable debugging via a System property. You have to use <configuration debug="true"> in the logback. xml .
Setting the context name is a simple and straightforward method in order to distinguish between multiple applications logging to the same target. This last example illustrates naming of the logger context. Adding the contextName conversion word in layout's pattern will output the said name.
Add this to logback.groovy:
import ch.qos.logback.classic.jul.LevelChangePropagator
def lcp = new LevelChangePropagator()
lcp.context = context
lcp.resetJUL = true
context.addListener(lcp)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With