KB Article #195480
ADVANCED ROUTING: Enabling detail logging for email notifications (5.5-20230928 and later)
Problem
Administrators need an audit trail in the Server Log of Advanced Routing email notifications sent on route failure, success and triggering. The trail should include sender, recipients, subject, route, user and file names.
In SecureTransport 5.4 this information was logged by the org.apache.camel.component.mail.MailProducer class. In SecureTransport 5.5 that class is no longer used. Before the September 2023 Update, only a short message was logged, for example:
AR0049: [account] [route] Notification email for route execution failure was sent successfully to "'user@domain.com' (evaluated to 'user@domain.com')" using template "Template.xhtml".
Applies to SecureTransport 5.5-20230928 (September 2023 Update) and later. The fix is RDST-56025: "Fixed an issue with Advanced Routing email notifications not being displayed in the Server Log." See the release notes.
Resolution
Prerequisites
Configure SMTP in Administration Tool > Setup > Miscellaneous > SMTP Configuration (notify email, mail relay and SMTP port). See Admin Guide - Manage Routes.
The administrator must have access to Mail Templates, which is granted through the administrative role settings. Without it, the notification options are disabled.
Configure the route notifications:
- Enable Notify following e-mails on route failure, on route success and/or on route trigger.
- Select a Mail Template for each.
- Enter the recipients as an address, a list of addresses or an EL expression (for example
${account.email}). - In the New UI, template-level notifications are set in Routes > Route Templates > Notifications. These are combined with any route-level notifications. See Admin Guide - Create and manage route templates.
Enable the DEBUG logger
Make a backup copy of $FILEDRIVEHOME/conf/tm-log4j.xml before editing it!
The EmailNotificationProducer class is not configured by default, so you must add a new logger. Place it at the bottom of the file, right above the last two closing tags, </Loggers> and </Configuration>:
<!-- Advanced Routing email notification debug logger -->
<Logger name="com.axway.st.server.route.core.component.emailnotification.EmailNotificationProducer" level="DEBUG" additivity="false">
<AppenderRef ref="ServerLog"/>
</Logger>If an existing logger for org.apache.camel.component.mail.MailProducer was carried over from 5.4, replace its name with the class above and keep the rest of the configuration.
Changes to tm-log4j.xml normally take effect automatically within a couple of minutes. If no new entries appear, restart the TM service.
Expected output
Advanced routing: Sending email from = [FROM], to = [TO], subject = [SUBJECT], route name = [ROUTE_NAME], user = [USER], file(s) = [FILES].
The entry is logged for route failure, success and trigger notifications. You can view it in Admin UI > Operations > Server Log.
Optional: write to a flat file (tm-email.log)
To also write the entries to tm-email.log, add <AppenderRef ref="EmailLog"/> to the same logger. The EmailLog appender must be defined in the file. You can keep ServerLog as well to log to both destinations.
IMPORTANT! DEBUG logging increases the size of the database and log files. Consider redirecting Log4j output to files. Compare log volume with and without DEBUG, and review the log retention settings. See also KB 182269.
Related
- Velocity troubleshooting:
com.tumbleweed.st.server.util.mailer,javax.mailandorg.apache.commons.mailloggers, used for SMTP-level debugging. - Enable debug logging with Advanced Routing