Categories

Versions

You are viewing the RapidMiner Server documentation for version 9.7 -Check here for latest version

Custom logging

If the default logging behaviour is not sufficient, you might want to alter the logging configuration and provide custom log appenders. This guide will give you an overview on how to customize the log appenders for different components.

Job Agent

The RapidMiner Job Agent useslogbackas its logging framework. The following XML file describes the default configuration:

<?xml version = " 1.0 " encoding = " utf - 8 " ?> < configuration>     ${LOG_PATH}/agent.log  ${LOG_PATH}/agent.log.%d{yyyy-MM-dd}   ${FILE_LOG_PATTERN}       

By default two appenders will be used: TheCONSOLEand theAGENTLOGFILE. TheCONSOLEappender is responsible for logging to shell, whereas theAGENTLOGFILEappender will create a rolling log file on disk.

Custom appender

To register a custom log appender, you need to configure the XML, save it as a file (logback.xml), preferably in thehome/configfolder of the Job Agent, and register the location in thehome/config/agent.propertiesfile, as indicated below:

logging.config = ${jobagent.baseDir}/home/config/logback.xml

The documentation about different log appenders can be found in thelogback documentation.

Example: SMTP appender

Some appenders require third-party libraries. Before adding an appender check thedependency listand add the required libraries to thelibs/folder of the Job Agent. In this case the SMTP appender requires theJava邮件API 1。6.0and theJavaBeans Activation Framework 1.1library.

The SMTP appender will collect logging events and sends the content via email. By default, the appender is triggered by the logging precedenceERRORand above. The detailed documentation about this appender can be found in thelogback documentation. The following configuration adds anEMAILappender to the default logging configuration:

<?xml version = " 1.0 " encoding = " utf - 8 " ?> < configuration>     $SMTP_HOST $SMTP_PORT true $USERNAME $PASSWORD $MAIL_TO $MAILFROM Error: %logger{20} - %m  %date %-5level %logger{35} - %message%n    ${LOG_PATH}/agent.log  ${LOG_PATH}/agent.log.%d{yyyy-MM-dd}   ${FILE_LOG_PATTERN}        

Please make sure to replace the following properties before actually using this appender:

  • $SMTP_HOST: the hostname of your SMTP server, e.g.mail.your-organization.com
  • $SMTP_PORT: the port of your SMTP server, e.g.465
  • $USERNAME: the username of the account which is responsible for sending the mails
  • $PASSWORD: the corresponding password
  • $MAIL_TO: the mail address which should receive the log events
  • $MAIL_FROM: the mail address of the sender

Job Container

The RapidMiner Job Container useslogbackas its logging framework. The following XML file describes the default configuration:

<?xml version = " 1.0 " encoding = " utf - 8 " ?> < configuration>    ${LOG_FILE}  ${LOG_FILE}.%d{yyyy-MM-dd}   ${FILE_LOG_PATTERN}         

By default two appenders will be used: TheCONSOLEand theCONTAINERLOGFILE. TheCONSOLEappender is responsible for logging to shell, whereas theCONTAINERLOGFILEappender will create a rolling log file on disk.

Custom appender

To register a custom log appender, you need to configure the XML, save it as a file (logback-jobcontainer.xml), preferably in thehome/configfolder of the Job Agent. Afterwards you need to instruct the Job Agent to forward this configuration to all spawned Job Containers. Register the logback configuration file location in thehome/config/agent.propertiesfile, as indicated below:

jobagent.container.jvmCustomProperties = Dlogging.config=${jobagent.baseDir}/home/config/logback-jobcontainer.xml

The documentation about different log appenders can be found in thelogback documentation.