![]() ![]() ![]() |
20.1 Overview
20.2 Logging Levels
20.4 Viewing Log Reports
Log messages or Debug messages produces details of the Agent processing. These messages help in tracing out the problems or issues faced while working with the Agent. They get stored in a text file and provide information that you require from the Agent. This comfort of receiving debug messages would be beneficial while testing the developed Agents.
Before learning to enable the logging facility, you have to know the various logging levels.
The Logging options available for SNMP Agents are as follows :
Disabled (0) - This level indicates that the debugging mode is disabled. Hence, log messages do not get stored in the text file.
Fatal (1) - This level indicates that the application has encountered a severe error. These errors need to be attended with care. When this level is chosen, critical messages such as details on Agent crash, Authentication errors, Agent already open in another session, etc., get stored in the log file.
Error (2) - This level indicates that an error has occurred and the application cannot handle the request as designed. This may be automatically corrected during execution or the application should be capable of handling those situations when a similar request comes again. Selecting this level store all the Error and Exception messages in the log file along with the fatal messages.
Warning (3) - This level indicates that the application has met with an expected error. All Warning messages get stored in the log file when debug level is WARN.
Info (4) - This level does not signify the occurrence of any error but logs all important events. Any information that might be required for reference gets stored in the log file under this info level.
Debug (5) - This level indicates that the application moves into the debug mode. It will be used for generating debugging information and should not be used in general cases.
Trace (6) - This level indicates that the application logs every activity from entering a method to exiting. Hence, selecting this level may affect performance. The Trace level should be used only to solve any complex problem.
The logging levels can be enabled, either using MIB Compiler UI or using API Calls.
Using MIB Compiler UI
Create a Project and Load a MIB.
Select Project -> Settings menu from the menu bar of MIB Compiler UI.
The General Panel has the options for Debug level.
By default, WARN level is chosen in the combo box.
Using API Calls
By default, the Agent generates code for debugging messages in the init method of the Main file as,
int debugLevel = com.adventnet.agent.logging.Level.WARN; |
This debug level can be changed by making WARN to whichever level you prefer.
As specified earlier, the log messages get stored in a text file named agent.log.
This file gets created as soon the Agent is started and produces reports based on the specified debug level.
Log messages includes debug levels equal to and lesser than the specified level.
These messages can be viewed from the logs folder in <Agent Toolkit Home>/snmpProjects/projectName/agent/bin directory.
Once the Agent is stopped and restarted, the old log messages get shifted to agent1.log and the newly started Agent transfers its log messages to agent.log.
This keeps continuing until agent9.log.
Later, the log messages, except the last one, are zipped and placed under the archives folder of the logs directory.
Thus, agent.log always shows the log messages of the recently started Agent.
![]() ![]() ![]() |