Logging Rules into separate file

Hi,
I have lot of rule with some logging.
I would like move rule logging to a separate file, and if it is possibe only some specific rule logs.
For example I have a complex set of rules that handle my heater, so i would like to move only logging related to heater into a separate file. All log strinh of my heater, have a specific topic, for example heater.handling.some-stuff

is it possible to achieve this?

Thanks

Yes, it is possible. You need to define the logger accordingly. In my case it has to start with “Maehrlin”

in the rule:

MOWER_LOGGER = "Maehrlin.CuttingDuration"
LogAction.logDebug(MOWER_LOGGER, u"Dauer des Mähvorgangs: State {}".format(MaehrlinState))

in log4j2.xml

	<RollingRandomAccessFile fileName="${sys:openhab.logdir}/mährlin.log" filePattern="${sys:openhab.logdir}/History/mährlin.log.%i" name="MOWER">
		<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
		<Policies>
			<CronTriggeringPolicy schedule="0 0 0 ? * MON *"/>
		</Policies>
		<DefaultRolloverStrategy fileIndex="min" min="1" max="7"/>
	</RollingRandomAccessFile>

	<Logger additivity="false" level="DEBUG" name="org.openhab.core.model.script.Maehrlin">
		<AppenderRef ref="MOWER"/>
	</Logger>

many thanks