<div dir="ltr">Hello,<br><br>I am wondering how I can setup SLF4J's Log4J backend to
use specific appenders in an OSGi/Spring environment. I have one bundle
that adds an appender when it is started:<br><br>import org.apache.log4j.Appender;<br>
import org.apache.log4j.Logger;<br>...<br>Logger logger = Logger.getRootLogger();<br>log.addAppender(myAppender);<br><br>Now I obtain a logger from a different bundle, which is done as follows:<br><br>import org.slf4j.Logger;<br>
import org.slf4j.LoggerFactory;<br>...<br>Logger logger = LoggerFactory.getLogger(<div dir="ltr">getClass().getName());<br>
<br>Issuing log messages to "logger" will not appear in the appender I specified in the first bundle. How can I fix this?<br><br>I am using these dependencies in Maven for both bundles:<br>
<groupId>org.slf4j</groupId><br>
<artifactId>com.springsource.slf4j.api</artifactId><br>
<version>1.5.6</version><br>
<br>
<groupId>org.slf4j</groupId><br>
<artifactId>com.springsource.slf4j.log4j</artifactId><br>
<version>1.5.6</version><br><br>Any help would be greatly appreciated!<br><br>Samad</div></div>