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 prefixes log lines with the following elements (in that order):
- a date/time timestamp (%d),
- the thread name (%t),
- the trace group (%c)
- the line number(%-4.5L)
It also indents traces (%X{indent}).
Important trace groups The following table describes the most important trace groups:
Log category | Description |
---|---|
ch.adnovum | Tracing of nevisMeta core code |
ch.nevis | Tracing of Nevis subcomponents such as Ninja |
ch.nevis.nevismeta | Tracing of nevisMeta code |
ch.nevis.perf | Request performance report on trace level INFO |
com.sun.jersey | Debugging of REST interface code |
nevismeta.properties | Configuration facility, configuration dump |
http.request | Debugging of HTTP requests (disabled by default) |
http.response | Debugging of HTTP responses (disabled by default) |
http.body | Debugging of HTTP requests body (disabled by default) |
http.session | Debugging of HTTP sessions (disabled by default) |
http.time | Debugging of HTTP timings (disabled by default) |
jcan.Op | Trace information about SOAP method invocations (set to INFO by default) |
Syslog
You may forward log messages to a local or remote syslog host by configuring a dedicated appender. This can replace the existing file appenders, or it can be configured in addition to them.
The original SyslogAppender delivered with log4j2 have the following limitations regarding formatting:
- If you use RFC 5424 formatting, the implementation does not allow the prefixing of logs. Prefixes are used in Nevis setups to decode the component, log file, or instance information.
- If you do not use RFC 5424 formatting, messages are truncated to a maximum length of 1024 bytes. This is due to the message size limit of 1024 bytes defined in RFC 5424.
To work around these limitations, you can use the SocketAppender. However, SocketAppender does not allow the configuration of the facility to be set to LOCAL3. The following points help you apply the workaround despite this limitation:
- The facility is a prefix on the message in the format of
<code>
, that is decoded by syslog to a facility. You can add the facility 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.
- 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