CSharpTest.Net
EventLogName Property
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Logging Assembly > (Global) Namespace > Log.Config Class : EventLogName Property

Glossary Item Box

Sets the event log name we will write events to.

Syntax

Visual Basic (Declaration) 
Public Shared Property EventLogName As String
C# 
public static string EventLogName {get; set;}

Example

Log/Test/ConfigTest.cs

C#Copy Code
string origLog = Log.Config.EventLogName;
string origSrc = Log.Config.EventLogSource;

Log.Config.EventLogName = "Dua!";
Assert.AreEqual("Dua!", Log.Config.EventLogName);
Log.Config.EventLogSource = "Yea.";
Assert.AreEqual("Yea.", Log.Config.EventLogSource);
try
{
    Log.Config.EventLogName = "Application";
    Log.Config.EventLogSource = "MsiInstaller";

    Log.Config.Output = LogOutputs.EventLog;
    Log.Config.SetOutputLevel(LogOutputs.EventLog, LogLevels.Info);
    Log.Write("Logging.Test has hijacked your MsiInstaller source for testing use.  Ignore this message.");
}
finally
{
    RestoreLogState();
    Log.Config.EventLogName = "Application";
    Log.Config.EventLogSource = "Logging.Test";
}
VB.NETCopy Code
Dim origLog As String = Log.Config.EventLogName
Dim origSrc As String = Log.Config.EventLogSource

Log.Config.EventLogName = "Dua!"
Assert.AreEqual("Dua!", Log.Config.EventLogName)
Log.Config.EventLogSource = "Yea."
Assert.AreEqual("Yea.", Log.Config.EventLogSource)
Try
    Log.Config.EventLogName = "Application"
    Log.Config.EventLogSource = "MsiInstaller"

    Log.Config.Output = LogOutputs.EventLog
    Log.Config.SetOutputLevel(LogOutputs.EventLog, LogLevels.Info)
    Log.Write("Logging.Test has hijacked your MsiInstaller source for testing use.  Ignore this message.")
Finally
    RestoreLogState()
    Log.Config.EventLogName = "Application"
    Log.Config.EventLogSource = "Logging.Test"
End Try

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys