I have recently migrated from 2.5 to 3.1. Previously I had logging to separate log files. With the changes in ver 3, it stopped working. My OS is Ubuntu 18.04.
For example, in my rules I want to log motion events in to a log file motion.log.
rule "Foyer Motion"
when
Item Foyer_Motion changed
then
var String msg = "Foyer Motion "
msg = msg.concat(String::valueOf(Foyer_Motion.state))
logInfo("motion", msg)
end
I have modified my /var/lib/openhab/etc/log4j2.xml file to append this to the end:
<!-- motion appender -->
<RollingRandomAccessFile fileName="${sys:openhab.logdir}/motion.log" filePattern="${sys:openhab.logdir}/motion.log.%i" name="MOTION">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
<Policies>
<OnStartupTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="16 MB"/>
</Policies>
</RollingRandomAccessFile>
<!-- motion -->
<!-- motion Logger -->
<Logger additivity="false" level="INFO" name="org.eclipse.smarthome.model.script.motion">
<AppenderRef ref="MOTION"/>
</Logger>
<!-- motion -->
</Configuration>
I should add, the motion.log file is created, but the logs are writing into openhab.log. The motion.log is empty.
I donāt know what I am doing wrong. Any ideas?
Thanks