[SOLVED] OH3 logging not possible, openhab.log last entries some days ago

System details

runtimeInfo:
  version: 3.2.0.M3
  buildString: Milestone Build
locale: de-DE
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 11.0.9.1
  javaVendor: Azul Systems, Inc.
  javaVendorVersion: Zulu11.43+100-CA
  osName: Linux
  osVersion: 5.10.63-v7+
  osArchitecture: arm
  availableProcessors: 4
  freeMemory: 48674904
  totalMemory: 247332864

`
Some days ago I mentioned that there were no new entries in openhab.log and event log…

Today I tried to fix this without success, because I don’t know what this means…

openhab> log:list and log:get gives me the follwig output

openhab> log:list    and log:get  gives me the follwig output
22:09:40.740 [Karaf ssh console user openhab] ERROR org.apache.karaf.shell.support.ShellUtil - Exception caught while executing command
java.lang.IllegalStateException: Unrecognized configuration
        at org.apache.karaf.log.core.internal.LogServiceImpl.getDelegate(LogServiceImpl.java:63) ~[?:?]
        at org.apache.karaf.log.core.internal.LogServiceImpl.getLevel(LogServiceImpl.java:81) ~[?:?]
        at org.apache.karaf.log.command.GetLogLevel.execute(GetLogLevel.java:49) ~[?:?]
        at org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) ~[?:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]
Error executing command: Unrecognized configuration
openhab>

Thanks in advance for a helpful suggestion
Paul

1 Like

Today I did go back to 3.2.0.M2
But i have no idea how to fix this problem

When I type log:list
or
log:tail
always the response is : Error executing command: Unrecognized configuration

When last did the logging work - any changes that may have caused the logging to break?

Did you upgrade from <3.0?

Can you share (/userdata/etc):

log4j2.xml
org.ops4j.pax.logging.cfg

Thank you Mark, because of your questions I made one step forward !

  1. When last did the logging work - any changes that may have caused the logging to break?
    → last entries in openhab.log and events.log are from October 11
    → yes I made changes, but I don’t really remember the details …

  2. Did you upgrade from <3.0?
    → no, I started from scratch with 3.0 and did some steps towards 3.2.0.M3

3a. /var/lib/openhab/etc/log4j2.xml (for openHAB3 !)

<?xml version="1.0" encoding="UTF-8" standalone="no"?><Configuration monitorInterval="10">

	<Appenders>
		<!-- Console appender not used by default (see Root logger AppenderRefs) -->
		<Console name="STDOUT">
			<PatternLayout pattern="%d{HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
		</Console>

		<!-- Rolling file appender -->
		<RollingFile fileName="${sys:openhab.logdir}/openhab.log" filePattern="${sys:openhab.logdir}/openhab.log.%i" name="LOGFILE">
			<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
			<Policies>
				<OnStartupTriggeringPolicy/>
				<SizeBasedTriggeringPolicy size="16 MB"/>
			</Policies>
		</RollingFile>

		<!-- Event log appender -->
		<RollingRandomAccessFile fileName="${sys:openhab.logdir}/events.log" filePattern="${sys:openhab.logdir}/events.log.%i" name="EVENT">
			<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
			<Policies>
				<OnStartupTriggeringPolicy/>
				<SizeBasedTriggeringPolicy size="16 MB"/>
			</Policies>
		</RollingRandomAccessFile>

		<!-- Audit file appender -->
		<RollingRandomAccessFile fileName="${sys:openhab.logdir}/audit.log" filePattern="${sys:openhab.logdir}/audit.log.%i" name="AUDIT">
			<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
			<Policies>
				<OnStartupTriggeringPolicy/>
				<SizeBasedTriggeringPolicy size="8 MB"/>
			</Policies>
		</RollingRandomAccessFile>

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

	<Loggers>
		<!-- Root logger configuration -->
		<Root level="ERROR">
			<AppenderRef ref="LOGFILE"/>
			<AppenderRef ref="OSGI"/>
		</Root>

		<!-- Karaf Shell logger -->
		<Logger level="OFF" name="org.apache.karaf.shell.support">
			<AppenderRef ref="STDOUT"/>
		</Logger>

		<!-- Security audit logger -->
		<Logger additivity="false" level="INFO" name="org.apache.karaf.jaas.modules.audit">
			<AppenderRef ref="AUDIT"/>
		</Logger>

		<!-- openHAB specific logger configuration -->

		<Logger level="DEBUG" name="org.openhab"/>

		<Logger level="INFO" name="openhab.event.ItemStateEvent"/>
		<Logger level="ERROR" name="openhab.event.ItemAddedEvent"/>
		<Logger level="ERROR" name="openhab.event.ItemRemovedEvent"/>
		<Logger level="ERROR" name="openhab.event.ItemChannelLinkAddedEvent"/>
		<Logger level="ERROR" name="openhab.event.ItemChannelLinkRemovedEvent"/>
		<Logger level="DEBUG" name="openhab.event.ThingStatusInfoEvent"/>
		<Logger level="ERROR" name="openhab.event.ThingAddedEvent"/>
		<Logger level="ERROR" name="openhab.event.ThingUpdatedEvent"/>
		<Logger level="ERROR" name="openhab.event.ThingRemovedEvent"/>
		<Logger level="ERROR" name="openhab.event.InboxUpdatedEvent"/>
		<Logger level="ERROR" name="openhab.event.RuleStatusInfoEvent"/>
		<Logger level="ERROR" name="openhab.event.RuleAddedEvent"/>
		<Logger level="ERROR" name="openhab.event.RuleRemovedEvent"/>
		<Logger level="ERROR" name="openhab.event.StartlevelEvent"/>
		<Logger level="ERROR" name="openhab.event.AddonEvent"/>

		<Logger additivity="false" level="DEBUG" name="openhab.event">
			<AppenderRef ref="EVENT"/>
			<AppenderRef ref="OSGI"/>
		</Logger>

		<Logger level="ERROR" name="javax.jmdns"/>
		<Logger level="ERROR" name="org.jupnp"/>

		<!-- This suppresses all Maven download issues from the log when doing feature installations -->
		<!-- as we are logging errors ourselves in a nicer way anyhow. -->
		<Logger level="ERROR" name="org.ops4j.pax.url.mvn.internal.AetherBasedResolver"/>

		<!-- Filters known issues of pax-web (issue link to be added here). -->
		<!-- Can be removed once the issues are resolved in an upcoming version. -->
		<Logger level="OFF" name="org.ops4j.pax.web.pax-web-runtime"/>

		<!-- Filters known issues of lsp4j, see -->
		<!-- https://github.com/eclipse/smarthome/issues/4639 -->
		<!-- https://github.com/eclipse/smarthome/issues/4629 -->
		<!-- https://github.com/eclipse/smarthome/issues/4643 -->
		<!-- Can be removed once the issues are resolved in an upcoming version. -->
		<Logger level="OFF" name="org.eclipse.lsp4j"/>

		<!-- Filters warnings for events that could not be delivered to a disconnected client. -->
		<Logger level="ERROR" name="org.apache.cxf.jaxrs.sse.SseEventSinkImpl"/>

		<!-- Filters known issues of KarServiceImpl, see -->
		<!-- https://github.com/openhab/openhab-distro/issues/519#issuecomment-351944506 -->
		<!-- Can be removed once the issues are resolved in an upcoming version. -->
		<Logger level="ERROR" name="org.apache.karaf.kar.internal.KarServiceImpl"/>

		<!-- Filters warnings about unavailable ciphers when JCE is not installed, see -->
		<!-- https://github.com/openhab/openhab-distro/issues/999 -->
		<Logger level="ERROR" name="org.apache.karaf.shell.ssh.SshUtils"/>

		<!-- Filters known issues of javax.mail, see -->
		<!-- https://github.com/openhab/openhab-addons/issues/5530 -->
		<Logger level="ERROR" name="javax.mail"/>

		<!-- Filters disconnection warnings of the ChromeCast Java API, see -->
		<!-- https://github.com/openhab/openhab-addons/issues/3770 -->
		<Logger level="ERROR" name="su.litvak.chromecast.api.v2.Channel"/>

		<!-- Added by Karaf to prevent debug logging loops, see -->
		<!-- https://issues.apache.org/jira/browse/KARAF-5559 -->
		<Logger level="ERROR" name="org.apache.sshd"/>
		<Logger level="DEBUG" name="org.openhab.core.automation"/>
		<Logger level="DEBUG" name="openhab.event.ItemStateChangedEvent"/>
		<Logger level="DEBUG" name="org.openhab.core.thing"/>
		<Logger level="DEBUG" name="org.openhab.binding.mail"/>
	</Loggers>

</Configuration>

3b. /var/lib/openhab/etc/org.ops4j.pax.logging.cfg was emty
→ I copied one line from a backup file

Bingo 1 : openhab.log is filled again !

events.log is still on October 11, no update up to now

2 Likes

Try get the latest log4j2.xml from GutHub. That was how I fixed mine.

1 Like

I loaded log4j.xml from here
github.com log4j2.xml
restarted openHAB, event.log is still on October 11, no update up to now.

Maybe try rename or delete events.log and see if it is recreated.

Otherwise I am out of ideas.

1 Like

That’s it!
The solution is:

  1. /var/lib/openhab/etc/org.ops4j.pax.logging.cfg was emty
    → I copied the one and only line from a backup file
    ----> openhab.log is filled again !

  2. I deleted the events.log and restarted openHAB again, now all seems to be alright!
    ----> events.log is filled again !

Thank you very much Mark.

5 Likes

+1 here (openhabian 3.2.0-SNAPSHOT - Build #2570):

My org.ops4j.pax.logging.cfg was empty.

Adding
org.ops4j.pax.logging.log4j2.config.file=${karaf.etc}/log4j2.xml
and restarting the openhab service solved the problem.

In my case, deleting events.log wasn’t necessary.

@Paul_Vennhaus
Thanks for documenting the solution!

2 Likes

Thanks! I just came across this issue. You’ve just saved me a lot of time.

I’ve just had to do this on a 3.4.1 install after getting

Error executing command: Unrecognized configuration

when trying log:tail and log:display in the console.

This solution worked for me!

FYI I just had the same issue, however openHAB reverted my addition of that line to the file on restart.

However I luckily was able to fix it using the openHAB console using these commands:

config:edit org.ops4j.pax.logging
config:property-set org.ops4j.pax.logging.log4j2.config.file /var/lib/openhab/etc/log4j2.xml
config:update