Share via


WMS Client Logging Plug-in Properties

The WMS Client Logging plug-in included with Windows Media Services is an event handler plug-in that monitors event notices raised by the server and saves the information gathered to a log file. For more information about administering the WMS Client Logging plug-in and the log file it creates, see Windows Media Services Help.

You can use the IWMSLoggingAdmin interface to configure the following properties for the plug-in.

Property

Description

CurrentLogFileName

Retrieves the name of the current log file.

Cycle

Retrieves a value indicating how often the log file cycles.

Dirty

Retrieves a Boolean value indicating whether the plug-in properties have changed.

LoggedEvents

Specifies and retrieves an enumeration value indicating the type of connection for which events are logged.

MaxSize

Specifies and retrieves the maximum permitted size of the log file.

RoleFilter

Specifies and retrieves the name of the role attribute in a playlist that will be used when filtering logged events.

Template

Specifies and retrieves the log file template path.

UseBuffering

Specifies and retrieves a Boolean value that indicates whether logging data is buffered before it is flushed to the log file.

UseLocalTime

Specifies and retrieves a Boolean value indicating whether local time is used.

UseUnicode

Specifies and retrieves a Boolean value indicating whether the log file contains Unicode or ANSI text.

V4Compat

Specifies and retrieves a Boolean value indicating whether log files are created in a format compatible with Windows Media Services version 4 and version 4.1.

The IWMSLoggingAdmin interface also exposes the following methods.

Method

Description

CycleNow

Forces a log file cycle regardless of the value set by any previous invocation of the Cycle property

ExpandTemplate

Retrieves the expanded path of the template.

Flush

Causes all data currently in the buffer to be flushed to the log file.

IsPathValid

Validates the path to the log file.

The following examples illustrate how to configure properties for the WMS Client Logging plug-in.

Visual Basic .NET Example

Imports Microsoft.WindowsMediaServices.
Imports System.Runtime.InteropServices

Private Sub SetClientLogPluginProps() 

' Declare variables.
Dim Server As WMSServer
Dim Plugin As IWMSPlugin
Dim LogAdmin As IWMSLoggingAdmin

Try

    ' Create a new WMSServer object.
    Server = New WMSServer()

    ' Retrieve the IWMSPlugin object for the 
    ' WMS Client Logging plug-in.
    Plugin = Server.EventHandlers("WMS Client Logging")

    ' Retrieve the administrative interface for the plug-in.
    LogAdmin = Plugin.CustomInterface()

    ' Set the current log file name template.
    LogAdmin.Template = "%SystemRoot%\System32\LogFiles\WMS\<V>\WMS_<Y><m><d>.log"

    ' Specify how often the log file is cycled.
    LogAdmin.Cycle = WMS_LOG_CYCLE_TYPE.WMS_LOG_CYCLE_DAY

Catch excCom As COMException
    ' TODO: Handle COM exceptions.
Catch exc As Exception
    ' TODO: Handle exceptions here.
Finally
    ' TODO: Perform clean-up here.
End Try

End Sub 

C# Example

using Microsoft.WindowsMediaServices.Interop; 
using System.Runtime.InteropServices;

// Declare variables.
WMSServer Server;
IWMSPlugin Plugin;
IWMSLoggingAdmin LogAdmin;

try
{
    // Create a new WMSServer object.
    Server = new WMSServerClass();
    
    // Retrieve the IWMSPlugin object for the 
    // WMS Client Logging plug-in.
    Plugin = Server.EventHandlers["WMS Client Logging"];
    
    // Retrieve the administrative interface for the plug-in.
    LogAdmin = (IWMSLoggingAdmin)Plugin.CustomInterface;
    
    // Set the current log file name template.
    LogAdmin.Template = "%SystemRoot%\\System32\\LogFiles\\WMS\\<V>\\WMS_<Y><m><d>.log";
    
    // Specify how often the log file is cycled.
    LogAdmin.Cycle = WMS_LOG_CYCLE_TYPE.WMS_LOG_CYCLE_DAY;
    
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception exc)
{
    // TODO: Handle exceptions here.
}
finally
{
    // TODO: Perform clean-up here.
}

C++ Example

#include <windows.h>
#include <atlbase.h>

// To access system plug-in interfaces, the
// type library must be imported as shown.
#import "WMSServerTypeLib.dll" no_namespace named_guids \
                               raw_interfaces_only

// Declare variables and interface pointers.
IWMSServer*              pServer = NULL;
IWMSPlugins*             pPlugins = NULL;
IWMSPlugin*              pPlugin = NULL;
IDispatch*               pDispatch = NULL;
IWMSLoggingAdmin*        pLogAdmin = NULL;
CComVariant              varIndex;
CComBSTR                 bstrTemplate;
HRESULT                  hr = S_OK;

// Initialize the COM library and retrieve a pointer
// to an IWMSServer interface.
hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_WMSServer,
                      NULL,
                      CLSCTX_ALL,
                      IID_IWMSServer,
                      (void **)&pServer);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to an IWMSPlugins interface
// containing the collection of event handler plug-ins.
hr = pServer->get_EventHandlers(&pPlugins);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to the IWMSPlugin interface for the
// WMS Client Logging plug-in.
varIndex = "WMS Client Logging";
hr = pPlugins->get_Item(varIndex, &pPlugin);
if (FAILED(hr)) goto EXIT;

// Retrieve an IDispatch pointer to the administration
// interface for the plug-in.
hr = pPlugin->get_CustomInterface(&pDispatch);
if (FAILED(hr)) goto EXIT;

// Call QueryInterface() to retrieve a pointer to the
// IWMSLoggingAdmin interface.
hr = pDispatch->QueryInterface(IID_IWMSLoggingAdmin, (void**)&pLogAdmin);
if (FAILED(hr)) goto EXIT;

// Set the current log file name template.
bstrTemplate = "%SystemRoot%\\System32\\LogFiles\\WMS\\<V>\\WMS_<Y><m><d>.log";
hr = pLogAdmin->put_Template(bstrTemplate);
if (FAILED(hr)) goto EXIT;

// Set the enumeration value indicating
// how often the log file is cycled.
hr = pLogAdmin->put_Cycle(WMS_LOG_CYCLE_DAY);
if (FAILED(hr)) goto EXIT;

EXIT:
    // TODO: Release temporary COM objects and uninitialize COM.

See Also

Reference

IWMSLoggingAdmin Interface

IWMSLoggingAdmin Object (C#)

IWMSLoggingAdmin Object (Visual Basic .NET)

Concepts

Programming System Plug-in Properties