Versions Compared

Key

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

Table of Contents

...

Let's consider configuring FIXAntenna since version 2.26 or FIXEdge since version 6.7 to send logs to the Splunk or Splunk Agent running on the localhost and listening on port 1514. The example configuration is as follows:

...

This configuration should be added to engine.properties (for FIXAntenna) or FIXEdge.properties (for FIXEdge). Here logs are sent to the two devices: File to write to a file on the local filesystem and Log4Cplus to send logs to Splunk.

Loggers

Logger name are identical to the Log Category. By default messages are processed to the logger with the Log Category and to the root logger. To configure the logging subsystem:

...

    • [LogLevel] is an optional parameter and can consist of the string values (Logging levels): 

      FATAL: Logs very severe error events that may lead the application to abort.

      ERROR: Logs only error conditions. The ERROR level provides the smallest amount of logging information.

      WARN: Logs information when an operation completes successfully but there are issues with the operation.

      INFO: Logs information about workflow. It generally explains how an operation occurs.

      DEBUG: Logs all of the details related to a specific operation. This is the highest level of logging.

      TRACE: Logs designated finer-grained informational events than DEBUG.

      Info

      Level priority : TRACE < DEBUG < INFO < WARN < ERROR < FATAL.

    • If a LogLevel value is specified, then the root LogLevel is set to the corresponding LogLevel. If no LogLevel value is specified, then the root LogLevel remains untouched.
    • appenderName contains the information on where to redirect the logging output (for example, console, file, syslog, etc.). The root logger can be assigned to the multiple appenders. Each appenderName (separated by commas) will be added to the root logger. 

...

This option allows to avoid duplication to the root logger

Code Block
languagebash
logger.additivity.<nameOfLogger> = false

...

Conversion Character

Effect

c

Category LogSystem
Used to output the logger of the logging event. The logger conversion specifier can be optionally followed by precision specifier, that is a decimal constant in brackets.

If a precision specifier is given, then only the corresponding number of right most components of the logger name will be printed. By default the logger name is printed in full.

For example, for the logger name "a.b.c" the pattern c{2} will output "b.c".

d

Used to output the date of the logging event in UTC.

The date conversion specifier may be followed by a date format specifier enclosed between braces. For example, %d{%H:%M:%s} or %d{%d %b %Y %H:%M:%s}. If no date format specifier is given then %d{%d %m %Y %H:%M:%s} is assumed.

The Following format options are possible:

%a – Abbreviated weekday name

%A – Full weekday name

%b – Abbreviated month name

%B – Full month name

%c – Standard date and time string

%d – Day of month as a decimal(1-31)

%H – Hour(0-23)

%I – Hour(1-12)

%j – Day of year as a decimal(1-366)

%m – Month as decimal(1-12)

%M – Minute as decimal(0-59)

%p – Locale's equivalent of AM or PM

%q – milliseconds as decimal(0-999) – Log4CPLUS specific

%Q – fractional milliseconds as decimal(0-999.999) – Log4CPLUS specific

%S – Second as decimal(0-59)

%U – Week of year, Sunday being first day(0-53)

%w – Weekday as a decimal(0-6, Sunday being 0)

%W – Week of year, Monday being first day(0-53)

%x – Standard date string

%X – Standard time string

%y – Year in decimal without century(0-99)

%Y – Year including century as decimal

%Z – Time zone name

%% – The percent sign

Please refer to the documentation for the strftime() function in the <ctime> header for more information - http://man7.org/linux/man-pages/man3/strftime.3.html.

Example for ISO 8601 :
%d{%FT%T.%q}Z              -    2018-04-03T09:03:44.806Z
%d{%FT%T.%q}+00:00     -    2018-04-03T09:03:44.806+00:00

D

Used to output the date of the logging event in local time.

All of the above information applies.

Example for ISO 8601 :
%D{%FT%T.%q%z}                               -    2018-04-03T09:03:44.806-0400
%D{%FT%T.%q}%.-3D{%z}:%.2D{%z}  -    2018-04-03T09:03:44.806-04:00

E

Used to output the value of a given environment variable. The name of is supplied as an argument in brackets. If the variable does exist then empty string will be used.

For example, the pattern E{HOME} will output the contents of the HOME environment variable.

F

Used to output the file name where the logging request was issued.

NOTE: Unlike log4j, there is no performance penalty for calling this method.

h

Used to output the hostname of this system (as returned by gethostname(2)).

NOTE: The hostname is only retrieved once at initialization.

H

Used to output the fully-qualified domain name of this system (as returned by gethostbyname(2) for the hostname returned by gethostname(2)).

NOTE: The hostname is only retrieved once at initialization.

l

Equivalent to using "%F:%L"

NOTE: Unlike log4j, there is no performance penalty for calling this method.

m

Used to output the application supplied message associated with the logging event.

n

Outputs the platform dependent line separator character or characters.

p

Used to output the LogLevel of the logging event.

r

Used to output miliseconds since program start of the logging event.

t

Used to output the thread ID of the thread that generated the logging event. (This is either pthread_t value returned by pthread_self() on POSIX platforms or thread ID returned by GetCurrentThreadId() on Windows.)

T

Used to output alternative name of the thread that generated the logging event.

i

Used to output the process ID of the process that generated the logging event.

"%%"

The sequence "%%" outputs a single percent sign.

Troubleshooting

Using SocketTCPAppender. Standard error output has errors on timeout sending.

Error log:

Code Block
log4cplus:ERROR log4cplus::SocketTCPAppender127.0.0.1:1514) : Timeout sending ( 100000 us ). Starting reconnection to server. Next events will be skipped.

Description

Splunk server is a slow consumer. Appender disconnects connection after a timeout to avoid blocking threads of FIXEdge.

Solution

Set a larger value for property sendTimeout or use value '0' to switch off sending timeout.

Warning

Disabling timeout or large values for it means that logging has more priority than handling FIX traffic.