Interface ILogNotify

All Known Implementing Classes:
LogNotifyCalculateIncremental

public interface ILogNotify

ILogNotify: Interface to add custom fields to the Wowza Streaming Engine 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 Streaming Engine 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 Streaming Engine, compile your class into a .class file, bind the class into a .jar file and copy the .jar file into the Wowza Streaming Engine server /lib folder. Next, edit:

  • [install-dir]/conf/Tune.xml

Add -Dcom.wowza.wms.logging.LogNotify=[full-path-to-your-ILogNotify-class] to the VMOptions in Tune.xml. For example for the class above the VMOption would look like:

 
<VMOption>-Dcom.wowza.wms.logging.LogNotify=com.wowza.wms.plugin.newlogfields.NewLogFields</VMOption>

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

    Modifier and Type
    Method
    Description
    default void
    onLog(WMSLogger logger, WMSLoggerEvent logEvent)
    Called each time the server logs a message.
    default void
    onLog(org.apache.logging.log4j.Level level, String comment, IMediaStream stream, String category, String event, int status, String context)
    Called each time the server logs a message.
  • Method Details

    • onLog

      default void onLog(org.apache.logging.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.logging.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
    • onLog

      default void onLog(WMSLogger logger, WMSLoggerEvent logEvent)
      Called each time the server logs a message.
      Parameters:
      logger - logger being used
      logEvent - log event data