Skip to main content
Version: 7.2402.x.x RR

Logging

Log files

The log files of nevisMeta are stored in the following directory:

/var/opt/nevismeta/<instancename>/logs/

nevismeta.log

Contains all log messages of nevisMeta.

Configuration

Logging is configured by using the following command:

nevismeta config log

Logging layout patterns

The pattern of each in

RollingFile:
- name: FILE
fileName: "logs/nevismeta.log"
filePattern: "log/nevismeta.log.%i"
PatternLayout:
pattern: "%d\{ISO8601\} %20.20c\{1\}:%-4.5L \[%-8.8X\{LoginID\}\] (%t) %-6.6p%x%X\{indent\}%m%n"
Policies:
SizeBasedTriggeringPolicy:
size: 10MB
DefaultRollOverStrategy:
max: 10

The above example will prefix log lines with (in that order):

  • a date/time timestamp (%d),
  • the thread name (%t),
  • the trace group (%c)
  • the line number(%-4.5L)

It will also indent traces (%X{indent}).

Important trace groups

The following table describes the most important trace groups:

Log categoryDescription
ch.adnovumTracing of nevisMeta core code
ch.nevisTracing of Nevis subcomponents such as Ninja
ch.nevis.nevismetaTracing of nevisMeta code
ch.nevis.perfRequest performance report on trace level INFO
com.sun.jerseyDebugging of REST interface code
nevismeta.propertiesConfiguration facility, configuration dump
http.requestDebugging of HTTP requests (disabled by default)
http.responseDebugging of HTTP responses (disabled by default)
http.bodyDebugging of HTTP requests body (disabled by default)
http.sessionDebugging of HTTP sessions (disabled by default)
http.timeDebugging of HTTP timings (disabled by default)

Syslog

You may forward log messages to a local or remote syslog host by configuring a dedicated appender (in addition to the existing file appenders or by replacing them).

The original SyslogAppender delivered with log4j2 has 2 problematic points:

  • It is either using RFC 5424 formatting, where the implementation doesn't allow the prefixing of logs. (this is used in Nevis setups decode the component / logfile / instance information.)
  • The other formatting option truncates messages (1024 bytes maximum length). This is due to the message size limit of 1024 bytes defined in RFC 5424.

To workaround these problem you can use the(https://logging.apache.org/log4j/log4j-2.0/manual/appenders.html#SocketAppender). The issue is that this appender doesn't allow the configuration of the facility to be set to LOCAL3 for example.

  • The facility is actually a prefix on the message in the format of <code>. Which is than decoded by syslog to a facility. So the facility can be added by mapping all log levels to the same facility.
  • Note that each log severity needs a different code for the same facility, the mapping grid can be found here for example.
  • To send all log levels to LOCAL3 you need to define the following in the beginning of the message:
<%level{TRACE=159, DEBUG=159, INFO=158, WARN=156, ERROR=155, FATAL=153}>

Sample code

Configuration:
monitorInterval: 60
Appenders:
Socket:
- name: "SYSLOG_SERVER"
host: "localhost"
port: "514"
protocol: "UDP"
ThresholdFilter:
level: "INFO"
onMatch: "ACCEPT"
onMismatch: "DENY"
PatternLayout:
pattern: "<%level{TRACE=159, DEBUG=159, INFO=158, WARN=156, ERROR=155, FATAL=153}>nevisMeta/audit/default: %d\{ISO8601\} %40.40c\{1\}:%-4.5L \[%-8.8X\{LoginID\}\] (%t) %-6.6p%x%X\{indent\}%m%n"

...

Root:
level: TRACE
AppenderRef:
- ref: FILE
- ref: SYSLOG_SERVER