LogNotifyCalculateIncrementalpublic interface ILogNotify
ILogNotify: Interface to add custom fields to the Wowza Pro log files. To add your own custom log fields, define a class that implements this interface. The onLog method will be called each time the Wowza Pro server logs a message. Here is an example of a simple ILogNotify class that logs the current system time in milliseconds as a Long (systime-long) and as a String (systime-string).
package com.wowza.wms.plugin.newlogfields;
import org.apache.log4j.*;
import com.wowza.wms.logging.*;
import com.wowza.wms.stream.*;
public class LogNotifyDocs implements ILogNotify
{
public void onLog(Level level, String comment, IMediaStream stream, String category, String event, int status, String context)
{
long systime = System.currentTimeMillis();
WMSLoggerFactory.putGlobalLogValue("systime-long", new Long(systime));
WMSLoggerFactory.putGlobalLogValue("systime-string", systime+"");
}
}
Note: To get any of the values currently being logged use the logging API WMSLoggerFactory.getGlobalLogValue(WMSLoggerIDs.FD_*)
To add your class to Wowza Pro, compile your class into a .class file, bind the class into a .jar file and copy the .jar file into the Wowza Pro server /lib folder. Next, edit:
Add -Dcom.wowza.wms.logging.LogNotify=[full-path-to-your-ILogNotify-class] to the JAVA_OPTS. For example for the class above the JAVA_OPTS would look like:
Linux/OSX
JAVA_OPTS="-Xmx768M -Dcom.wowza.wms.logging.LogNotify=com.wowza.wms.plugin.newlogfields.NewLogFields"
Windows
JAVA_OPTS=-Xmx768M -Dcom.wowza.wms.logging.LogNotify=com.wowza.wms.plugin.newlogfields.NewLogFields
Next, edit [install-dir]/conf/log4j.properties and add the new field names to any log4j.appender.[appender-name].layout.Fields fields lists to which you want to log these values. For example:
log4j.appender.stdout.layout.Fields=x-severity,x-category,x-event,x-ctx,x-comment,systime-long,systime-string
| Modifier and Type | Method | Description |
|---|---|---|
void |
onLog(org.apache.log4j.Level level,
String comment,
IMediaStream stream,
String category,
String event,
int status,
String context) |
Called each time the server logs a message.
|
void onLog(org.apache.log4j.Level level,
String comment,
IMediaStream stream,
String category,
String event,
int status,
String context)
level - log level as defined by (org.apache.log4j.Level)comment - comment part of the log statementstream - if stream category log message it's the source streamcategory - log category as defined by WMSLoggerIDs.CAT_*event - log event as defined by WMSLoggerIDs.EVT_*status - log status (same as HTTP status field) as defined by WMSLoggerIDs.STAT_*context - log context value like stream name, vhost name, application name