Diag/api-logs

From Scalix Wiki
Jump to: navigation, search

Web App Activity Logging

Introduction

Activity logging with in the web apps provides a picture of the operations which are taking place on the server.  This is a different function than error logging which provides information only when unexpected events occur.  Typical activities audited are login / logout events, message retrieval, database operations, and IMAP and SMTP operations.  Activity logs tend to grow quickly, so adequate space should be available on the disk for the log, and any log backups.  Maximum log sizes may be customized per webapp in the log4j.properties file for each.

SWA

To enable activity logging for SWA edit the log4j.properties file. In <= 11.0.3, this file is located at /var/opt/scalix/instance/tomcat/webapps/webmail/WEB-INF/classes/log4j.properties; in 11.0.4+ this files has been relocated to /var/opt/scalix/<instance>/webmail/log4j.properties. Set the log level to INFO or DEBUG for each of the '*-ACTIVITY' loggers.  INFO is the standard log level used in SWA for output.  The DEBUG level is used only for large items, such as message bodies.

# use a level of INFO or higher to trace activity
log4j.logger.SWA-ACTIVITY=INFO, rollingActivity
log4j.logger.MIME-ACTIVITY=INFO, rollingActivity
log4j.logger.SOAP-ACTIVITY=INFO, rollingActivity

Tomcat (/etc/init.d/scalix-tomcat restart) will need to be restarted for the changes to take effect.  Using the default appender, log output will go to /var/opt/scalix/instance/tomcat/logs/scalix-swa-activity.log.  The default maximum size of the log is 20MB, with five previous log files retained.

Platform

To enable activity / access logging for Platform edit /var/opt/scalix/<instance>/platform/log4j.properties to change the log level from the default level of FATAL to INFO or DEBUG for each of the '*-ACTIVITY' loggers.  INFO is the standard log level used by Platform for output.  The DEBUG level is used only for large items, such as message bodies.

# use a level of INFO or higher to trace activity
log4j.logger.GENERAL-ACTIVITY=INFO, rollingActivity

log4j.logger.CALENDAR-ACTIVITY=INFO, rollingActivity
log4j.logger.DISPATCH-ACTIVITY=INFO, rollingActivity
log4j.logger.CONTAINER-ACTIVITY=INFO, rollingActivity
log4j.logger.REST-ACTIVITY=INFO, rollingActivity
log4j.logger.MAILBOX-ACTIVITY=INFO, rollingActivity
log4j.logger.NOTIF-ACTIVITY=INFO, rollingActivity
log4j.logger.DBPOOL-ACTIVITY=INFO, rollingActivity
log4j.logger.IMAP-ACTIVITY=INFO, rollingActivity
log4j.logger.SEARCH-ACTIVITY=INFO, rollingActivity
log4j.logger.DIRECTORY-ACTIVITY=INFO, rollingActivity
log4j.logger.DELIVERY-ACTIVITY=INFO, rollingActivity
log4j.logger.MAPI-ACTIVITY=INFO, rollingActivity

Tomcat (/etc/init.d/scalix-tomcat restart) will need to be restarted for the changes to take effect.  Using the default appender, log output will go to /var/opt/scalix/instance/tomcat/logs/scalix-api-activity.log.  The default maximum size of the log is 20MB, with five previous log files retained.

Logging configuration script

This script automates enabling/disabling activity logging. It only works for single-instance deployments.

#/bin/sh
application=$1
if [ -n "$2" ]; then
        level=$2
else
        level="INFO"
fi
logconfigfile=/var/opt/scalix/*/$1/log4j.properties
sed -i -e "s/log4j.logger.\(.*\)=\(.*\), rollingActivity\(.*\)/log4j.logger.\1=$
{level}, rollingActivity\3/g" $logconfigfile

example usage:

[root@server bin]# ./enable_logging.sh webmail INFO
[root@server bin]# ./enable_logging.sh platform INFO