25

I wanna read spring property and based on this property change log level for some packages (not for root logger). How can I implement it using logback?

fedor.belov
  • 22,343
  • 26
  • 89
  • 134

1 Answers1

38

See top related question: SLF4J - Logback: How to configure loggers in runtime?

More specific ((ch.qos.logback.classic.Logger)LoggerFactory.getLogger("abc.xyz")) .setLevel(Level.XXX) should do the trick.

I'm not sure what your use case is, but I prefer to use the JMX interface: http://logback.qos.ch/manual/jmxConfig.html.

Community
  • 1
  • 1
GeertPt
  • 16,398
  • 2
  • 37
  • 61