Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added file logger example


There is also the log4j2.test.xml file where you can find examples to define the logger for each feature individually.

Example for an additional file appender

If you want to add an file appender next to the console appender, you need to add an appender and an an appender reference to the log4j2.xml file as follows:

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
        <RollingFile name="RollingFile" fileName="logs/Odysseus.log" filePattern="logs/Odysseus-%d{MM-dd-yyyy}.log"
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
            <TimeBasedTriggeringPolicy />
        <Root level="info">
            <AppenderRef ref="Console"/>
            <AppenderRef ref="RollingFile"/>
   <!--      <Logger name="" level="debug" additivity="false">
     		 <AppenderRef ref="Console"/>
    	</Logger> -->

Further Error Messages

Add the following file to you working directory of Odysseus to see further error messages.