[logback-user] Logback configuration in Virgo OSGi container

mvwinsen mvwinsen at gmail.com
Tue May 31 21:22:16 CEST 2011


i'm trying to get logback logging working in my Virgo OSGi container.
Doing this i'm having some difficulties logging to the rootLogger.

Virgo is delivered with a serviceability.xml (which is a renamed logback.xml
I want to have 'one' logconfiguration (preferabably the serviceability.xml)
used by all bundles inside the container. Therefore i've set the VM arg
-Dlogback.configurationFile=./config/serviceability.xml. So that the default
log configuration is read from that file. When i start the container i see
that the logging configuration is setted by default to the
./config/serviceablity.xml (i can see this because i've set the debug to
true in the configuration tag of the xml file).
In that configuration i've set the root level to info (see file below):

<configuration debug="true" scan="true">
 <appender name="GENERAL"

      <pattern>%-5p %d{ISO8601} [%18.18t] %50.50c : %m%n</pattern>

	<root level="INFO">
		<appender-ref ref="GENERAL" />		

The problem that i'm facing it that when i ask log4j-over-slf4j  to get a
logger via the code, then the bundle is falling back to the default
configuration of logback (not the one set via the VM args, and therefore is
logging console of my Eclipse environment. And nothing to the log file.

org.apache.log4j.Logger log;
log = Logger.getLogger("logger1");

The strange thing is that when i add the above descibed logback.xml
configuration to the bundle where i'm trying to log
(src/main/resources/logback.xml), then the root logger is linked to the
logfile and de log line is outputted to the file.

Does anyone has an idea what i'm doing wrong?
My goal is to set the logconfigation once as VM arg and just call the
Logger.GetLogger('id') of any bundle in the container and log the line to
the root logger which is descibed in the logconfiguration.

Thanks in advance,


View this message in context: http://old.nabble.com/Logback-configuration-in-Virgo-OSGi-container-tp31743236p31743236.html
Sent from the Logback User mailing list archive at Nabble.com.

More information about the Logback-user mailing list