Logging Service

The Logging Service aims to centralize logs, and offers an interface integrated into integration runtime for consulting and monitoring log applications. It functionalities are exposed as web service to persist and retrieve log entries. Each user have access to his logs.

Please note that the screenshots provided in this chapter have been made with an earlier version of Infinity and differ slightly from the current design.

Logging Service Setup

To run the logging service, you have to install lifecycle management and integration runtime.

Make sure the following table has been created; the log entries will be persisted there.

DROP TABLE IF EXISTS `log_service_entries`;
CREATE TABLE  `log_service_entries` (
  `SYSTEM_NAME` varchar(2000) NOT NULL DEFAULT '',
  `SERVICE_NAME` varchar(2000) DEFAULT NULL,
  `SYSTEM_GUID` varchar(2000) DEFAULT NULL,
  `BUSINESS_CASE_GUID` varchar(2000) DEFAULT NULL,
  `DRILL_DOWN_URI` varchar(2000) DEFAULT NULL,
  `TAGS` varchar(2000) DEFAULT NULL,
  `HIERARCHYINDICATOR` int(10) unsigned DEFAULT NULL,
  `LOG_DATE` bigint(20) DEFAULT NULL,
  `LEVELL` varchar(10) DEFAULT NULL,
  `MESSAGE` varchar(4000) DEFAULT NULL,
  `PARTITION_ID` varchar(300) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

After executing the mvn clean package command and starting tomcat you should be able to see the service wsdl located at http://<host:8080>/integration-runtime/services/soap/private/1.0/LoggingService?wsdl.

Logging Web Service

Description

The logging web service is a module integrated into an IPP application as a plug-in containing a web page and an exposed web service.

Web Page

Figure: Log Service Interface

Service API

Method Parameters Result
addLogEntry LogEntry logEntry Void
addLogEntryList List<logentry> logEntryList Void
findLogEntries
  • Date from
  • Date to
  • String businessUuid
  • String systemUuid
  • String systemName
  • String serviceName
  • String tagName
  • String tagValue
  • String level
  • String message
List<logentry> logEntry

LogEntry Structure

Attribute Type Description
systemGuid String The system guid
systemName String The system name
timestamp Date Date of the log entry
hierarchyIndicator Int The log tree is composed by three levels :
  • LOG.IN : open new log entry
  • LOG.CHECK : check box for a log entry
  • LOG.OUT : close a log entry
In a list of logs, logs are inserted in a defined hierarchical levels
  • A level is opened by a LOG.IN and closed by LOG.OUT and may contain sub levels
  • Each LOG.IN must have a corresponding LOG.OUT
businessCaseGuid String The business case guid
drillDownUri String URI
tags Map Each log entry may accept a non determinate number of tags (key/value), which can be visualized when pointing the document icon.
duration String The duration column is calculated based on the time between LogEntry.IN and LogEntry.OUT
Message String The log message
level Enumeration The log level can Be
  • INFO
  • ERROR
  • WARN
  • FATAL
  • DEBUG
partitionId String The tenant ID of the client. Each user have a specified tenant id. So, this ID aims to refer each log to the appropriate user.

Web Service Testing

Description

The com.infinity.integration.slf4j package includes classes that describe how to:

public class Slf4jLoggerTest
{
   public final static String WSDL_LOCATION = "http://localhost:8080/integration-runtime/services/soap/private/1.0/LoggingService?wsdl";
   @Test
   public void testINFOLog()
   {
      LoggingService logger = (LoggingService) LoggerFactory.getLogger(WSDL_LOCATIONgetClass().getName());
      logger.begin("Slf4jLoggerTest", "testLog", "begin message");
      logger.info("some Text");
      logger.debug("some Text");
      logger.end("Slf4jLoggerTest", "testLog", "end message");
   }
}

Asynchronous Submission

In order to have better performance and to avoid blocking service invocation, the logging entries are submitted to the service asynchronously.

In the current version, the asynchronous service invocations are not persisted. To add the persistence support, you have to apply the following configuration:

  1. Add camel-hawtdb maven dependencies in your pom.xml:
    <dependency>
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-hawtdb</artifactId>
       <version>${camel.version}</version>
    </dependency>
  2. Rebuild the project to update dependencies.
  3. In case you already have a project, you can just add the following jars manually:
  4. Update the file META-INF/spring/asynchronous-logservice-context.xml located in the slf4j-loggingservice-<version>.jar by adding the bean definition of hawtDB aggregation repository:

    <bean id="repo" class="org.apache.camel.component.hawtdb.HawtDBAggregationRepository">
       <property name="persistentFileName" value="target/data/hawtdb.dat" />
       <property name="repositoryName" value="repo2" />
    </bean>
  5. Finally, add the reference of the hawtDB aggregation repository in the route defined in the asynchronous-logservice-context.xml.

    Example:

    <aggregate strategyRef="messageAggregator" eagerCheckCompletion="true" aggregationRepositoryRef="repo" completionSize="10" completionTimeout="20000">
       <correlationExpression>
          <constant>true</constant>
       </correlationExpression>
       <process ref="loggingServiceProcessor" />
    </aggregate>

Logging Levels

The log4j.properties file allows you to configure the logging level to be used by the logging service clients. In the following example, the logging level is set to DEBUG for CLASS-Name-1, and OFF (disabled) for CLASS-Name-2

# DEBUG INFO
log4j.rootLogger=INFO, console, file 
...
log4j.logger.com.infinity.integration.CLASS-Name-1=DEBUG
log4j.logger.com.infinity.integration.CLASS-Name-2=OFF
	

Log Search

The Log Service user interface allows to search log entries by start time, end time, business Case Guid, Tag name and Tag value.

The following example demonstrates a search by start time, end time and business case Guid:

Search screen

Figure: Search screen

Calculating Logs Duration

The log duration is calculated based on the time between LogEntry.IN and LogEntry.OUT. The duration is displayed in this format hh:mm:ss:SSS

Calculate duration

Figure: Calculate duration

Data Masking Configuration

The properties file logging-Service.properties located in WEB-INF/classes folder can be used to configure the tags data that should be masked.
The following is an example on how to mask credit card and social security number tags value.

#SSN EXAMPLE
#enable masking for ssn tag
ssn.toBeMasked=true
#pattern will match one or more digits
ssn.Pattern=(//d{3})-(//d{2})-(//d+)
# '#' will be used as replacement character
ssn.mask=#
#number of characters left without masking
ssn.visibleCharacters=3

##CREDIT CARD EXAMPLE
#enable masking for creditcard tag
creditcard.toBeMasked=true
#pattern will match one or more digits
creditcard.Pattern=//d+
# '*' will be used as replacement character
creditcard.mask=*
#number of characters left without masking
creditcard.visibleCharacters=2
		

The following example shows how some data are masked when displaying the LogEntries in the table. We are masking the the social security number (ssn) and the credit card (creditcard) tags:

Mask Some Tag

Figure: Mask Some Tag

Call Hierarchy - expand/collapse

You can expand or collapse the Call Hierarchy (log tree entries) by using the +/- buttons.

Log Expand All/Collapse All buttons

Figure: Expand/Collapse All buttons

Log Service Statistics Screen

Example

The log statistics screen shows the occurrence number for a logEntry defined by "systemName" and "serviceName".

In the figure below, logs generated by System B/Service W occurred 3 times.

Log Statistics screen

Figure: Log statistics screen

Log Repair

The application offers the user the possibility to repair a Log list in case a log.IN or log.OUT is missing. The added logs can be persisted.

Knowing that the logs are grouped by bloc and each bloc have a Log.IN and a Log.OUT, the problem that can occur during application crash is that a Log will lose it's Log.IN or Log.OUT.

So : In order to repair, user has to select the broken Log and choose which type of log (IN or OUT) to insert.

Example : repairing a Log.OUT by adding a Log.IN to the log unit

Step 1 : locate the desired log to repair

As we can see in the figure below, the Log defined by (System D1, Service Z1) has a missing Log.IN

log repair initially

Figure:Log repair initial screen

Step 2 : Choose the log type to add

To repair this log, user has to click on repair icon that will display a popup panel asking user to choose the log type to insert.

adding log.in

Figure: log adding log.in

Step 3 : Log has been added and ability to delete it

Once the user has validated his request, the application update the log tree by adding an internal log. This log, as show in the figure "log.in added" has an icon (delete), this will offer the possibility to the user to delete it.

We can notice that the added log is displayed as a parent of the repaired log

log.in added

Figure:log.in added

Step 4 : Persisting the added log

After repairing the log tree, the user has the ability to persist the new logs, to do so, user has to click on persist Internal Logs button.

persisting log

Figure:Persisting logs

Once persisted, the log's delete icon is removed.

Note
In the previous example we have corrected the unit log by adding a Log.in, by the same way we can correct an unit log missing a Log.out

You can repair multiple logs at the same time and have to option to persist more than one log in one operation.

Message Tooltip

The message column in the data table has a maximum size (N). Once it is exceeded the N characters are append by "..." and a tooltip is available to show the entire message.

message tooltip

Figure:Message tooltip

Purge Logs

The service offers you the ability to purge logs. By choosing the date, all logs related to the current user till the chosen date will be removed.

Logs Purge

Figure: Log Purge