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.
Automatic reloading of logging configuration
nevisMeta supports runtime reconfiguration of the logging subsystem with log4j2.
monitorInterval: 60
Logging layout patterns
The pattern of each individual line logged by log4j can be customized in the layout element of an appender. See the following example:
RollingFile:
- name: FILE
fileName: "logs/nevismeta.log"
filePattern: "log/nevismeta.log.%i"
PatternLayout:
pattern: "%d{ISO8601} %40.40c{1}:%-4.5L [%-8.8X{LoginID}] (%t) %-6.6p%x%X{indent}%m%n"
Policies:
SizeBasedTriggeringPolicy:
size: 10MB
DefaultRollOverStrategy:
max: 10
Filters:
ThresholdFilter:
level: TRACE
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 list shows the most important general trace groups, in combination with relevant debugging use cases:
Full trace analysis
Root:
level: DEBUGPerformance report, one per request
- name: ch.nevis.perf
level: INFOnevisMeta configuration, configuration dump with
DEBUG
- name: nevismeta.properties
level: DEBUGCore code
- name: ch.adnovum
level: WARN
- name: ch.nevis
level: WARN
- name: ch.nevis.nevismeta
level: INFODebugging REST interface
- name: org.eclipse.jetty.server.handler.EventsHandler
level: DEBUG
- name: com.zaxxer.hikari
level: INFO
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}>
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