Log4J

From no name for this wiki
Jump to: navigation, search

Log4J Stuff.

Sample log4j.xml Konfigurationsdatei

 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
 
 <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
  <appender name="fileappender" class="org.apache.log4j.FileAppender">
    <param name="File" value="C:/Users/Claude Glauser/Documents/NetBeansProjects/WebLearingPlatform/weblearning.log"/>
    <param name="Append" value="false"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%-5p %c{1} %M - %m%n"/>
    </layout>
  </appender>
 
  <appender name="console" class="org.apache.log4j.ConsoleAppender">
    <param name="Target" value="System.out"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%-5p %c{1} - %m%n"/>
    </layout>
  </appender>
 
  <logger name="customcomponent">
    <level value="INFO"/>
  </logger>
 
  <logger name="customcomponent.SimpleBoxRenderer">
    <level value="TRACE"/>
  </logger>
 
  <root>
    <priority value="INFO" />
    <appender-ref ref="fileappender" />
    <appender-ref ref="console" />
  </root>
 
 </log4j:configuration>

Logger erstellen

  private static Logger log = Logger.getLogger(SimpleBoxRenderer.class);

Resourcen