Remove Log Source

Hi guys,

Just upgraded from 5.0 to 5.1 and now I am getting the ‘source’ on all the events.

Can I remove this ‘source’ part?

18:34:58.262 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘Multi1_Motion’ changed from ON to OFF (source: org.openhab.core.thing$zigbee:device:986908efef:a4c1388e0e613536:A4C1388E0E613536_1_intrusion)

It’s cluttering my logs.

No, not at this time. It’s part of the event. I’m sure an option to turn it on and off could be implemented but there isn’t one now.

I can’t find it now but somewhere someone posted a log4j2 regex filter that removes it at the logging configuration level.

I’ll only add that the source has already helped several users solve otherwise hard to diagnose problems, immediately identifying whether a rule or a Thing or a UI was behaving strangely and in the case of rules exactly which rule was the problem. It wasn’t added “just because”, especially for those experiencing problems knowing where an event comes from is as important as knowing the event occurred in the first place.

That’s fair enough, I fail to see why when it was added it wasn’t added as optional though, not everybody wants a bloated log. If there’s a problem that a ‘normal’ log can’t identify, simply turn on this new extended logging.

This is getting hard to read. Was there a way to apply some coloring in the log, so eyes focus on the important stuff?

In the log reader under Developer Tools? You’ll need to open an issue to request that but it should be possible to add that.

Anywhere else you’ll need to look into how that tool does coordinating and configure it as appropriate. The logger itself doesn’t do any color coding. That’s all implemented by what ever you are using to view the logs.

I think it is already there:

On the bottom of the log viewer, click “Configure highlights”, then for example:

I don’t think that’s what @agrarina is asking for. I understand them to be asking to highlight the whole “(source:…)” part of the line in a different color.

Does the highlight field accept regex?

Yes:

1 Like

and for those with the same problem as @psych
in log4j.xml the log-appenders are configured… so for events.log as well
if you replace

<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} \[%-5.5p\] \[%-36.36c\] - %m%n"/>

with

<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} \[%-5.5p\] \[%-36.36c\] - %replace{%m}{\\s\\(source:.\*\\)}{}%n"/>

it will strip the (source: … ) part in the logs

… and also remove important information for troubleshooting :person_shrugging:

which is correct…
however, the ones that are able to implement the change to make logs more readable, are also able to revert it if they need the level of debugging.
I have tail -f for both openhab.log and events.log running full width on a 32” monitor… and the “source-information” will introduce line-breaks even in that setup :face_with_spiral_eyes:
[edit]
it’s as always nowadays with the disclaimers… “use at own risk” :smiley:
or even better… if space and read-write-cycles on a SD-card are of no concern… create a dedicated appender logging to “events-readable.log”