Home > Advanced Configuration > ADSS Server Logging > Managing ADSS Server Logs

Managing ADSS Server Logs

ADSS Server uses Tomcat log4j for Trace/ Debug log file management. Tomcat log4j allows you to configure various aspects of log generation such as log file path, log file name, log file size, log levels, number of logs to maintain, log creation date etc. Tomcat log4j is described here: http://logging.apache.org/log4j

By default ADSS Server generates a new log file every day for each of its managed logs and there is no restriction on the number of logs to be maintained or log file size. The name of a log file starts with the service/module which is creating that log e.g. signing.log. When a new log file is created (on a new day) the old log file name is changed to include the date appended with its file name i.e. signing.log.2011-03-01 and the new file name becomes signing.log. 

A typical log file snapshot is shown below:

The log file is tab separated and contains the following information:

Date: Date in descriptive form
Thread Name: A unique Operating System defined thread name assigned to each user session
Log level: Defines what level of log this is i.e. DEBUG, INFO, ERROR
Class Name: Class name of the source code that has generated this log record
Message: The message generated by the program at a particular instance of time

The level of detail recorded within the log files can be changed by editing these settings inside the relevant ADSS Server component i.e:

The following example is a partial snapshot of the log.xml file with some explanations below:



Each item in the screenshot is described below:

Item Logger Detail
Log4j appender type 

type = RollingFile 

The RollingFileAppender is an OutputStreamAppender that writes to the File named in the fileName parameter and rolls the file over according the TriggeringPolicy and the RolloverPolicy 
Log4j appender name 

name = signing 

This defines the name of appender. 
Log file name

fileName = %ADSS_INSTALLATION_DIR%/logs/service/signing.log 

Define the name of the file to write to. If the file or any of its parent directories does not exist, they will be created. 
Log file pattern 

filePattern = %ADSS_INSTALLATION_DIR%/logs/service/signing/signing.%d{yyyy-MM-dd}-%i.log

Defines the pattern of the file name of the archived log file. The format of the pattern should dependent on the RolloverPolicy that is used. The DefaultRolloverPolicy will accept both a date/time pattern compatible with SimpleDateFormat and and/or a %i which represents an integer counter. The pattern also supports interpolation at runtime so any of the Lookups (such as the DateLookup can be included in the pattern. 
Logging layout 

type = PatternLayout 

Name of the log4j provided class which will manage the ordering and format of the log file 
Log file content 

pattern = %d{dd MMM yyyy HH:mm:ss} [%t] %-5p %c - %m%n 

Defines the actual log file contents. Details are: 

  • =%d{dd MMM yyyy HH:mm:ss}: This shows the date when the log record was generated. This can be changed as required e.g. =%d{MMM yy HH:mm:ss}

  • [%t]: Shows the operating system mentioned thread name

  • %-5p: Defines the log level. The log level is set programmatically when setting a message

  • %c –: Name of the ADSS class which is generating the log message

  • %m: The log message reported by the class

  • %n: A new line character at the end of the log record
Daily Rolling File Appender DailyRollingFileAppender extends FileAppender so that the underlying file is rolled over at a user chosen frequency. 
Log4j appender policy 

type = Policies 

Defines the policies for log4j appender. 
Log4j appender policy type 

time.type = TimeBasedTriggeringPolicy 

The TimeBasedTriggeringPolicy causes a rollover once the date/time pattern no longer applies to the active file. This policy accepts an increment attribute which indicates how frequently the rollover should occur based on the time pattern and a modulate boolean attribute. 
Log4j appender policy interval 

interval = 1 

How often a rollover should occur based on the most specific time unit in the date pattern. For example, with a date pattern with hours as the most specific item and increment of 4 rollovers would occur every 4 hours. The default value is 1 day. 
Log4j appender policy modulate

modulate = true 

Indicates whether the interval should be adjusted to cause the next rollover to occur on the interval boundary. For example, if the item is hours, the current hour is 3 am and the interval is 4 then then the first rollover will occur at 4 am and then next ones will occur at 8 am, noon, 4pm, etc. 
Log4j appender strategy 

type = DefaultRolloverStrategy 

The default rollover strategy accepts both a date/time pattern and an integer from the filePattern attribute specified on the RollingFileAppender itself. If the date/time pattern is present it will be replaced with the current date and time values. If the pattern contains an integer it will be incremented on each rollover. 
Log4j appender strategy fileIndex
fileIndex = nomax 

If set to "max" (the default), files with a higher index will be newer than files with a smaller index. If set to "min", file renaming, and the counter will follow the Fixed Window strategy described above.
Log4j appender strategy action
type = Delete 

Defines the action that gives users more control over what files are deleted at rollover time than what was possible with the DefaultRolloverStrategy max attribute. The Delete action lets users configure one or more conditions that select the files to delete relative to a base directory.
Base path to delete log files
basepath = %ADSS_INSTALLATION_DIR%/logs/service 

Defines the base path from where to start scanning for files to delete. It is Required attribute.
Condition to delete log files 

type = IfFileName 

Accepts files whose path (relative to the base path) matches a regular expression or a glob. 
Condition expression to delete log files 

glob = service.* 

If regex not specified. Matches the relative path (relative to the base path) using a limited pattern language that resembles regular expressions but with a simpler syntax. It is required parameter. 
Nested condition to delete log files 

type = IfLastModified 

An optional set of nested PathConditions. If any nested conditions exist, they all need to accept the file before it is deleted. Nested conditions are only evaluated if the outer condition accepts a file (if the path name matches). 
Nested condition age to delete log files 

age = P30D

Defines the duration. The condition accepts files that are as old or older than the specified duration. 
Log4 logger 

name = com.ascertia.adss.service.signing 

A logger is a component which will take your logging request and log it. Each class in a project can have an individual logger, or they can all use a common logger. The logger element must have a name attribute specified. Defines the java package that creates this log file. 
Logger level 

level = info 

Defines the log level. If the log level is set to DEBUG the log file will contain all logs records with log levels DEBUG, INFO and ERROR. If this is set to INFO then only INFO and ERROR log records are created. If set to ERROR only ERROR related log records are generated. The Log Level is followed by the name of the log marker. 
Logger additivity 

additivity = false 

Appender additivity is a property of loggers to inherit their parent's appenders. By default, all loggers have appender additivity enabled. 
Logger appender reference 

ref = signing 

Defines the reference to the appender name i.e. logs generated would be write in which file. 

log4j can also be used to create logs on other systems. For more information read the log4j documentation at: http://logging.apache.org/log4j

The following settings show how to create settings to limit logs to 10 files, each of 1 MB each. Old log files will be deleted.