Logging Configuration Change to Facilitate Easier Archive Job Error Identification

  • 7019356
  • 03-Mar-2015
  • 07-Aug-2017

Environment


Retain 3.x
Worker

Situation


I'm getting archive errors in my jobs but have a hard time finding the errors in the Worker log.  Is there an easy way to identify errors?

Resolution


Yes, but it requires a change to a configuration file (log4j.properties) in each RetainWorker directory.  We are asking development to make the following changes a default in the Worker logs (bug 7376) in Retain 3.5.1.

This change adds logging level indicators next to each message in the log:

  • [ERROR]
  • [INFO]
  • [DEBUG]
  • [TRACE]

Thus, by making the change suggested in this article, you'll be able to quickly find errors by searching for "[ERROR]":

13:06:29,230 [DEBUG] MailboxArchivingStats: Calculated date-flag TimeStamp: (Wed Dec 31 17:00:00 MST 1969)
13:06:29,230 [DEBUG] RetainServerCommunication: obtainHTTPResponseCodeAndData()
13:06:29,230 [TRACE] RetainServerCommunication: About to fetch: http://10.1.5.30:48080/RetainServer/Server/ServerController2.jsp
13:06:29,291 [INFO ] RetainDredger: Total mails archived for this job: 0
13:06:29,291 [TRACE] RetainDredger: Logging out...
13:06:29,291 [TRACE] GroupWiseUser: Logging out...
13:06:29,294 [TRACE] RetainDredger: =============================================================================================
13:06:29,294 [INFO ] RetainDredger: [LOGIN] LOGGING IN AS: Stephan

13:06:29,294 [TRACE] GroupWiseUser: Login: get new GWSoapClient...
13:06:31,289 [TRACE] RetainLoginListener: About to Login
13:06:31,289 [TRACE] RetainLoginListener: Initial gwscon is steve.parents at 10.1.5.11.7191
13:06:31,289 [TRACE] RetainLoginListener: Initial redirect is nil so there was no bounce
13:06:31,296 [ERROR] GroupWiseUser: Login
com.gwava.gweasysoap.GWSoapAPIException: Dependent store file does not exist on the disk , Code: c05d

To make this change, take the following steps:

  1. Edit the log4j.properties file

Linux:  /opt/beginfinite/retain/RetainWorker/WEB-INF/classes

Windows:  [drive]:\Program Files\Beginfinite\Retain\RetainWorker\WEB-INF\classes

  1. Search for "log4j.appender.R.layout.ConversionPattern".
  2. We are noticing different configurations for this particular line.  Regardless of what it currently reads, comment out the current line (putting the pound sign " # " in front of it and either re-typing the line or copying it and modifying it to read as follows:

log4j.appender.R.layout.ConversionPattern=%d{HH:mm:ss,SSS} [%-5p] [%t] %c: %m%n

Explanation
Log4j is an open source project based on the work of many authors.  It allows a developer to control which log statements are output.  Retain implements log4j and here is an explanation of each pattern layouts we use:

  • %d is used to output the date and time followed by the date format specifier within the curly brackets.  Some customers may see as the date format specifier in the existing file; however, this causes it to output the date along with the time in ISO8601 format.  We do not need the date since the Worker logs roll over every night at midnight, so we know the date already. 
  • %-5p instructs it to show the logging class level (ERROR, INFO, DEBUG, and TRACE).  We are adding square brackets to the pattern because [ERROR] is a more unique and discoverable pattern than just "ERROR".
  • %t will display the process thread involved.  This is helpful for the developer should we need to escalate the issue to development.  For readability, the thread is surrounded by square brackets.
  • %c is used to output the category of the event.
  • %m causes the Worker's log message to display.
  • %n is for inserting an end of line (EOL) character similar to "\n" in regular expressions.
  1. Repeat steps 1 - 3 for every Worker.
  2. Restart tomcat.

[Source:  Riedelbach E.]

Additional Information

This article was originally published in the GWAVA knowledgebase as article ID 2487.