I have a custom module that extends from ModuleBase. When I write logging statements in the ‘onConnect’, on ‘HTTPSessionCreate’ etc, the fields c-ip and c-client-id are not logged.
My log4Jproperties for the console appender looks like this:
# Console appender
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=com.wowza.wms.logging.ECLFPatternLayout
log4j.appender.stdout.layout.Fields=x-severity,x-category,x-event,x-ctx,x-comment, c-ip, c-client-id
log4j.appender.stdout.layout.OutputHeader=false
log4j.appender.stdout.layout.QuoteFields=false
log4j.appender.stdout.layout.Delimeter=space
I added code to put the c-ip and c-client-id in the logging like this:
/**
* puts the client id and ip in the global log values to make sure these are logged
* @param clientID that is logged in the c-client-id field
* @param ip id address that is logged in the c-ip field
* @param message that is logged in the comment field
*/
private void logMessage(int clientID, String ip, String message) {
WMSLoggerFactory.putGlobalLogValue(WMSLoggerIDs.FD_c_ip, ip);
WMSLoggerFactory.putGlobalLogValue(WMSLoggerIDs.FD_c_client_id, new Integer(clientID));
logger.info(message);
//now remove the global log values again, otherwise all the log statements use this
WMSLoggerFactory.removeGlobalLogValue(WMSLoggerIDs.FD_c_ip);
WMSLoggerFactory.removeGlobalLogValue(WMSLoggerIDs.FD_c_client_id);
}
In the ‘onConnect’ message I call the logMessage method.
The logging shows this:
INFO server comment - onConnect - -
Note the - - in the logging statement
Does anybody have any clue why the c-ip and c-client-id don’t show up?
Kind regards
Lonneke