Disable warnings in log

I’ve receive a lot of logs because my trick with Tasmota. (I’ve created short version of mqtt message).

[WARN ] [t.generic.ChannelStateTransformation] - Executing the JSONPATH-transformation failed: Invalid path '$.Switch1' in '{"Switch2":"OFF"}'

I am trying to disable this messages in logs.

I’ve added section in userdata/etc/org.ops4j.pax.logging.cfg file:

log4j2.appender.out.filter.pirtransform.type = RegexFilter
log4j2.appender.out.filter.pirtransform.regex = .*Executing the JSONPATH-transformation failed.*
log4j2.appender.out.filter.pirtransform.onMatch = DENY
log4j2.appender.out.filter.pirtransform.onMisMatch = ACCEPT

But it doesn’t work. I’ve based on other topics and event bus filters. What is the right way to filter transformation logs?

Did you know that you can use REGEX on your transformationPattern to filter the message before it gets passed to the JSONPath transformation? This way you won’t get warnings in your logs, because, well, there’s nothing to warn of.

I use it here with a MagicHome device in the RESULT topic: Tasmota flashed MagicHome RGB LED strip controller via mqtt

Scroll to the Things file heading for an example and explanation.

Relevant: MQTT 2.5 M1+ How to implement the equivalent to MQTT1 REGEX filters

3 Likes

Very nice trick/workaround. Works like a charm. Thank you.