java - Disable custom logger print in console (Log4j2) -


can dsable log print customm creating logger?

i have 2 loggers:

  1. root logger

  2. 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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -