Is there a way to create a logger name using regular expressions or wild card. The reason I am asking this is; my application uses a lot of third part libraries which I don't want to append to the same log. I want a seperate appender for them. What I wanted to know was if there is a way to create a logger name by defining a wildcard of package name and then all logs from that package go to that logger E.g.
<logger name="org.zookeeper.* additivity=false>
<appender ref="aaa"/>
</logger>
This should make all logs from package name which starts with org.zookeeper.* to go to the above specific logger.
Does logback support this facility?
Loggers. Loggers are the third main component of Logback, which developers can use to log messages at a certain level. The library defines 5 log levels: TRACE, DEBUG, INFO, WARN, ERROR; each of these has a corresponding logging method: trace(), debug(), info(), warn(), error().
Logback uses the same concepts as Log4j. So it's no surprise that even if they are using different file formats, their configurations are very similar. The following code snippet shows the same configuration as I used with Log4j.
Logback natively implements the SLF4J API.
The lastest version of logback.qos.ch (1.1. 7) supports the property "totalSizeCap". This property can be used to limit the total size of archived log files. Currently, the top level nifi pom. xml specifies version 1.1.
To log all org.zookeeper subpackages to "aaa" appender, you should omit the .* at the end of logger definition:
<logger name="org.zookeeper" additivity=false>
<appender ref="aaa"/>
</logger>
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