CLI Log Manager

 

CLI Log Manager is used to keep track of the actions taking place in CLI Application. As soon as CLI Application is started, any action such as initialization, list of processes started, error messages, etc. that takes place in CLI Application is logged in the log files.

 

The Log Manager manages the printing of logout and error messages from CLI. The CLILogMgr reads the initial settings of the log from the configuration file logging_parameters.conf under <CLI Home>/conf directory.

 

setDebugLevelForLogging class sets the debug level. When the debug level is set to "2", all the debug messages are output to the console. When set to "1", only the messages that are sent/received are printed on the Standard output.

The default configuration of logging_parameters.conf file does the following :

Parameters in logging_parameters.conf File

 

The parameters in logging_parameters.conf is split into three main tags namely <LOG_USER >, <SYS_OUT> and <SYS_ERR > tags.

 

Tag Description

LOG_USER

Includes the list of parameters that can be used to configure CLI log messages

SYS_OUT

Includes the list of parameters that can be used to configure System.out(Output messages) i.e if you use System.out.println("<Message>"), it is directed to the file stdout.txt, by default.

SYS_ERR

Includes the list of parameters that can be used to configure System.err(Error messages). Similarly, if you use System.err.println("<Messages>"), it is directed to stderr.txt file by default .

 

Parameters Grouped Under <LOG_USER> Tag

 

Following table gives the list of parameters grouped under the LOG_USER tag, with a brief description.

 

Parameters Description

FileName

Name of the file, in which CLI log messages are to be written.

MaxLines

To limit the number of lines in the log file to a desired value.

MaxLinesCached

To limit the number of times the log messages gets written in the log file.

FileCount

The maximum number of log files that can be written by CLI.

LogLevel

To specify the type of messages to be logged namely summary, intermediate, or verbose.

LogsDirectory

The name of the directory in which both system-related and CLI-related log files are to be stored.

useTimeStamp

Prefixes the time(when the action or event was happened) with the log message.

Logging

To enable/disable CLI log messages.

KEY Name

Key to identify the output and error messages.

DisplayName

The module-specific name that is prefixed with the log message.

 

This example illustrates how to log output messages in a single log file and how to set logging levels.

 

<LOG_USER FileName="clierr.txt" MaxLines="10000" FileCount="10" MaxLinesCached="0" LogsDirectory="logs" UseTimeStamp="true">

<KEY Name="CLIERR" DisplayName="CLI" LogLevel="2" Logging="true"/>

</LOG_USER>

 

Parameters Grouped Under <SYS_OUT > Tag

 

In CLI, by default System.out (Output messages) is directed to a file stdout.txt. That is, If you use System.out.println ("<Message>") in your module, it is directed to the file stdout.txt, by default.

 

The following parameters are grouped under the < SYS_OUT > tag.

 

FileName - The name of the file in which output messages are to be written.

 

MaxLines - The maximum number of lines for the Output messages can be configured using the parameter. When there are additional lines to be written by CLI, a new file would be created (e.g.,stdout1.txt).

 

FileCount - The number of files for Output messages can be configured using this parameter. This allows you to delete the first set of files, in order to maintain the number of files specified in the tag.

 

LogsDirectory and the Logging parameter are the same as in < LOG_USER > tag.

 

SYS_ERR>Tag

 

In CLI, by default System.err (Error messages) is directed to a file stderr.txt. That is, If you uses System.err.println("<Message>") , it is directed to the file stderr.txt, by default. 

 

The parameters grouped under <SYS_ERR> tag are same as those under <SYS_OUT> tag, except that it is applicable for System error messages.

 

Note: Unlike <LOG_USER> tag, you cannot add additional tags for <SYS_OUT> and <SYS_ERR>, other than the default one in logging_parameters.conf file.

 

Please refer to Java documentation for complete details.

Related Topics

 



Copyright © 2009 ZOHO Corp. All Rights Reserved.