logback in spring-OSGI with pax-runner
We are running OSGI bundles with pax-runner. We are logging using logback over slf4j.
The problem is logback tries to look for logback.xml in classpath, but in pax-runner where should I place logback.xml so that pax-runner configure logback accordingly?
I have tried with JoranConfigurator to load logback.xml which is include开发者_JAVA百科d in bundle classpath, but it assumes classpath as the container in which the bundle is running (in my case it is runner folder where all the bundle jars are placed).
Any help would be appreciated.
Thanks in advace.
The usual approach would be to create a fragment bundle that is attached to the logback bundle and put logback.xml in there. Fragment bundles "extend" other bundles, so their contents are available to the classloader of the host bundle. This way, logback can find logback.xml in the classpath.
Another solution would be to configure logback to read the configuration file from outside the classpath.
This can be done by setting VM options -Dlogback.configurationFile=/dir/conf/logback.xml
精彩评论