com.wowza.wms.logging
Interface ILogNotify

All Known Implementing Classes:
LogNotifyCalculateIncremental

public 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 com.wowza.wms.logging.*;

public class NewLogFields 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", new String(sc_bytes));
        }
}

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

If on Windows, also edit [install-dir]/bin/WowzaMediaServerPro-Service.conf and add wrapper.java.additional.[n]=-Dcom.wowza.wms.logging.LogNotify=[full-path-to-your-ILogNotify-class] to the Java Additional Parameters section where [n] is the next number in the list of active parameters. For example for the class above if the last active additional parameter is 6, the entry would look like this:

wrapper.java.additional.7=-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


Method Summary
 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.
 

Method Detail

onLog

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.

Parameters:
level - log level as defined by (org.apache.log4j.Level)
comment - comment part of the log statement
stream - if stream category log message it's the source stream
category - 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