Most Popular
Recently Added
Recently Updated

Sending errors over email

SymmetricDS uses the Log4j logging system to write information to the symmetric.log file in the "logs" folder. Log messages have a level of TRACE, DEBUG, INFO, WARN, ERROR, or FATAL. The lower levels include detailed information for following the program execution while the higher levels include only errors. The logging can be configured to email any entries by level, so you can receive an email whenever SymmetricDS encounters an error.

Configuring SMTPAppender

Edit the "conf/log4j.xml" and find the section at the top where "appenders" are configured. Either uncomment or add the SMTPAppender as shown below:

    <appender name="EMAIL" class="org.apache.log4j.net.SMTPAppender">
        <param name="SMTPHost" value="mymailhost" />
        <param name="SMTPUsername" value="" />
        <param name="SMTPPassword" value="" />
        <param name="From" value="user@nowhere" />
        <param name="To" value="user@nowhere" />
        <param name="Subject" value="Error from SymmetricDS" />
        <param name="BufferSize" value="10" />
        <param name="LocationInfo" value="true" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%t %m%n"/>
        </layout>
        <filter class="org.apache.log4j.varia.LevelRangeFilter">
            <param name="LevelMin" value="error" />
            <param name="LevelMax" value="fatal" />
        </filter>
    </appender>

You'll want to make sure you set the appropriate value for the following fields that work for your environment:

  • SMTPHost - the hostname for a mail server that can deliver email
  • SMTPUsername - specify a user login if the mail server requires it, or leave it blank
  • SMTPPassword - specify a user password if the mail server requires it, or leave it blank
  • From - the email address for the "From:" line
  • To - the email address where you want to receive the error logs

Also find the section with the "root" logger, and either uncomment or add a reference to the "EMAIL" appender, like this:

    <root>
        <priority value="INFO" />
        <appender-ref ref="ROLLING" />
        <appender-ref ref="CONSOLE" />
        <appender-ref ref="BUFFERED" />
        <appender-ref ref="EMAIL" />
    </root>

Properties ID: 000025   Views: 1908   Updated: 3 years ago
Filed under: