IAdmGeneralLog

The IAdmGeneralLog interface represents the general log that provides access to all Adaxes log records.

Inheritance: IUnknown

Properties

  • Property

  • Description

  • StartDateTime

  • Gets or sets the date and time starting from which log records are requested.

  • EndDateTime

  • Gets or sets the date and time up to which log records are requested.

  • Log

  • Gets the general log.

Details

StartDateTime

Gets or sets the date and time starting from which log records are requested.

  • Type:
  • DateTime
  • Access:
  • Read/Write

EndDateTime

Gets or sets the date and time up to which log records are requested.

  • Type:
  • DateTime
  • Access:
  • Read/Write

Log

Gets the general log.


Examples

The following code sample outputs log records generated during last 30 days.

PowerShell
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$numDays = 30

# Connect to the Adaxes service.
$ns = New-Object("Softerra.Adaxes.Adsi.AdmNamespace")
$service = $ns.GetServiceDirectly("localhost")

# Bind to the directory object representing the general log.
$path = $service.Backend.GetConfigurationContainerPath("ServiceLog")
$serviceLog = $service.OpenObject($path, $null, $null, 0)
$generalLog = $serviceLog.GeneralLog

# Get the log records.
$generalLog.StartDateTime = (Get-Date).AddDays(-$numDays)
$generalLog.EndDateTime = Get-Date
$log = $generalLog.Log
$records = $log.GetPage(0)

# Output the log records.
foreach ($record in $records)
{
    Write-Host "Start Time:" $record.StartTime
    Write-Host "Completion Time:" $record.CompletionTime
    Write-Host "Initiator:" $record.Initiator.Name
    Write-Host "Target Object:" $record.TargetObjectName
    Write-Host "Target Object Type:" $record.TargetObjectType
    Write-Host "Operation:" $record.Description
    Write-Host
}
C#
using System;
using Interop.Adsi.Logging;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;

class Program
{
    static void Main(string[] args)
    {
        const int numDays = 30;

        // Connect to the Adaxes service.
        AdmNamespace ns = new AdmNamespace();
        IAdmService service = ns.GetServiceDirectly("localhost");

        // Bind to the directory object representing the general log.
        string path = service.Backend.GetConfigurationContainerPath("ServiceLog");
        IAdmServiceLog serviceLog = (IAdmServiceLog)service.OpenObject(path, null, null, 0);
        IAdmGeneralLog generalLog = serviceLog.GeneralLog;

        // Get the log records.
        generalLog.StartDateTime = DateTime.Now.AddDays(-numDays);
        generalLog.EndDateTime = DateTime.Now;
        IAdmLog log = generalLog.Log;
        IAdmLogRecords records = log.GetPage(0);

        // Output the log records.
        foreach (IAdmLogRecord record in records)
        {
            Console.WriteLine("Start Time: " + record.StartTime);
            Console.WriteLine("Completion Time: " + record.CompletionTime);
            Console.WriteLine("Initiator: " + record.Initiator.Name);
            Console.WriteLine("Target Object: " + record.TargetObjectName);
            Console.WriteLine("Target Object Type: " + record.TargetObjectType);
            Console.WriteLine("Operation: " + record.Description);
            Console.WriteLine(string.Empty);
        }
    }
}

Requirements

Minimum required version: 2009.1

See also