DevPortal

How do I manage Logs?


Table of Contents


How do I manage Logs?

Pramati Server maintains logs for all kinds of error messages and configuration settings. These logs are very important to analyze any problems that might have occurred. Pramati server logs information into various files. These files can keep growing, especially in a production environment where there is a lot of activity on the part of the server, which can take up a lot of memory. Also, some of the logging information may not be relevant after some days. Pramati Server provides a Rotation policy of logging information. This way, new log files can be created based on certain criteria and old log files which may not be required are deleted.

The following log rotation policies are available:

How do I configure Log Properties using the Console?

To configure log properties in the Server, select Configure > Logs in the Explore panel. This displays the Configure Log Settings screen.

Using this screen, you can set the Rotation Policy and the Log Deletion Policy. The Rotation Policy can be set by file size, by time, or by both time and size. Set the maximum file size in kilobytes and the time after which a new file is to be generated. By default, the maximum file size is set at 10000Kb, and the time is set at 168 hours.

You can also set the time after which the log file can be deleted. There are two policies for deleting the archived log files:

Whenever there are older log files with respect to the set age limit or the total size of log files exceed the set limit, the archived log files are deleted.

Save the settings. The Server keeps track of all the logs based on the new settings.

How do I configure Request Sniffing?

Request Sniffing is a trouble shooting tool that helps in analyzing what is happening to a request when it is being processed by the Server. It performs the following functions:

Request Tracing logs information about various states the request goes through in addition to the entry and exit point information logged by Request Sniffing.

How do I configure Request Sniffing using logging-config.xml?

The Request Sniffing framework is currently designed to be configured from an XML file. The output file location and verbosity of information Sniffing or Tracing can be configured in logging-config.xml using the following tag:
<request-sniffing enableSniffing="false" enableTracing="false" defaultOutputFile="sniff.log"/>

How do I configure Request Sniffing from the Command Prompt?

Use the following command to turn on Sniffing at runtime from Server command prompt:
shell@start_request_sniff [-trace] [-file <output_filename>]

To turn it off, use shell@stop_request_sniff

What is the format of Sniffer Log?

Sniffer log is placed in the Server logs directory. The output contains records of this structure:

Followed by more information on the subsequent lines.

A request has additional information. Consider the iBank application which contains the following information:

client ID= "127.0.0.1"
context = "bank"
URI = "bank/transfer.jsp"

Response includes just the response details. In case of Web, it includes be the response headers.

Sample output for Request Sniffing

The output for Request Sniffing looks like:
## WEB RESPONSE Thread-15 1:24:27 PM ID:1077350067734
Client Id =127.0.0.1
Context =/
URI =/OrderBookWeb/
Details =HTTP/1.1 404 The requested resource was not found. Please check the URI above.
Server: Pramati Server
Date: Sat, 25 Feb 2006 07:54:28 GMT
Content-Length: 1125
Content-Type: text/html
Connection: Keep-Alive

A JMS Request Sniff looks as below:

## JMS REQUEST RMI TCP Connection(75)-192.168.1.29 4:42:49 PM ID:1077534769960
Client Id =192.168.1.29-502058352
Context =sendMessage msgId:ID:1673361:1077534769340:192.168.1.29:destination:QUEUE: JMSQueue
URI =sendMessage
Details =sendMessage
##
## JMS RESPONSE RMI TCP Connection(75)-192.168.1.29 4:42:49 PM ID:1077534769960
Client Id =192.168.1.29-502058352
Context =sendMessage msgId:ID:1673361:1077534769340:192.168.1.29:destination:QUEUE: JMSQueue
URI =sendMessage
Details =sendMessage done
##

In the above sniff log generated:

How do I interpret Logs for Request Sniffing?

Sniffer output can be logged in human readable format as described:

In case of a Web request, the request context can comprise of:

context = App context
URI = URI requested
Client Id= Client's IP Address

With the request context set, the state of the request is recorded as it goes through various processing stages. In case of an EJB request, the request context can comprise of:

context = Jar Name
URI = bean name + method invoked + pk
client Id = principal

In case of a resource, the request context can be the JNDI name of the resource.

How do I monitor Server Logs?

Pramati Server provides an extensive and robust logging framework that maintains a log for every action that is performed on the Server. Logs are very useful at the time of troubleshooting and are maintained in the logs/directory of the nodes directory. These logs can be viewed either manually by viewing them on a Text Editor or by selecting Monitor > Logs from the left navigation panel of the Console.

You can view logs for three security levels: info, warning, and severe (or all), and set the number of logs to be displayed on each page. Enter the number of log messages to be viewed and click Display. The following details are displayed for the logs:

Table 1: Web Activity Logs

FieldDescription
LevelDisplays the level of security chosen for the log.
TimeDisplays the date and time when the log was recorded.
ContextDisplays the services for which the log was recorded.
MessageDisplays the logged message.
ReportDisplays the complete log report.

Logs can be viewed by using any text editor.

How do I view a Server Log Report?

When you click Report in the log details, a summarized report for the selected log is displayed. The following data about each error is maintained by the Server:

Table 2: Error data maintained by Server

