Logging data throughout our openHAB programming & examining openHAB's logs are helpful to our debugging.
By default, changes in item states, warnings, errors, & data we generate with logInfo() are writen to openhab.log & events.log in openHAB's log folders. For viewing, we can load these .log files into a text editor like Notepad++. We can also view their scrolling entries in real time, by entering log:tail in openHAB's Karaf console. If we generate multiple log entries, this can grow cumbersome & confusing.
To debug certain projects or to record information we may want/need later, we might set openHAB to log similar-topic data in a log file other than openhab.log or events.log.
A rule statement such as logInfo("Irrigation", "Valves ON") has the potential to make a time-stamped entry in a separate Irrigation.log file. However, some setup is required first. Otherwise, the log entry will just show up in openhab.log.
The following is how I did it for openHAB 2.5.0.M1 which may relate to other recent versions. I adapted what I found here (See the reply after "Try:").
Let's say we have the openHAB rule statement And we want that statement to make time-stamped entries of "Valves ON" in an Irrigation.log file
Find org.ops4j.pax.logging.cfg in openHAB's \userdata\etc folder. Open the file in a text editor like Notepad++. At the end of the org.ops4j.pax.logging.cfg file, add the following lines (& save the.cfg file):
The above setup will create the Irrigation.log file & append each time-stamped entry generated by Rule lines that start with logInfo("Irrigation", ...)
To create entries in another file (separate from openhab.log or events.log), search the added lines in the last post AND in your Rule lines & replace Irrigation with another name (may be best to avoid spaces in the name).