Contents

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents

...

style

...

none

...

Table of Contents

This chapter explains the configurable parameters related to the FioranoMQ Logger module (i.e., related to server logs or monitoring logs or dashboard logs) in the server.

For information on how to configure FioranoMQ Server Loggers in Offline and online mode, refer to Chapter 20 Logger of FioranoMQ Handbookthe Configuring Logger section.

Introduction

Logging into FioranoMQ is achieved with the help of Log4J which makes it is possible to log in at runtime without modifying the application binaries. All log entries are logged at particular log levels. Each logger is given a logging level.  The various logger levels are given below.

 

Value

Logger

Description

-1

INHERIT

Inherits log level from its parent

0

QUIET

No logged information

1

FATAL

Severe errors that might cause premature termination

2

ERROR

Other runtime errors or unexpected conditions

3

WARN

Use of deprecated APIs, poor use of API, almost errors, other runtime situations that are undesirable or unexpected but not necessarily "wrong".

4

INFO

Interesting runtime events (startup/shutdown)

5

DEBUG

Detailed information on the flow through the system

6

TRACE

More detailed information

10

ALL

All logged information

...

These values are defined so that if given a value x, all entries logged with a value less than or equal to x will be received by the logger.

 

Image Modified
Figure 1: Loggers in hierarchical manner

Loggers are arranged hierarchies depicting parent-child relationships. Each element in the tree (Figure 1) has these two attributes as shown Figure 2, below:

 Image Modified
Figure 2:  Edit Logger Properties dialog box

The log level parameter of the loggers can be set to any one of the values present in Table 1. The information present in the log files will depend on the value set. Some examples using the logger configurations are given below:

...

All values less than or equal to retrieve the same result.

LogAppender

Monitoring ->config->LogAppender> config > LogAppender

AppenderName

The AppenderName parameter; provide a unique Appender Name.

...

  • yes - Log entries are appended to the existing log file.
  • no - The log file is overwritten by the new entries.

...

The MaxBackupIndex parameter specifies whether the type of FileAppender used by FioranoMQ is a RollingFileAppender. The RollingFileAppender can be used to roll log files based on size. When the filesize  filesize exceeds MaxFileSize the log file will be rolled. A new log file will be created which will have an incremental index appended to its filename. This parameter helps specify the maximum number of files to be created and will have at most 3 log files: file.log, file1.log, file2.log. This may be used only when the AppenderType is a file.

...

The range of integer values considered valid by this parameter in java are is -2^32 to 2^32 -1. The default value of this parameter is 4.

...

The MaxFileSize parameter specifies the maximum size of a log file in bytes. One Once a log file reacheds reaches this size it is rolled (For an explanation on RollingFileAppender see MaxBackupIndex.) This parameter may be used only when the AppenderType is a file.

...

All values less than or equal to zero retrieve the same results.

 

Dependencies:

MaxBackupIndex and AppenderType.

...

The range of integer values considered valid by the MaxFilterLevel parameter in java are is -2^32 to 2^32 -1. The default value for this parameter is 10.

...

The range of integer values that are considered valid by the MinFilterLevel parameter in java are is -2^32 to 2^32 -1. The default value for this parameter is 1

All values less than or equal to zero retrieve the same result.

Custom Filtering for Loggers

What are Filters in Logging?

Filters allow Log Events to be evaluated to determine if or how they should be published. A Filter will be called on the 'decide()' filter method and will return a Result, which is an Enum that has one of 3 values as below:

  • ACCEPT
  • DENY
  • NEUTRAL.

What do Filters in Logging solve?

Logging on the parent Logger can sometimes flood the logs with numerous statements, especially during heavy loads. If the need is only some specific logs for specific log events, specifically configuring every child Logger-Appender pair and their log-levels can be a cumbersome task. This also resulted in incorrect file rollovers when multiple File-Appenders of respective child Loggers tried to access the same Log file at the same time.

Solution to this problem - inducting the Log Filtering feature, where a single Appender can log events for a single Parent logger, and the irrelevant logs, not satisfying any of the Custom-Filter conditions will not be logged.

How to use the Custom Filter feature?

Appenders have to be configured to have a custom filter plugin to filter log messages according to its requirement by defining Custom-Filter class and plugging it into the concerned Appender's tag in the Configs.xml file present at <FMQ_Dir>/fmq/profiles/<profile_name>/conf.

Configuring Customed Appender Specific Filters

Customized Appender-specific Filters may be configured by following the below steps:

1. Define a Custom filter class

Filter Java Class should extend the abstract class 'fiorano.jms.log.FioranoLogFilter' which has an abstract method with the following signature:

Code Block
abstract public int decide(fiorano.jms.log.ILoggingEvent loggingEvent);

where
the return type will be "int" of any one of the below values:

  • org.apache.log4j.spi.Filter.ACCEPT
  • org.apache.log4j.spi.Filter.NEUTRAL
  • org.apache.log4j.spi.Filter.DENY

The method 'decide' and the argument <loggingEvent> encapsulates information about the log message, logger name, log level, thread name etc. which are necessary to take a decision either to log the message or to ignore.

Public APIs available to be used to write the conditions to accept/reject a logevent are:

getLevel()

For filtering based on Loglevel Integer[0-10],

Description: To get event's Log level
Return Type: int

getLoggerName()

For filtering based on Logger Name

Description: To get event's Logger Name

Return Type: java.lang.String

getRenderedMessage()

For filtering based on Log Message

Description: To get event's Log message

Return Type: java.lang.String

getThrowable()

For filtering based on Log's throwable

Description: To get event's throwable information

Return Type: java.lang.Throwable

Example:

Allows Log events with Logger name “Fiorano.FMQ.XYZ”, and rejects rest

Code Block
if(“Fiorano.FMQ.XYZ”.equals(<logEvent>.getLoggerName()))
return ACCEPT
return DENY

Sample Filter Class ''SampleFioranoLogFilter'';

Defines a filter that accepts LogEvents with Log level '4' for Logger name "Fiorano.FMQ.Services.Administrator".

Image Added
Figure 3: Sample Filter class

Tip

'SampleFioranoLogFilter' is present under <FMQ_DIR>/fmq/Utilities/LoggingSample for reference purpose.

2. Set the Classpath

The path of the Java class files of the Custome Filters defined must be placed in the FMQ classPath (<FMQ_DIR>/fmq/bin/fmq.conf)

3. Plug the Custom Filter class to the Appender

Configure the <FMQ_Dir>/fmq/profiles/<profile_name>/conf/Configs.xml file.

Under the tag "ClassName=fiorano.jms.log.def.config.AppenderConfig", set the filter plugin: CustomFilterClassName = “<FilterClassName>”
along with other appender configurations.

Image Added
Figure 4: Sample snapshot: Custom Filter class 'SampleFioranoLogFilter'

The server will instantiate an object using the fully-qualified class-name and use it as a filter while logging the messages to the respective log-appenders

Adaptavist ThemeBuilder EngineAtlassian Confluence