G
Guest
I just downloaded the June 2005 release and I want to set up basic logging to
log problems such as exceptions.
I have created a category named Exceptions with the following:
<category name="Exceptions">
<destinations>
<destination name="Event Log Destination" sink="Event Log Sink"
format="Text Formatter" />
</destinations>
</category>
Next I created a Sink to poit to the event log:
<sinks>
<sink xsi:type="EventLogSinkData" name="Event Log Sink"
eventLogName="Application" eventSourceName="DTS Logging" />
</sinks>
That is it now all I want to do is write the error to the application event
log. I attempt to do so with the following:
catch (Exception ex)
{
LogEntry log = new LogEntry();
log.EventId = 1;
log.Message = "test";
log.Category = "Exceptions";
log.Priority = 2;
Logger.Write(log);
}
The problem is I get the following warningin the event log:
Error logging with 'Event Log Sink' sink from configuration. The default log
sink will be used instead to process the message.
Summary for Enterprise Library Distributor Service:
======================================
-->
Message:
Timestamp: 8/3/2005 8:55:36 AM
Message: test
Category: Exceptions
Priority: 2
EventId: 1
Severity: Unspecified
Title:
Machine: EXTREMEDEV
App Domain: /LM/W3SVC/1/Root/DefenseTravelSystem-8-127675689321875000
ProcessId: 1912
Process Name: \\?\C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_wp.exe
Thread Name:
Win32 ThreadId:3280
Extended Properties:
--> MachineName: EXTREMEDEV
--> TimeStamp: 8/3/2005 1:55:37 PM
--> FullName: Microsoft.Practices.EnterpriseLibrary.Common, Version=1.1.0.0,
Culture=neutral, PublicKeyToken=null
--> AppDomainName: /LM/W3SVC/1/Root/DefenseTravelSystem-8-127675689321875000
--> WindowsIdentity: EXTREMEDEV\ASPNET
Exception Information Details:
======================================
Exception Type: System.Security.SecurityException
PermissionType: NULL
PermissionState: NULL
GrantedSet: NULL
RefusedSet: NULL
Message: Requested registry access is not allowed.
TargetSite: Microsoft.Win32.RegistryKey OpenSubKey(System.String, Boolean)
HelpLink: NULL
Source: mscorlib
StackTrace Information Details:
======================================
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at System.Diagnostics.EventLog.FindSourceRegistration(String source,
String machineName, Boolean readOnly)
at System.Diagnostics.EventLog.SourceExists(String source, String
machineName)
at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType type, Int32 eventID, Int16 category)
at
Microsoft.Practices.EnterpriseLibrary.Logging.Sinks.EventLogSink.SendMessageCore(LogEntry logEntry)
at
Microsoft.Practices.EnterpriseLibrary.Logging.Sinks.LogSink.SendMessage(LogEntry entry)
at
Microsoft.Practices.EnterpriseLibrary.Logging.Distributor.LogDistributor.DistributeLogEntry(LogEntry log, CategoryData category)
As well I get the the following information entry:
An error occurred while the Distributor was processing the message. Please
check your configuration files for errors or typos. Verify that your sinks
are reachable (queues exist, permissions are set, database exists, etc...)
Sink failed because: System.Security.SecurityException: Requested registry
access is not allowed.
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at System.Diagnostics.EventLog.FindSourceRegistration(String source,
String machineName, Boolean readOnly)
at System.Diagnostics.EventLog.SourceExists(String source, String
machineName)
at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType type, Int32 eventID, Int16 category)
at
Microsoft.Practices.EnterpriseLibrary.Logging.Sinks.EventLogSink.SendMessageCore(LogEntry logEntry).
Message:
Timestamp: 8/3/2005 8:55:36 AM
Message: test
Category: Exceptions
Priority: 2
EventId: 1
Severity: Unspecified
Title:
Machine: EXTREMEDEV
App Domain: /LM/W3SVC/1/Root/DefenseTravelSystem-8-127675689321875000
ProcessId: 1912
Process Name: \\?\C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_wp.exe
Thread Name:
Win32 ThreadId:3280
Extended Properties:
For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.
Any ideas?
log problems such as exceptions.
I have created a category named Exceptions with the following:
<category name="Exceptions">
<destinations>
<destination name="Event Log Destination" sink="Event Log Sink"
format="Text Formatter" />
</destinations>
</category>
Next I created a Sink to poit to the event log:
<sinks>
<sink xsi:type="EventLogSinkData" name="Event Log Sink"
eventLogName="Application" eventSourceName="DTS Logging" />
</sinks>
That is it now all I want to do is write the error to the application event
log. I attempt to do so with the following:
catch (Exception ex)
{
LogEntry log = new LogEntry();
log.EventId = 1;
log.Message = "test";
log.Category = "Exceptions";
log.Priority = 2;
Logger.Write(log);
}
The problem is I get the following warningin the event log:
Error logging with 'Event Log Sink' sink from configuration. The default log
sink will be used instead to process the message.
Summary for Enterprise Library Distributor Service:
======================================
-->
Message:
Timestamp: 8/3/2005 8:55:36 AM
Message: test
Category: Exceptions
Priority: 2
EventId: 1
Severity: Unspecified
Title:
Machine: EXTREMEDEV
App Domain: /LM/W3SVC/1/Root/DefenseTravelSystem-8-127675689321875000
ProcessId: 1912
Process Name: \\?\C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_wp.exe
Thread Name:
Win32 ThreadId:3280
Extended Properties:
--> MachineName: EXTREMEDEV
--> TimeStamp: 8/3/2005 1:55:37 PM
--> FullName: Microsoft.Practices.EnterpriseLibrary.Common, Version=1.1.0.0,
Culture=neutral, PublicKeyToken=null
--> AppDomainName: /LM/W3SVC/1/Root/DefenseTravelSystem-8-127675689321875000
--> WindowsIdentity: EXTREMEDEV\ASPNET
Exception Information Details:
======================================
Exception Type: System.Security.SecurityException
PermissionType: NULL
PermissionState: NULL
GrantedSet: NULL
RefusedSet: NULL
Message: Requested registry access is not allowed.
TargetSite: Microsoft.Win32.RegistryKey OpenSubKey(System.String, Boolean)
HelpLink: NULL
Source: mscorlib
StackTrace Information Details:
======================================
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at System.Diagnostics.EventLog.FindSourceRegistration(String source,
String machineName, Boolean readOnly)
at System.Diagnostics.EventLog.SourceExists(String source, String
machineName)
at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType type, Int32 eventID, Int16 category)
at
Microsoft.Practices.EnterpriseLibrary.Logging.Sinks.EventLogSink.SendMessageCore(LogEntry logEntry)
at
Microsoft.Practices.EnterpriseLibrary.Logging.Sinks.LogSink.SendMessage(LogEntry entry)
at
Microsoft.Practices.EnterpriseLibrary.Logging.Distributor.LogDistributor.DistributeLogEntry(LogEntry log, CategoryData category)
As well I get the the following information entry:
An error occurred while the Distributor was processing the message. Please
check your configuration files for errors or typos. Verify that your sinks
are reachable (queues exist, permissions are set, database exists, etc...)
Sink failed because: System.Security.SecurityException: Requested registry
access is not allowed.
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at System.Diagnostics.EventLog.FindSourceRegistration(String source,
String machineName, Boolean readOnly)
at System.Diagnostics.EventLog.SourceExists(String source, String
machineName)
at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType type, Int32 eventID, Int16 category)
at
Microsoft.Practices.EnterpriseLibrary.Logging.Sinks.EventLogSink.SendMessageCore(LogEntry logEntry).
Message:
Timestamp: 8/3/2005 8:55:36 AM
Message: test
Category: Exceptions
Priority: 2
EventId: 1
Severity: Unspecified
Title:
Machine: EXTREMEDEV
App Domain: /LM/W3SVC/1/Root/DefenseTravelSystem-8-127675689321875000
ProcessId: 1912
Process Name: \\?\C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_wp.exe
Thread Name:
Win32 ThreadId:3280
Extended Properties:
For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.
Any ideas?