Вопрос

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?

Это было полезно?

Решение

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)
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top