eventlog

How to direct the EventLogTraceListener to create in a specific Log

The following listener will create an event entry when the Trace.WriteLine is called. If the source does not exist he will create it in the default log channel which is 'Application' . I want to specify another default Log channel but after searching for 45 minutes i don't seem to find the solution. Any ideas? <configuration> <syst...

Why is services.exe changing the Event Log retention policy?

I have a server running Windows 2003 R2 Enterprise Ediditon with Service Pack 2. I reset the Application Event Log Retention policy within EventVwr (right-click on Application, click the radio button next to "Overwrite events as needed".) A few hours later, somehow this setting got reset to "Overwrite events older than 7 days." This happ...

Writing Exceptions to the Windows Log File

I'd like to catch my exceptions and log them in the Windows log file. How do I go about opening and writing to the Windows log? ...

SQL Server 2005 & the Windows Event Log

I'm running a SQL Server 2005 Standard. I got several alerts I need to react on. So I created these alerts, but they never appear so that the jobs depending on them are never run. I found out that for alerts it is necessary that the SQL Server writes to the Windows Event Log, but this is not happening at all. Every source tells me that ...

Exceptions, Global.asax, and the eventlog.

I would like to log unhandled exceptions from the global.asax to the Application eventlog. However, I've noticed that IIS is already logging these unhandled exceptions as warnings. Is there a way to suppress these messages since I'm planning on logging them myself or do you think it’s reasonable to have both entries there (the event lo...

C#: Eventlog, impersonation and Access Denied Win32Exception

Hi, I am using a dedicated account (with SDDL policy) to write event log entries to a custom event log. For this I use WindowsImpersonationContext and obtain a token with LogonUser: WindowsIdentity impersonationIdentity = new WindowsIdentity(ptr); WindowsImpersonationContext impersonationContext = impersonationIdentity.Impe...

Problem in accessing/writing to EventLog

I'm working with some old code (and frankly I don't know half of what it does) trying to move it over to IIS7. One of the problems I see is that I get this error: [SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.] If I go manually to HKEY_LOCAL_MACHINE\SYSTEM\...

System.Security.SecurityException when writing to Event Log

I’m working on trying to port an ASP.NET app from Server 2003 (and IIS6) to Server 2008 (IIS7). When I try and visit the page on the browser I get this: Server Error in ‘/’ Application. Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the ...

Write to Event Log Windows Scheduled Task

Hi all, I have a console app that will be running through a scheduled task and what i'd like to do is have it write to an Event Log in a catch block. I've tried using EventLog.WriteEntry("My App Name","Error Message - " ex.ToString() ); but for some reason it is not writing the error. Am i doing something wrong? Thanks ...

The Event Log File is full

Hi all, I keep getting this error message when trying to write to the Event log from a console app. Here's how i write to it public static void WriteToEventLog(Exception ex) { string mySource = "Export Task"; if (!EventLog.SourceExists(mySource)) EventLog.CreateEventSource(mySource, "Application"); ...

Insert all Internal Server Errors into windows event log

Hello, I have developed a small WCF service which handles HTTP request. I want to be aware of every fault that happens: everything that causes 500 Internal Server Error from the contracts view everything that causes a CommunicationException from the bindings view (I've written a custom one but am using standard ones also) The err...

C# Service Timeout (30000 milliseconds) waiting for a transaction response in event viewer

I have a C# service. It is a memory and CPU pig. It will run all night, moving data in the database. Around 7 am it post to the event viewer, repeatedly, Timeout (30000 milliseconds) waiting for a transaction response from the ServName service. Then it stops unexpectedly. Does anyone have input as to what this message means, o...

How to use VB.NET to query remote server event logs?

I am working on creating a web app that will query event logs on internal servers for events using a specific ID. Since most of the servers are running Windows Server 2003, I cannot use the preferred System.Diagnostics.Eventing.Reader method that I was hoping to use. I've seen the mention of using WMI, but would like to avoid this if p...

UAC gives me fits!

The code I am currently working on runs on Windows Server 2003, but needs to be able to write to EventLogs on multiple machines. I am coding in C#, using VS2008 Pro, and .NET Framework 3.5. The code itself is relatively simple (thanks to the framework): using (EventLog remoteEvtLog = new EventLog(LogName, HostName, EventSource)) { ...

SQL Server spams in event log on every call of extended proc

I've wrote an extended stored procedure in dll. Every time I call it, SQL Server wrote useless "Information" in Windows Event Log (Windows Logs\Application): Event Type: Information Event Source: MSSQLSERVER Event Category: (2) Event ID: 17055 Date: 04.09.2009 Time: 14:54:57 User: N/A Computer: 4STORYTESTDB Description: 8...

RegisterEventSource returns NULL, error code is zero

Sometimes when I call RegisterEventSource(), it returns NULL. GetLastError() returns 0. The event log is on a remote machine in the same domain, and the user is an admin in the domain. This happens several times in a row on different machines (but with the log on the same machine), then stops happening. Why can this happen? All machi...

Event Log written as Warning instead of Error

I'm using EntLib 4.1 for logging. When I have an exception handled in the Application_Error of Global.asax.cs, I log the error with a category of 'Error'. I assumed that the event log type would be 'Error', but instead the event log entry is written with a type of 'Warning' and category of 'Web Event'. public static void Write(Exception...

Powershell get-eventlog message column is too short

When using powershell to retrieve info about events Message column gets trimmed and is too short: Index Time Type Source EventID Message ----- ---- ---- ------ ------- ------- 2 Sep 18 12:50 Info yaddayadda 0 Class: Controllers.BasketController... 1 Sep 18 12:...

Does one need to manually create a Windows event log source when installing a Windows service.

I have developed a Windows service in C#. I have created a installer with Visual Studio 2008, which installs the Windows service. Everything is good so far. I want to make sure that the event source has been created at install time, so that any error/exception conditions at runtime are correctly logged to the Windows event log. Does the...

Silverlight Event Log in Isolated Storage

Has anyone written an event log that uses Isolated Storage in Silverlight 3? Any suggestions on implementing one? Specific questions: Should I keep a stream writer open, or should I open,write, and close for each entry? How should I remove items from the log atomically? ...