For the last hour I tried to move the log entries of level WARN and ERROR to their own log file openhab_warn.log and openhab_err.log through changes in org.ops4j.pax.logging.cfg.
Unfortunately, all I managed to do was to create a duplicate of openhab.log .
It seems I really don’t understand how this log4j2 configuration works
Has anyone moved this items to their own files and is willing to share his configuration?
I’m not certain that’s possible. The typical thing one would do is move all the logs from a specific add-on or specific part of OH to it’s own log, regardless of logging level. It is usually more informative to see all the log statements from all the logging levels for a given set of code together since that will show you what’s happening in context. If you split them up you end up with needing to correlate statements across multiple files in order to figure out what happened, defeating the whole purpose of the logs in the first place.
There are lots of examples for putting all the logs from a given add-on into it’w own file. Log4j2 Sample Config is a great example. There is also an example in the Zwave binding docs I believe.
I’m more concerned with monitoring here. I think once the initial setup is done and working the day-today INFO-content of the log is not so important. But monitoring the warnings and errors would be nice, and those would stand out more if they were in a separate file
Now for that purpose, any half way decent monitoring system can ignore messages at lower levels or messages it does not know, so why not proceed with the existing log.
log4j2 actually isn’t specific to openHAB, so eventually you may find an answer at https://logging.apache.org/log4j/2.x/