14 Mart 2023 Salı

Log4j2 log4j2.xml ConsoleAppender Tanımlama - Console Tag

Giriş
Açıklaması şöyle
Log4j2 supports a number of System Properties that can be used to configure various items. For example, the log4j2.skipJansi system property can be used to configure if the ConsoleAppender will try to use a Jansi output stream on Windows.
Açıklaması şöyle
writes the data to System.out or System.err with the default begin the first one (a Java best practice when logging in containers)
Örnek
Şöyle yaparız
<Appenders>
  <Console name="Console" target="SYSTEM_OUT">
    <PatternLayout pattern="%d{HH:mm:ss.SSS} - %m %n"/>
  </Console>
</Appenders>
Örnek
Şöyle yaparız. Burada target System.out ama aslında normalde belirtmeye gerek yok. Varsayılan zaten bu
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" monitorInterval="30" shutdownHook="disable">
   <Appenders>
      <Console name="Console" target="SYSTEM_OUT">
         <PatternLayout pattern="%-5p|%d{ISO8601}{GMT}|%X{token}|%c{1}|%m%ex%n" />
      </Console>
   </Appenders>
   ...
</Configuration>

Hiç yorum yok:

Yorum Gönder