Event Log Writer - High Performance Event Logging

Last Update
18 June 2013
Regular License
$6
Extended License
$30
Sales
7

The Event Log Writer .NET component provides you with a simple and robust method to write to the event log. One of the major highlight of this component is writing to the event log at defined intervals on a background thread. This ensures that the performance of your applications remains at peak! This component also offers high performance writes using cached writers – creates the writers for you ensuring that the correct writer is always used without the overhead of creating a new one all the time.

In what applications can I use this?

This component is built using the .NET 2.0 Framework which means in can be used in all .NET applications that are using the 2.0 framework or newer. This includes .NET 2.0, 3.0, 3.5, 4.0, & 4.5+. This component can be used all types of .NET applications including:

Console Windows Forms WPF ASP.NET ASP.NET MVC Windows Services Web Services (XML/WCF)

Is it reliable?

Deadlocks – thread safety through locking avoids deadlocks Memory leaks – clean up through the dispose method & consider problems such as the lapsed listener Exceptions leaks – Exception handling through to ensure undesired termination of the application does not occur ASP.NET ThreadPool & Service Unavailable – Give control of whether ThreadPool threads are used or not (by default no). This ensures that threads are not taken away from high availability ASP.NET applications causing the dreaded “Service Unavailable” Task/Background work structure – Flexible mechanism for creating complex background operations Strong name signed – Allows referencing in other application that are strong named signed & also installed into the Global Assembly Cache (GAC)

What do you get in the package?

.NET Assembly with Strong Name Signature Debug file (PDB) XML comments (Intellisense) Console application Demo Project A comprehensive help file documenting full usage API Documentation C# Source Code Visual Studio 2010 SP1 & 2012 Solution Support

Support

Ask any questions or suggest features at support.avantprime.com!

How to use this in my application?

Write to the event log

Console.WriteLine("Writing two entries to the event log..."); var writerSetting = new EventLogWriterSetting(LogName, EventSource); using (var writer = new EventLogWriter(writerSetting)) { for (int i = 0; i < 2; i++) { var message = string.Format("EventWriter message on {0}", DateTime.Now); Console.WriteLine(writer.WriteToLog(message, EventLogEntryType.Information) ? String.Format("Successfully wrote to the event log. Message: {0}", message) : "Unsuccessful attempt to write to the event log." ); } }

Write to the event log using cached writers

EventLogWriterCache.WriteToLog(DateTime.Now.ToString(), LogName, EventSource, EventLogEntryType.Information);

Write to the event log using the queue mechanism

Console.WriteLine("Configuring QueueWriter to write every 3 seconds starting after 5 seconds."); var writerQueueSetting = new EventLogWriterQueueSetting(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(5));

EventLogWriterQueue.Setting = writerQueueSetting; var writerQueue = new EventLogWriterQueue(LogError); var message = new EventLogWriterQueueMessage ( String.Format("Queue message: {0}", DateTime.Now.ToString(CultureInfo.InvariantCulture)), LogName, EventSource, EventLogEntryType.Information ); writerQueue.Log(message);

Console.WriteLine("Polling every four seconds for new entries in the event log..."); for (int i = 0; i < 4; i++) { TestEventLogReader(); Thread.Sleep(4000); }

// Only dispose after your queue is empty while (!EventLogWriterQueue.IsQueueEmpty) { Thread.Sleep(1000); }

writerQueue.Dispose();