java - log4j - show logs both in file and console -
i have 2 appenders, 1 file , console. want eclipse console show both file , console logs, in same time file show own logs. how do that?
here conf.
<appender name="file" class="org.apache.log4j.dailyrollingfileappender"> <errorhandler class="org.jboss.logging.util.onlyonceerrorhandler"/> <param name="append" value="true"/> <param name="threshold" value="info"/> <param name="file" value="${jboss.server.log.dir}/file.log"/> <layout class="org.apache.log4j.patternlayout"> <param name="conversionpattern" value="%d %-5p %m%n"/> </layout>
<appender name="console" class="org.apache.log4j.consoleappender"> <errorhandler class="org.jboss.logging.util.onlyonceerrorhandler"/> <param name="target" value="system.out"/> <param name="threshold" value="info"/> <layout class="org.apache.log4j.patternlayout"> <param name="conversionpattern" value="%d %-5p [%c{1}] %m%n"/> </layout>
also, file log showing logs specific package.
<category name="com.project.example" additivity="false"> <appender-ref ref="file"/> <priority value="info"/> </category>
and root:
<root> <priority value="${jboss.server.log.threshold}"/> <appender-ref ref="console"/> <appender-ref ref="file"/> </root>
you have configure appender
in logger
tag below.
<logger name="com.project.example"> <appender-ref ref="file" /> <appender-ref ref="console" /> </logger> <root> <level value="debug" /> <appender-ref ref="console" /> </root>
Comments
Post a Comment