java ee - slf4j,change logger or add appender at runtime -


i'm using slf4j logging (with log4j). used appender configured using xml.

<appender name="business" class="org.apache.log4j.rollingfileappender">     <param name="maxfilesize" value="10mb" />     <param name="maxbackupindex" value="10" />     <param name="file" value="${jboss.server.log.dir}/business.log" />     <layout class="org.apache.log4j.patternlayout">         <param name="conversionpattern" value="%d %p [%t] %c - %m%n" />     </layout> </appender> <category name="businesslogger" additivity="false">     <level value="info" />     <appender-ref ref="business" /> </category> 

the log process called in interceptor. now, i'm trying test output of log. call logger @ runtime using:

private static final logger business_logger = loggerfactory.getlogger("businesslogger"); 

in order test log (using junit), output of log needs saved somewhere variable. have idea creating custom appender saves last log variable, can't seem add appender or change appender because logger class in slf4j interface. maybe know workaround this?

this may seem simple found when encountered error had forgotten place binder package in pom application.

  <dependency>       <groupid>org.slf4j</groupid>       <artifactid>slf4j-log4j12</artifactid>       <version>1.7.7</version>   </dependency> 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -