How to set a fine grained logging to troubleshoot efficiently problems with a java connector?
search cancel

How to set a fine grained logging to troubleshoot efficiently problems with a java connector?

book

Article ID: 51195

calendar_today

Updated On:

Products

CA Directory CA Identity Manager CA Identity Governance CA Identity Portal CA Risk Analytics CA Secure Cloud SaaS - Arcot A-OK (WebFort) CLOUDMINDER ADVANCED AUTHENTICATION CA Secure Cloud SaaS - Advanced Authentication CA Secure Cloud SaaS - Identity Management CA Secure Cloud SaaS - Single Sign On CA Security Command Center CA Data Protection (DataMinder) CA User Activity Reporting

Issue/Introduction

Description:

The goal of this document is to explain some basics about log4j and how to set a fine grained logging to troubleshoot efficiently problems with a java connector.

We will be interested in LND java connector here but the same procedure can be applied for other java connectors. Samples are issued from IMR12.0-CR8 implementation.

Environment

Release:
Component: IDMGR

Resolution

Solution:

Java Connector Server uses log4j based on Simple Logging Facade for Java or (SLF4J).

JCS involves nlog4j__V1.2.25.jar to perform this task.

The Logging Level.

The LND java connector classes log messages at DEBUG, INFO, WARN and ERROR (from lower to higher) levels.

The DEBUG Level, designating fine-grained informational events, is most useful to debug the java connector.

A logger will only output messages that are of a level greater than or equal to it.

Setting the logger for the LND package at the DEBUG level, will turn on logging all of the other highest level messages, previously mentioned.

Add the following line:

log4j.logger.com.ca.jcs.lnd=DEBUG into Program Files\CA\Identity Manager\Connector Server\conf\log4j.properties after the following existing one:

log4j.logger.com.ca=ERROR

The interest of setting a debug for log4j.logger.com.ca.jcs.lnd package instead of log4j.logger.com.ca.jcs higher level in hierarchy is to log finer only the connector you want to debug and don't pollute the log with other messages in the case where you have many connectors.

If you want to debug another java connector then replace lnd in log4j.logger.com.ca.jcs.lnd package by the other connector short name; e.g.: log4j.logger.com.ca.jcs.sap

At this date, java connector names in IMR12-CR8 packages are:

as400, jdbc, jndi, krbscript, lnd, ora, pps, rsa7, sap and sql.

The Logging file.

The log4j file appender interface is defined to log into jcs_daily.log.

The messages are displayed into Program Files\CA\Identity Manager\Connector Server\logs\jcs_daily.log

The Logging output format.

The log4j file appender layout pattern is defined in log4j.properties as:

%d{ISO8601} %-4r [%t] (%C:%L) %-5p %x - %m%n

E.g. of jcs_daily.log line:

2010-01-10 17:41:07,109 61109 [LNDConnectionFactoryGroup-2-thread-1] (com.ca.jcs.lnd.LNDConnectionFactory$2:107) DEBUG - --- Created Session: ---

In this sample: (http://www.jdocs.com/log4j/1.2.13/org/apache/log4j/PatternLayout.html)

1rst field is the ISO8601 date format as "YYYY-mm-dd HH:mm:ss,SSS".

2nd field is the number of milliseconds elapsed since the start of the application until the creation of the logging event. (Right padded with space if less than 4 digits)

3rd field is the name of the thread that generated the logging event (in square brackets).

4th field is the fully qualified class name of the caller issuing the logging request with the line number (in brackets).

5th field the priority of the logging event, e.g. DEBUG.

6th field is the nested diagnostic context associated with the thread, e.g. none.

Last field matches with the message sent by java program, e.g. log.debug("--- Created Session: ---");

The Logging rollover.

The jcs_daily.log is rolled over (by default) at midnight each day and copied with yyyyMMdd suffix.

Look at the one matching with the date of your problem.