Can karaf see log from library which binding bundle use

openhab2
logging
binding
Tags: #<Tag:0x00007f014882ece0> #<Tag:0x00007f014882eb78> #<Tag:0x00007f014882e9e8>

(laohixdxm2016) #1

Say orvibo binding, which use s20-sdk-0.0.6-SNAPSHOT.jar as library.

in karaf,
$log:set DEBUG org.openhab.binding.orvibo

I notice I can see log from orvibo binding, but can NOT see log from s20-sdk-0.0.6-SNAPSHOT.jar library.
I also notice orvibo binding is karaf bundle while the library is NOT.

Is it possible to see log from s20-sdk-0.0.6-SNAPSHOT.jar library which the binding use?

Thank you very much.


(Rich Koshak) #2

http://docs.openhab.org/administration/logging.html

assuming this library uses log4j, which I give a 50/50 chance, then you can add a new appender and lover to the config and activate the logs.

if not…


(laohixdxm2016) #3

Thank you very much, boss.
Will give a try. I appreciate your message.


(laohixdxm2016) #4

I found it it NOT log4j but slf4j.
import org.slf4j.Logger;

By openhab log page, only log4j is mentioned.
http://docs.openhab.org/administration/logging.html#file-system

Do you have some idea whether slf4j is supported by karaf as well?
Thank you.


However,
1 in orvibo binding,
import org.slf4j.Logger;
2 in config,
log4j.logger.org.openhab.binding.orvibo = DEBUG
3 I do see orvibo binding debug log on karaf console.

I don’t understand what is happening here.
Does that mean slf4j & log4j actually one thing? Thank you.


(Rich Koshak) #5

I seriously doubt it. You might be able to create a .properties file or .xml file and put it somewhere that slf4j will know to look to configure it. If not I’m afraid you are likely out of luck.


(laohixdxm2016) #6

Thus, if you have bundles that import any of the the usual logging API packages (SLF4J, LOG4J, java.util.logging), you can use pax-logging to collect all the messages from all of them and manage them together.

https://ops4j1.jira.com/wiki/spaces/ops4j/pages/73662475/Using+pax+logging

By link, slj4j is supported by osgi.
Does that mean slf4j configuration can be put into org.ops4j.pax.logging.cfg?


(Rich Koshak) #7

I would assume so. We are well outside my expertise at this point.