java - Disable custom logger print in console (Log4j2) -
can dsable log print customm creating logger?
i have 2 loggers:
root logger
metrics logger (which prints file)
<appenders> <file name="file" filename="app.log"> <patternlayout> <pattern>%d %p %c{1.} [%t] %m %ex%n</pattern> </patternlayout> </file> <console name="stdout" target="system_out"> <patternlayout pattern="%d{yyyy-mm-dd hh:mm:ss.sss} [%t] %-5level %logger{36} - %msg%n"/> </console> </appenders> <loggers> <logger name="metrics" level="info" additivity="true"> <appenderref ref="file"/> </logger> <root level="info"> <appenderref ref="stdout"/> </root> </loggers>
i want disable print messages in console file logger
the key understanding here [http://logging.apache.org/log4j/2.x/manual/configuration.html#additivity][1]
the root logger parent of logger "metrics". log event of "metrics" passed root logger's appender ("stdout"). known additivity. possible disable setting additivity attribute on logger "metrics" false.
<logger name="metrics" level="info" additivity="false"> <appenderref ref="file"/> </logger>
Comments
Post a Comment