Just adding this here since I couldnāt find it again after doing it almost a year ago, and the OH2.2 upgrade reverted the /srv/openhab2-userdata/etc/org.ops4j.pax.logging.cfg file.
Simple string filtering on the event log. Useful for filtering out high change items that donāt need constant log visibility.
Prior to OH2.2 - using log4j
# Jp - filter out stuff
log4j.appender.event.filter.smappee=org.apache.log4j.varia.StringMatchFilter
log4j.appender.event.filter.smappee.StringToMatch=power_smappee
log4j.appender.event.filter.smappee.AcceptOnMatch=false
Taken from an example in Log4j2 Sample Config, the following appears to do the same under OH2.2
There are probably better ways to do it, but for now that works, and excludes the power_smappee (power consumption, changes by the second) from the log files.
It would be great if you post this as its own thread in Examples and Tutorials. Lots of people have asked for how to filter out events from events.log.
Took your advice and split it out into itās own post. Since I had such a hard time finding the information originally (and after updating with OH2.2 replacing the config file) I donāt doubt youāre right itās something a lot of people ask for.
Itās pretty straightforward as configuration goes, and hopefully adding the filtering reference to the topic name should help people find it readily enough.
Side hint: If you change you logging conf and the change does not seem to work, check if the lines you changed have trailing whitespaces ! It took me several hours to figure that out - so I like to save that time to you ā¦
Unfortunately official documentation is for the xml file which was discontinued with OH2.
I am not sure why and nobody answered me. Maybe beacuse things would be too easy, then!
The log4j config file is identical when running on all platforms. One does not need to do anything special to make logging work when running on Windows as a service.
I totally broke all openhab logging after I edited the org.ops4j.pax.logging.cfg file. Now nothing is logging at all. I replaced the text of the file with what I found in the org.ops4j.pax.logging.cfg.dpkg-old file but no luck.
Iāve restarted it several times, used the openhabian config tool to install openhabian 2.2 (I believe I was running 2.3 snapshot) because I was under the impression that would reset everything in /var/lib/openhab2 and there for fix it but still no luck.
How do I clear the openhab.log file (not the console log which is explained in the documentation)?
Mine got to 15MB in size during the last install.
Thanks.
But what I was hoping to get across without saying it is:
15 MB is nothing to worry about
OH will move the file to openhab.log.1 when the file reaches 16 MB on its own and after it reaches the 9 it will automatically delete the old log files
in short, you shouldnāt be worrying about your log files, particularly if you do not have enough experience to be asking these questions in the first place.