Date: Fri, 29 Mar 2024 06:05:34 +0000 (UTC) Message-ID: <1652802888.12449.1711692334111@change.sos-berlin.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_12448_2079243303.1711692334111" ------=_Part_12448_2079243303.1711692334111 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Since version v1.5.3100-beta of the JobScheduler Engine it is p= ossible to configure a logging API of your choice to handle the log message= s from JobScheduler (assumed the logging API is supported by slf4j). Us= ing 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 nop-api for slf4j. = That means that no messages from JobScheduler logged via a logging api.
But beside the configuration of a logging API such as logback or log4j t= he logging in the "old style" is supported until further notice. That means= that you will always find the scheduler logs and the logs of your jobs in = the folder logs located of your JobScheduler installation.
Have a look at factory.ini to will find a property like
class_p= ath =3D ${SCHEDULER_HOME}/lib/*.jar:${SCHEDULER_HOME}/lib/hibernate/*.jar:$= {SCHEDULER_HOME}/lib/jetty_ext/*.jar:${SCHEDULER_HOME}/lib/log/nop/*.jar
This is the place where you can subtitute the nop api with a re= al logging api like logback.
Put the necessary libraries for the logging api of your choice into a se= parate folder and point to the jars of this folder in factory.ini = instead to ${SCHEDULER_HOME}/lib/log/nop/*.jar.
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 t= he level you have specified in the logger JobScheduler. If you want full co= ntrol of all log messages from JobScheduler then you should specify
log_lev= el =3D debug9
in factory.ini but be aware the log files can be very l= arge in this case.
The setting of the property log in the factory.ini&nbs= p;file causes the Job Scheduler to write a detailed protocol. This protocol= is intended for use in problem diagnosis. The file name should be spe= cified here as a full path. A plus character + written directly b= efore the file name causes an already existing protocol to be continued.&nb= sp;Otherwise such a protocol will be overwritten.
Examples:
log =3D= ${SCHEDULER_DATA}/logs/scheduler.log log =3D file_name scheduler.log file name log =3D +${SCHEDULER_DATA}/logs/scheduler.log # Continue existing prot= ocol
To configure log4j for the JobScheduler En= gine add a log4j configuration file (log4j.properties) to a directory of yo= ur choice and reference it by setting the java system property log4j.co= nfiguration, e.g. -Dlog4j.configuration=3Dfile:= ///path/to/log4j.properties.
Starting with Release 1.13.3 JobScheduler uses log4j2 with xml configura= tion. As log4j2 has changed the name of the Java option the complete Java o= ption should look like this:
-Dlog4j.configurationFile=3Dfile://[PATH_TO_FILE]/log4j2.xml
Create the folder ./lib/log/log4j in the installation path of J= obScheduler you should modify the property class_path as follows:<= /p>
class_p= ath =3D ${SCHEDULER_HOME}/lib/*.jar:${SCHEDULER_HOME}/lib/hibernate/*.jar:$= {SCHEDULER_HOME}/lib/jetty_ext/*.jar:${SCHEDULER_HOME}/lib/log/log4j/*.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.
Starting with Release 1.13.3
The folder ./lib/log/log4j comes with the log4j-slf4j-imp=
l-2.13.0.jar
.
The log4j-api-2.13.0.jar
and log4j-core-2.13.0=
.jar
is provided in the ./lib/3rdParty directory=
.
log4j.ro= otLogger=3Dinfo, stdout, FILE log4j.appender.stdout=3Dorg.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=3Dorg.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=3D%5p [%t] (%F:%L) - %m%n # Configuration File log4j.appender.FILE=3Dorg.apache.log4j.FileAppender log4j.appender.FILE.File=3D$\{java.io.tmpdir\}/log4j-test.log log4j.appender.FILE.Append=3Dtrue log4j.appender.FILE.layout=3Dorg.apache.log4j.PatternLayout log4j.appender.FILE.layout.ConversionPattern=3D%5p [%t] (%F:%L) - %m%n
Starting with Release 1.13.3 the configuration looks like this
<?xml= version=3D"1.0" encoding=3D"UTF-8"?> <Configuration> =09<Appenders> <Console name=3D"stdout" target=3D"SYSTEM_OUT"> =09=09=09<PatternLayout pattern=3D"[%5p] (%F:%L) - %m%n"/> =09=09</Console> <!-- Example Rolling File Appender --> <RollingFile name=3D"ExampleAppender" fileName=3D"${env:SCHEDULE= R_DATA}/logs/example.log"=20 =09=09 createOnDemand=3D"true" filePattern=3D"${env:SCHEDULER_DATA}/logs/= example-%d{yyyy-MM}-%i.log.gz"> <PatternLayout pattern=3D"%d{ISO8601} %c [%-5p] - %m%n" char= set=3D"UTF-8"/> <Policies> <TimeBasedTriggeringPolicy/> <SizeBasedTriggeringPolicy size=3D"20MB"/> </Policies> <DefaultRolloverStrategy fileIndex=3D"10"/> </RollingFile> </Appenders> =09<Loggers> =09=09<Root level=3D"error"> <AppenderRef ref=3D"stdout"/> <AppenderRef ref=3D"ExampleAppender"/> =09=09</Root> <Logger name=3D"joe" level=3D"info" additivity=3D"false" > <AppenderRef ref=3D"ExampleAppender"/> </Logger> </Loggers> </Configuration>
To use the configuration above you have to start JobScheduler by setting= the options property (section [java]) in your ./config/factory.ini, e.g.
[java] options =3D -Dlog4j.configuration=3Dfile://path/to/log4j.properties
Starting with Release 1.13.3
[java] options =3D -Dlog4j.configurationFile=3Dfile://path/to/log4j2.xml
Log4j offers a SyslogAppender to send log entries to a syslog receiver. = This Appender is not explicitely tested by us but it seems to be straight f= oward to use this appender.
Example
log4j.ro= otLogger=3Dinfo, SYSLOG log4j.appender.SYSLOG=3Dorg.apache.log4j.net.SyslogAppender log4j.appender.SYSLOG.syslogHost=3Dlocalhost log4j.appender.SYSLOG.layout=3Dorg.apache.log4j.PatternLayout log4j.appender.SYSLOG.layout.conversionPattern=3D%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
As described above you have to create a separate folder containing the r= equired jar files to use logback. Assuming your are creating the folder lib/log/logback in the installation path of JobScheduler then you sho= uld modify the property class_path as follows:
class_p= ath =3D ${SCHEDULER_HOME}/lib/*.jar:${SCHEDULER_HOME}/lib/hibernate/*.jar:$= {SCHEDULER_HOME}/lib/jetty_ext/*.jar:${SCHEDULER_HOME}/lib/log/logback/*.ja= r
The folder logback has to contain at least logback-core and log= back-classic, e.g.
logback-classic-1.0.11.jar
logback-core-1.0.11.jar
<= ;configuration> <appender name=3D"STDERR" class=3D"ch.qos.logback.core.ConsoleAppende= r"> <encoder> <pattern>%d{dd HH:mm:ss} [%thread] %-5level %logger - %msg= %n</pattern> </encoder> </appender> =20 <appender name=3D"FILE" class=3D"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=3D"WARN"> <appender-ref ref=3D"STDERR" /> </root> =20 <logger name=3D"JobScheduler" level=3D"TRACE" additivity=3D"false">= ; <appender-ref ref=3D"FILE" /> </logger> =20 </configuration>
The logger JobScheduler controls the output of the Main Log File (see Logs in the JobScheduler document= ation for details).
Please note that the file element of a FileAppender can not contain a re= lative path (see do = not use relative path with logback for details).
To use the configuration above you have to start JobScheduler by setting= the options property (section [java]) in your ./config/factory.ini, e.g.
[java] options =3D -Dlogback.configurationFile=3D${SCHEDULER_DATA}/config/logback= .xml
Logback offers a SyslogAppender to send log entries to a syslog receiver= . This Appender is not explicitely tested by us but it seems to be straight= foward to use this appender.
See Appenders in the logback manual for detail= s.
The log levels used by JobScheduler are mapped as follows (highest to lo= west):
JobScheduler log levels <= /td> | slf4j log level |
|
|
|
|
|
|
|
|
|
|