logging - How to set ERROR threshold for everything except my package -


i have configured logging via org.apache.log4j.propertyconfigurator

log4j.rootlogger=error, console log4j.logger.com.mypackage=info log4j.appender.console=org.apache.log4j.consoleappender // pattern, layout log4j.appender.console.threshold=info 

i use 3-rd party code use logging calling directly

org.apache.log4j.logger.getlogger(name).callappenders(...) 

this call skip level check , depend on appender threshold. can't increase appender threshold because logs package won't pass it. want info log level code , error 3-rd party.

you have define 2 appenders, 1 stuff , 3rd party stuff. configure 2 logger ref. appropriate appender right threshold.

something that:

<appender name="mystuff" class="org.apache.log4j.dailyrollingfileappender">     <param name="file" value="../logs/mystuff.log" />     <param name="datepattern" value="yyyy-mm-dd" />     <layout class="org.apache.log4j.patternlayout">         <param name="conversionpattern" value="%d{dd-mm-yyyy kk:mm:ss.sss} %-5p %c %x - %m%n" />      </layout> </appender>  <appender name="thridpartystuff" class="org.apache.log4j.dailyrollingfileappender">     <param name="file" value="../logs/thirdparty.log" />     <param name="datepattern" value="yyyy-mm-dd" />     <layout class="org.apache.log4j.patternlayout">         <param name="conversionpattern" value="%d{dd-mm-yyyy kk:mm:ss.sss} %-5p %c %x - %m%n" />      </layout> </appender>  <logger name="com.mystuf" additivity="true">     <level value="info" />     <appender-ref ref="mystuff" /> </logger>  <logger name="com.third.party.package">     <level value="error" />     <appender-ref ref="thridpartystuff" /> </logger> 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -