You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

under construction .... (referenced JobScheduler version v1.5.3100-beta is currently not released)

Overview

Since version v1.5.3100-beta of the JobScheduler engine it is possible to configure a logging api of your choice to handle the log messages from JobScheduler (assumed the logging api is supported by slf4j). Using this feature you have a wide range of possibilities to handle your logs, e.g. filtering, mailing, eventing etc.

JobScheduler was currently shipped with the noop-api for slf4j. That means that no messages from JobScheduler logged via a logging api. But beside the configuration of a logging API such logback or log4j the logging in the "old style" is supported until further notice.

Installation in general

If you take a look into factory.ini you will find a property like class_path in the java section:

 class_path = $\{SCHEDULER_HOME\}/lib/log/noop/*.jar;$\{SCHEDULER_HOME\}/lib/*.jar...

This is the place where you can subtitute the noop api with a real logging api like logback.

Put the necessary libraries for the logging api of your choice into a separate folder and point to the jars of this folder in factory.ini instead to ${SCHEDULER_HOME}/lib/log/noop/*.jar.

Relationship between the configuration for the logging api and factory.ini

The setting of the property log_level in the factory.ini filters the messages that will be available for slf4j. That means, that the level you set in the factory.ini should never be higher than the level you have specified in the logger JobScheduler. If you want a full control of all log messages from JobScheduler you should specify

 log_level = debug9

in factory.ini but be aware the log files can be very large in this case.

Using logback

To configure logback for the JobScheduler engine put a logback configuration file into a directory of you choice and reference it by setting the java system property logback.configurationFile, e.g. -Dlogback.configurationFilh1. etc/logback.xml.

Installation

As described above you have to create a separate folder containing the necessary jar files to use logback. Assuming your are creating the folder lib/log/logback under the installation path of JobScheduler you should change the property class_path as follows:

 $\{SCHEDULER_HOME\}/lib/log/logback/*.jar;$\{SCHEDULER_HOME\}/lib/*.jar;$\{SCHEDULER_HOME\}/lib/hibernate/*.jar;$\{SCHEDULER_HOME\}/lib/jetty_ext/*.jar

The folder logback must contain at least logback-core and logback-classic, e.g.

  • logback-classic-1.0.11.jar
  • logback-core-1.0.11.jar

Sample configuration

<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>false</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>

The logger JobScheduler controls the output of the JobScheduler engine.

Please note that the file element of a FileAppender can not contain a relative path (see do not use relative path with logback for details). Start of JobSchedulerh1. To use the configuration above you have to start JobScheduler as by setting java-options, e.g.

 jobscheduler.cmd start -java-options=-Dlogback.configurationFile=C:/ProgramData/sos-berlin.com/jobscheduler/scheduler.4040/config/logback.xml

Currently it is necessary to specify the configuration file with an absolute path, JobScheduler will not substitute environment variables like ${SCHEDULER_DATA}. Conversion of the JobScheduler log levelsh1. The log levels used by JobScheduler are converted as follows (highest to lowest):
\ style"background-color:#ffffcc;" cellpaddinh1. "20" cellspacing"0" bordeh1. "1"

width"15%" aligh1. "left"

JobScheduler log levels

width"15%" align="left"

slf4j log level

-

error

error

-

warn

warn

-

info

info

-

debug, debug1, debug2

debug

-

debug3 and higher

trace

-

  • No labels