Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log viewer seems to ignore filters set in log4j2.xml #2930

Open
zolakk opened this issue Dec 19, 2024 · 2 comments
Open

Log viewer seems to ignore filters set in log4j2.xml #2930

zolakk opened this issue Dec 19, 2024 · 2 comments
Labels
bug Something isn't working main ui Main UI

Comments

@zolakk
Copy link

zolakk commented Dec 19, 2024

The problem

I have several events filtered in the log4j2.xml because they are very chatty like this:
`<! -- Event log appender -->

	<RollingRandomAccessFile fileName="${sys:openhab.logdir}/events.log" filePattern="${sys:openhab.logdir}/events.log.%i.gz" name="EVENT">
		<RegexFilter onMatch="DENY" onMismatch="NEUTRAL" regex=".*(MQTTInkbird|Hyperion|Pool_|Spa_|OneCallAPIweatherandforecast|LogReaderEvents|ZWaveSerialController|Phone|Bluetooth).*"/>
		<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
		<Policies>
			<OnStartupTriggeringPolicy/>
			<SizeBasedTriggeringPolicy size="16 MB"/>
		</Policies>
		<DefaultRolloverStrategy max="7"/>
	</RollingRandomAccessFile>`

When using the new log viewer, it seems to ignore that filtering making viewing logs very difficult and the filter field doesn't seem to support a "not" filter like !MQTTInkbird that I can think of

Expected behavior

Expected to have the log viewer output match the log file contents

Steps to reproduce

  1. Open log viewer, compare output to events.log file. Entries are correctly filtered out of the log file but not the viewer

Your environment

  version: 4.3.0
  buildString: Release Build
locale: en-US
systemInfo:
  configFolder: /openhab/conf
  userdataFolder: /openhab/userdata
  logFolder: /openhab/userdata/logs
  javaVersion: 17.0.13
  javaVendor: Debian
  osName: Linux
  osVersion: 6.2.0-39-generic
  osArchitecture: amd64
  availableProcessors: 4
  freeMemory: 431795872
  totalMemory: 769654784
  uptime: 197664
  startLevel: 70
addons:
  - automation-jsscripting
  - automation-jythonscripting
  - binding-astro
  - binding-chatgpt
  - binding-denonmarantz
  - binding-ecobee
  - binding-exec
  - binding-http
  - binding-hyperion
  - binding-mail
  - binding-mqtt
  - binding-network
  - binding-plex
  - binding-serial
  - binding-sleepiq
  - binding-tasmotaplug
  - binding-telegram
  - binding-vesync
  - misc-metrics
  - misc-openhabcloud
  - persistence-influxdb
  - persistence-mapdb
  - persistence-rrd4j
  - transformation-jinja
  - transformation-jsonpath
  - transformation-map
  - transformation-regex
  - ui-habot
  - voice-googlestt
  - voice-googletts
clientInfo:
  device:
    ios: false
    android: false
    androidChrome: false
    desktop: true
    iphone: false
    ipod: false
    ipad: false
    edge: false
    ie: false
    firefox: false
    macos: false
    windows: true
    cordova: false
    phonegap: false
    electron: false
    nwjs: false
    webView: false
    webview: false
    standalone: false
    os: windows
    pixelRatio: 1
    prefersColorScheme: dark
  isSecureContext: true
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: 8
    hardwareConcurrency: 12
    language: en-US
    languages:
      - en-US
      - en
    onLine: true
    platform: Win32
  screen:
    width: 1920
    height: 1080
    colorDepth: 24
  support:
    touch: false
    pointerEvents: true
    observer: true
    passiveListener: true
    gestures: false
    intersectionObserver: true
  themeOptions:
    dark: dark
    filled: true
    pageTransitionAnimation: default
    bars: light
    homeNavbar: default
    homeBackground: default
    expandableCardAnimation: default
    blocklyRenderer: null
  userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
    like Gecko) Chrome/132.0.0.0 Safari/537.36
timestamp: 2024-12-19T00:01:27.443Z


Browser console

No errors in the browser console

Browser network traffic

N/A

Additional information

Maybe have the log stream pre-filtered by default (filter field pre-populated with the "not" filter?) with an option to view everything?

@zolakk zolakk added bug Something isn't working main ui Main UI labels Dec 19, 2024
@cdjackson
Copy link
Contributor

You have this filtering configured on the openhab.log appender - so the logging in the core will clearly not be filtered in the same way.

I am not 100% sure, but I think that you could try to configure the OSGI appender to see if that works - ie look in the XML file for -:

		<!-- OSGi appender -->
		<PaxOsgi filter="*" name="OSGI"/>

I'm not 100% sure if this will work, but my understanding of the core implementation is that it is effectively another appender, so possibly this is the one.

@zolakk
Copy link
Author

zolakk commented Dec 20, 2024

That's a good point, I'll take a look at it and see if I can get something working playing with filters in that and/or other areas of the logger config file. Hopefully it's something that simple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working main ui Main UI
Projects
None yet
Development

No branches or pull requests

2 participants