Logging
General Logging
Rubris uses http://logging.apache.org/log4j/2.x/[Log4j2 as its logging library.
In line with most Java applications, configuration is generally based on Class name and individual classes can be controlled using the normal Log4j2 mechanisms.
However, there are a couple of specialised logging behaviours that can be enabled/disabled outside the log4j2 config.
Engine-IO heartbeats
Engine-IO sends pings as a heartbeat mechanism and uses the responses as a means of identifying the responsiveness of the server.
The Ping logging is enabled by default (at info level) and can be enabled/disabled using the logPing attribute of the Engine-IO config as shown in the Configuraion Guide.
In addition to enabling, the ping log statements uses its own logger under the namespace “EIO_HEARTBEAT”. Using log4j2, this namespace can be steered to its own file to make tracking the timing behaviour more simple.
The format for the Ping logging is:
09:57:30.579 [NonAffinityThread–5] INFO EIO_HEARTBEAT - kpKTo6OktLS1FBQUzs7PJiYm Roundtrip:0 Last Inbound:1466845050578 Client:xxxxxx
The fields are: $SID Roundtrip:$PING_RECEIVED-$OUTPUT_TIME Last Inbound:$LAST_INBOUND_TIME client:$USER.toString
. The SID allows the log to be linked to the user session . The $PING_RECEIVED-$OUTPUT_TIME shows the time difference between when the ping was recieved and the time the response is being written . The $LAST_INBOUND_TIME shows the last inbound activity from the client . The $USER.toString outputs the string representation of the user (if one is present) that has been attached to the Client.
This logging can also be enabled/disabled at Runtime using the EngineIOPacketProcessor JMX options.
For applications with many clients and short polling times this can get very chatty in the logs and it may be preferable to turn this off in general use. The JMX control for the EngineIOPacketProcessor can still be used to retrieve a histogram of ping time distribution if required, but individual users cannot be identified from this.
HTTP Logging
Similarly to the Engine-IO heartbeat the HTTP requests can be logged directly. This is turned off by default but can be enabled using the httpLogging attribute of the HTTP config as shown in the Configuraion Guide.
In addition to enabling, the ping log statements uses its own logger under the namespace “HTTP”. Using log4j2, this namespace can be steered to its own file to make tracking the timing behaviour more simple.
This logging can also be enabled/disabled at Runtime using the EngineIOPacketProcessor JMX options.