What is Zimbra log4j?

log4j is a logging framework written in Java, it is also used by Zimbra as the log manager for java processes. In this article, we will take a look at using and configuring log4j for Zimbra, its categories, and outputs.

Zimbra log4j configuration

Zimbra log4j records the log files in the local file system, although it can be modified. The configurations are stored in  /opt/zimbra/conf/log4j.properties.in. There is also another configuration file in /opt/zimbra/conf/log4j.properties for temporary changes that are overridden by log4j.properties.in file every time you restart mailboxd service.

To make any changes in the configuration file

  • Go to /opt/zimbra/conf/log4j.properties.in file.
  • Make your preferred changes.
  • Restart mailboxd service by
zmmailboxdctl restart

For example, this is the default zimbra.sync entry in /opt/zimbra/conf/log4j.properties.in file

log4j.logger.zimbra.sync=INFO,SYNC

by modifying INFO to TRACE

log4j.logger.zimbra.sync=TRACE,SYNC

the changes will be permanent.

But if for example, you change log settings for a single user via zmprov

zmprov addAccountLogger user@domain.com zimbra.soap debug

with restarting the mailboxd service, the changes are reset since the account-level log settings are temporary and stored in /opt/zimbra/conf/log4j.properties file.

For more information, you can run these commands

zmprov help log
zmprov help misc

Zimbra log4j categories

To find information on Zimbra log4j categories use

zmprov help log

This is the list of Zimbra log4j categories

zimbra.accountAccount operations
zimbra.aclACL operations
zimbra.backupBackup and restore
zimbra.cacheIn-memory cache operations
zimbra.calendarCalendar operations
zimbra.davDAV operations
zimbra.dbconnDatabase connection tracing
zimbra.extensionsServer extension loading
zimbra.ewsEWS operations – ZCS 8.5+
zimbra.filterMail filtering
zimbra.galGAL operations
zimbra.imapIMAP protocol operations
zimbra.indexIndex operations
zimbra.ioFile system operations
zimbra.ldapLDAP operations
zimbra.lmtpLMTP operations (incoming mail)
zimbra.mailboxGeneral mailbox operations
zimbra.miscMiscellaneous
zimbra.opChanges to the mailbox state
zimbra.popPOP protocol operations
zimbra.redologRedo log operations
zimbra.securitySecurity events
zimbra.sessionUser session tracking
zimbra.smtpSMTP operations (outgoing mail)
zimbra.soapSOAP protocol
zimbra.sqltraceSQL tracing
zimbra.storeMail store disk operations
zimbra.syncSync client operations
zimbra.systemStart-up/shutdown and other system messages
zimbra.wikiWiki operations
zimbra.zimletZimlet operations

To facilitate finding problems, it is advised to enable DEBUG level logging of appropriate categories. To do so use

log4j.logger.zimbra.categoryName=DEBUG

For example, to enable DEBUG for the zimbra.mailbox category

log4j.logger.zimbra.mailbox=DEBUG

Zimbra log4j levels

The default logging levels are INFO, WARN, ERROR, and FATAL. You can also turn on the DEBUG or TRACE log levels.

LevelLocalSyslogSNMP TrapWhen Used
FATALYYYDesignates very severe error events that the application to abort or impact a large number of users. For example, being unable to contact the MySQL database.
ERRORYYNDesignates error events that might still allow the application to continue running or impact a single user. For example, a single mailbox having a corrupt index or being unable to delete a message from a mailbox.
WARNYNNDesignates potentially harmful situations but are usually recoverable or can be ignored. For example, user log in failed.
INFO*YNN *Designates information messages that highlight the progress of the application, basic transaction-level logging. For example, server start-ups, mailbox creation/deletion, account creation.
DEBUGYNNEvents that would generally be useful to help a customer debug problems.
* A few non-critical messages such as service startup messages, will generate traps.

Zimbra log4j output

Log output is stored in the /opt/zimbra/log/mailbox.log file by an appender. It is possible to configure the log4j configuration file in a way that it stores the log output to other predefined or even to user-defined appenders. For example,

log4j.logger.zimbra=INFO, LOGFILE

makes the appender LOGFILE to direct output from the log4j.logger.zimbra category to be written to /opt/zimbra/log/mailbox.log. By changing the appender it causes the category to stop writing and to begin writing to the new location. It is also possible to use multiple appenders. For example,

log4j.logger.zimbra=INFO, LOGFILE, SYSLOG

makes log4j.logger.zimbra category to write logging events to LOGFILE and SYSLOG appenders.

Technical writer at Zextras, an open-source and technology enthusiast who creates instructional and technical articles about Zextras and Zimbra.

Post your comment