...
in factory.ini but be aware the log files can be very large in this case.
Using
...
log4j
To configure log4j for the JobScheduler engine put a log4j configuration file (log4j.properties) into a directory of you 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 under the installation path of JobScheduler you should change the property class_path as follows:
Code Block |
---|
$\{SCHEDULER_HOME\}/lib/*.jar;$\{SCHEDULER_HOME\}/lib/hibernate/*.jar;$\{SCHEDULER_HOME\}/lib/jetty_ext/*.jar;<span style="color:red">$\{SCHEDULER_HOME\}/lib/log/log4j/*.jar</span>
|
The folder log4j must contain the slf4j-log4j12-x.jar, e.g. slf4j-log4j12-1.7.5.jar.
Sample configuration
Code Block |
---|
log4j.rootLogger=info, stdout, FILE
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
# Configuration File
log4j.appender.FILE=org.apache.log4j.FileAppender
log4j.appender.FILE.File=$\{java.io.tmpdir\}/log4j-test.log
log4j.appender.FILE.Append=true
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
|
Start of JobScheduler
To use the configuration above you have to start JobScheduler by setting the options property (section java) in your sos.ini, e.g.
Code Block |
---|
[java]
options = -Dlog4j.configuration=file:///path/to/log4j.properties
|
Logging to a syslog server
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 foward to use this appender.
Example
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 logbackh1. 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. filenameconfigurationFilefilename
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:
...
- logback-classic-1.0.11.jar
- logback-core-1.0.11.jar
Sample configuration
Code Block | ||
---|---|---|
| ||
<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> |
...
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 JobScheduler
To use the configuration above you have to start JobScheduler by setting the options property (sction section java) in you your sos.ini, e.g.
Code Block |
---|
[java] options = -Dlogback.configurationFile=$\{SCHEDULER_DATA\}/config/logback.xml |
Logging to a syslog server
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 details.
Conversion of the JobScheduler log levels
...
The log levels used by JobScheduler are converted as follows (highest to lowest):
...