How to see outputs to stderr in OH2 / karaf?

Hi,

how can I see the ouput to stderr in OH2 (want to debug a 3rd-party library which logs to stderr)?
With the default setup it seems that stderr is not redirected to the openhab.log, neither can I find any other log file where it might be.

I also tried to adjust the console appender in org.ops4j.pax.logging.cfg, without success:

log4j.rootLogger = WARN, out, stdout, osgi:*

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.Threshold=DEBUG
log4j.appender.stdout.file=${openhab.logdir}/stdout.log
log4j.appender.stdout.append=true
log4j.appender.stdout.maxFileSize=10MB
log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n

Any advise?

Both stdout and stderr goes to shell console (when running it). Console appender in configuration is responsible just for printing out log events there, not for receiving it from there. When running service wrapper logs should end up in ‘wrapper.log’

Hi,
thanks for the explanation! OH2 is installed on my system via apt-get and I start it using sudo /etc/init.d/openhab2 start. I can ssh into the console using ssh openhab@localhost -p 8101, but nothing is displayed here. Also, I don’t seem to have a file called “wrapper.log” on my system. Do I need to enable something?

By the way, it seems that some exepected syserr logs are written to /var/log/syslog.

Wrapper would occur in case of running OH2 as windows service. Please try adding KARAF_REDIRECT=out.txt to setenv and run again.

I don’t know about upstart or init.d but with systemv stuff that goes to stdout and stderr end up in /var/syslog. Or you can see the last few lines with systemctl status openhab2 or using journald.