Wednesday, 13 April 2016

XML : how to use in log4j - both xml and properties file?

how to convert log4j. I want to use this xml configuration file, but usually log4j config it of another protocol:

xml:

  <configuration>      <appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender">      <!-- in the absence of the class attribute, it is assumed that the           desired discriminator type is           ch.qos.logback.classic.sift.MDCBasedDiscriminator -->      <discriminator>        <key>userid</key>        <defaultValue>unknown</defaultValue>      </discriminator>      <sift>        <appender name="FILE-${userid}" class="ch.qos.logback.core.FileAppender">          <file>${userid}.log</file>          <append>false</append>          <layout class="ch.qos.logback.classic.PatternLayout">            <pattern>%d [%thread] %level %mdc %logger{35} - %msg%n</pattern>          </layout>        </appender>      </sift>    </appender>      <root level="DEBUG">      <appender-ref ref="SIFT" />    </root>  </configuration>    

usual configuration format:

  # System.out.println appender for all classes  log4j.appender.default.out=org.apache.log4j.ConsoleAppender  log4j.appender.default.out.threshold=DEBUG  log4j.appender.default.out.layout=org.apache.log4j.PatternLayout  log4j.appender.default.out.layout.ConversionPattern=%-5p %c: %m%n    

how can i interleave the xml and the regular properties files?

No comments:

Post a Comment