FieldDescription
MessageThe Message
TimeTime at which the error occurred
LevelThe Level of severity
ContextThe Context
MessageIDThe server assigns a message ID for every message logged

The report presents details regarding:

Execution Path The Execution Path displays reports regarding:

Table 3: Execution Path report

FieldsDescription
LevelDisplays the level of security for the log.
ContextDisplays the services for which the log was recorded.
IDDisplays the ID of the message.
MessageDisplays the logged message.

Events/Debug The Events/Debug section displays reports regarding:

Table 4: Events Debug report

FieldsDescription
TypeDisplays the level of security for the log.
DescriptionDisplays a description for the alert.

Stack Trace Clicking on the Stack Trace link displays the actual stack trace of the error. Details provided are:

Table 5: Stack Trace

FieldDescription
IDDisplays the ID of the error message.
DescriptionDisplays the error message description thrown by the Server.
Stack TraceDisplays the actual stack trace.

How do I trace Logs in Pramati Server?

Tracing is a mechanism that traces the flow inside the Server. It is useful in single threaded environment as it does not give a thread safe dump of the path traversal. Pramati Server provides the following tracing mechanisms:

Tracing helps users in debugging an application at run-time. To turn it on from the shell at the command prompt, type trace.

Provide the details regarding the logs you want. The properties specified in the trace.props file enable the following:

To turn on trace at run time, at command prompt type: trace load. To unload trace properties, at the command prompt type: trace unload.

Stack Trace The Stack Trace section displays the ID of the Alert, the description, and the stack trace that was generated as a result of the action that led to the alert.

Consider the following trace output:

#util.timing.TimerCalculator-->[Info]Diagnostics status for TimingCalculator with name:
Servlet/pramati_adminconsole.war/doc_root/message_server/persistent_store/datasources/operation/create_step2_DataSource.jsp/serviceMethodTime and TimingLocation: Servlet:serviceMethodTime is: false
#util.timing.TimerCalculator-->[Info]Diagnostics status for TimingCalculator with name:
Servlet/pramati_adminconsole.war/doc_root/com.pramati.admin.webview.j2ee.DeployExplodedApplication/serviceMethodTime
and TimingLocation:Servlet:serviceMethodTime is: false
#util.timing.TimerCalculator-->[Info]Diagnostics status for TimingCalculator with name:
Servlet/pramati_adminconsole.war/doc_root/com.pramati.admin.webview.j2ee.DeployExplodedApplication/serviceMethodTime and TimingLocation :Servlet:serviceMethodTime is: false

Interpreting Trace Output

Table 6: Interpreting Trace Outputs

SymbolPurpose
#Followed by the package context from which the trace originates.
-->Followed by the actual trace message.
Encloses the severity level for each trace message.

How do I search for Server Logs?

To search for specific information in the server log files:
  1. Select Monitor > Logs in the Explore panel. In the screen that is displayed, click Search.
  2. On the page that appears, specify the following criteria:
Sorting by: Select whether you want to get the search results in Ascending or Descending order. The log details for the specified search criteria are listed in the page as Messages.

How do I interpret a Server Log file?

A debug log file is created in text format. It follows the configured log file rotation policy in which the actions are logged in order of occurrence. Consider the following example of a debug log:
Main message ID: DEPLOY0303; Result: Failed;Description:
Error while starting application StockMarket.ear;Tip:
Messages Trace:
RES0414; Could not obtain administered object [jms/QueueConnectionFactory] of type
[javax.jms.QueueConnectionFactory] on jms server [default];(resource.JMSResourceDesignate);Tip:
Exception Stacks:
ID:(+RES0408)com.pramati.services.resource.ResourceException: Could not obtain administered object [jms/QueueConnectionFactory]
of type [javax.jms.QueueConnectionFactory] on jms server [default]
com.pramati.services.resource.ResourceException: Could not obtain administered object [jms/QueueConnectionFactory]
of type [javax.jms.QueueConnectionFactory] on jms server [default]
at com.pramati.resource.JMSResourceDesignate.getBindObject(JMSResourceDesignate.java:753)
at java.lang.reflect.Method.invoke(Native Method)
Event & Debug Traces..
D::Inside checkPermission() Checking permission - [Type = com.pramati.util.security.permissions.ServerAppPermission
Name = StockMarket.ear Actions = start]
::(security.core.JAASServerAccessController)
D::Inside checkPermission() Subject-nobody has allPermission. granted - [Type = com.pramati.util.security.permissions.ServerAppPermission
Name = StockMarket.ear Actions = start]::(security.core.JAASServerAccessController)

Table 7: Interpretation of the tags in the server log

Tag nameDescription
RecordRepresents an atomic block called action.
i) ID: Displays the time stamp and the record number
ii) Time: Time stamp
iii) Id: Main message key
iv) Desc: The result of the action
MessageAn element of action that represents error or success. Contains information on events that lead to the result.
EventAn element of action that represents debug statements in the context of messages within the action.
ExceptionContains the exception stack trace in case of a failure.


© Pramati Technologies 2007 Runs on Pramati Server | Feedback | Legal