Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To configure log4j for the JobScheduler Engine add a log4j configuration file (log4j.properties) to a directory of your choice and reference it by setting the java system property log4j.configuration, e.g. -Dlog4j.configuratioh1. file:///path/to/log4j.properties

Installation

Create the folder ./lib/log/log4j in the installation path of JobScheduler you should modify the property class_path as follows:

Code Block
 class_path = ${SCHEDULER_HOME}/lib/*.jar:${SCHEDULER_HOME}/lib/hibernate/*.jar:${SCHEDULER_HOME}/lib/jetty_ext/*.jar:${SCHEDULER_HOME}/lib/log/log4j/*.jar</span>jar

The folder log4j has to contain the slf4j-log4j12-x.jar file, e.g. slf4j-log4j12-1.7.5.jar.
Make sure that log4j-1.2.16.jar is located in the ./lib directory.

...

To use the configuration above you have to start JobScheduler by setting the options property (section [java]) in your :7config./config/factory.ini, e.g.

Code Block
 [java]
 options = -Dlog4j.configuration=file:///path/to/log4j.properties

...

Code Block
log4j.rootLogger=info, SYSLOG
log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG.syslogHost=localhost
log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout
log4j.appender.SYSLOG.layout.conversionPattern=%5p [%t] (%F:%L) - %m%n

Using logback: . To configure logback for the JobScheduler Engine put a logback configuration file into a directory of your choice and reference it by setting the java system property logback.configurationFile, e.g. -Dlogback.configurationFilefilename

...

Code Block
languagehtml/xml
<configuration>

   <appender name="STDERR" class="ch.qos.logback.core.ConsoleAppender">
       <encoder>
           <pattern>%d\{dd HH:mm:ss\} [%thread] %-5level %logger - %msg%n</pattern>
       </encoder>
   </appender>
   
   <appender name="FILE" class="ch.qos.logback.core.FileAppender">
       <file>$\{user.dir\}/logs/logback-test.log</file>
       <append>true</append>
       <encoder>
           <pattern>%d\{dd HH:mm:ss\} [%thread] %-5level %logger - %msg%n</pattern>
       </encoder>
   </appender>

   <root level="WARN">
       <appender-ref ref="STDERR" />
   </root>
   
   <logger name="JobScheduler" level="TRACE" additivity="false">
       <appender-ref ref="FILE" />
   </logger>
   
</configuration>

...