473,775 Members | 2,615 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

June 2005 EAL Question

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="Exception s">
<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="Event LogSinkData" name="Event Log Sink"
eventLogName="A pplication" 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(lo g);
}

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/DefenseTravelSy stem-8-127675689321875 000
ProcessId: 1912
Process Name: \\?\C:\WINDOWS\ Microsoft.NET\F ramework\v1.1.4 322\aspnet_wp.e xe
Thread Name:
Win32 ThreadId:3280
Extended Properties:
--> MachineName: EXTREMEDEV
--> TimeStamp: 8/3/2005 1:55:37 PM
--> FullName: Microsoft.Pract ices.Enterprise Library.Common, Version=1.1.0.0 ,
Culture=neutral , PublicKeyToken= null
--> AppDomainName: /LM/W3SVC/1/Root/DefenseTravelSy stem-8-127675689321875 000
--> WindowsIdentity : EXTREMEDEV\ASPN ET

Exception Information Details:
=============== =============== ========
Exception Type: System.Security .SecurityExcept ion
PermissionType: NULL
PermissionState : NULL
GrantedSet: NULL
RefusedSet: NULL
Message: Requested registry access is not allowed.
TargetSite: Microsoft.Win32 .RegistryKey OpenSubKey(Syst em.String, Boolean)
HelpLink: NULL
Source: mscorlib

StackTrace Information Details:
=============== =============== ========
at Microsoft.Win32 .RegistryKey.Op enSubKey(String name, Boolean writable)
at System.Diagnost ics.EventLog.Fi ndSourceRegistr ation(String source,
String machineName, Boolean readOnly)
at System.Diagnost ics.EventLog.So urceExists(Stri ng source, String
machineName)
at System.Diagnost ics.EventLog.Wr iteEntry(String message,
EventLogEntryTy pe type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnost ics.EventLog.Wr iteEntry(String message,
EventLogEntryTy pe type, Int32 eventID, Int16 category)
at
Microsoft.Pract ices.Enterprise Library.Logging .Sinks.EventLog Sink.SendMessag eCore(LogEntry logEntry)
at
Microsoft.Pract ices.Enterprise Library.Logging .Sinks.LogSink. SendMessage(Log Entry entry)
at
Microsoft.Pract ices.Enterprise Library.Logging .Distributor.Lo gDistributor.Di stributeLogEntr y(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 .SecurityExcept ion: Requested registry
access is not allowed.
at Microsoft.Win32 .RegistryKey.Op enSubKey(String name, Boolean writable)
at System.Diagnost ics.EventLog.Fi ndSourceRegistr ation(String source,
String machineName, Boolean readOnly)
at System.Diagnost ics.EventLog.So urceExists(Stri ng source, String
machineName)
at System.Diagnost ics.EventLog.Wr iteEntry(String message,
EventLogEntryTy pe type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnost ics.EventLog.Wr iteEntry(String message,
EventLogEntryTy pe type, Int32 eventID, Int16 category)
at
Microsoft.Pract ices.Enterprise Library.Logging .Sinks.EventLog Sink.SendMessag eCore(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/DefenseTravelSy stem-8-127675689321875 000
ProcessId: 1912
Process Name: \\?\C:\WINDOWS\ Microsoft.NET\F ramework\v1.1.4 322\aspnet_wp.e xe
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?
Aug 3 '05 #1
4 4626
yes. You have a web app, don't you?

Web apps run in a special account that lacks most of the privileges of
normal user accounts. Depending on your setup, windows apps will behave the
same way depending on the account you run them under.

Since you configured that the event should should use its own event source,
the block attempts to create the event source the first time you try to
write to the log. This throws a permission error. After the event source
is created, this problem doesn't happen any more.

So, you have a couple of options:
1) the correct way to use a custom event source is to use an installer to
create your app, and put code into your installer to install the event
source. If you want to continue to use a custom event source, do this.
2) run your app under admin privileges once. That will create the event
source. Then you can switch back to normal permissions to keep running.

Hope this helps,

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Steven" <St****@discuss ions.microsoft. com> wrote in message
news:52******** *************** ***********@mic rosoft.com...
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="Exception s">
<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="Event LogSinkData" name="Event Log Sink"
eventLogName="A pplication" 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(lo g);
}

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/DefenseTravelSy stem-8-127675689321875 000
ProcessId: 1912
Process Name:
\\?\C:\WINDOWS\ Microsoft.NET\F ramework\v1.1.4 322\aspnet_wp.e xe
Thread Name:
Win32 ThreadId:3280
Extended Properties:
--> MachineName: EXTREMEDEV
--> TimeStamp: 8/3/2005 1:55:37 PM
--> FullName: Microsoft.Pract ices.Enterprise Library.Common,
Version=1.1.0.0 ,
Culture=neutral , PublicKeyToken= null
--> AppDomainName:
/LM/W3SVC/1/Root/DefenseTravelSy stem-8-127675689321875 000
--> WindowsIdentity : EXTREMEDEV\ASPN ET

Exception Information Details:
=============== =============== ========
Exception Type: System.Security .SecurityExcept ion
PermissionType: NULL
PermissionState : NULL
GrantedSet: NULL
RefusedSet: NULL
Message: Requested registry access is not allowed.
TargetSite: Microsoft.Win32 .RegistryKey OpenSubKey(Syst em.String, Boolean)
HelpLink: NULL
Source: mscorlib

StackTrace Information Details:
=============== =============== ========
at Microsoft.Win32 .RegistryKey.Op enSubKey(String name, Boolean writable)
at System.Diagnost ics.EventLog.Fi ndSourceRegistr ation(String source,
String machineName, Boolean readOnly)
at System.Diagnost ics.EventLog.So urceExists(Stri ng source, String
machineName)
at System.Diagnost ics.EventLog.Wr iteEntry(String message,
EventLogEntryTy pe type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnost ics.EventLog.Wr iteEntry(String message,
EventLogEntryTy pe type, Int32 eventID, Int16 category)
at
Microsoft.Pract ices.Enterprise Library.Logging .Sinks.EventLog Sink.SendMessag eCore(LogEntry
logEntry)
at
Microsoft.Pract ices.Enterprise Library.Logging .Sinks.LogSink. SendMessage(Log Entry
entry)
at
Microsoft.Pract ices.Enterprise Library.Logging .Distributor.Lo gDistributor.Di stributeLogEntr y(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 .SecurityExcept ion: Requested registry
access is not allowed.
at Microsoft.Win32 .RegistryKey.Op enSubKey(String name, Boolean writable)
at System.Diagnost ics.EventLog.Fi ndSourceRegistr ation(String source,
String machineName, Boolean readOnly)
at System.Diagnost ics.EventLog.So urceExists(Stri ng source, String
machineName)
at System.Diagnost ics.EventLog.Wr iteEntry(String message,
EventLogEntryTy pe type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnost ics.EventLog.Wr iteEntry(String message,
EventLogEntryTy pe type, Int32 eventID, Int16 category)
at
Microsoft.Pract ices.Enterprise Library.Logging .Sinks.EventLog Sink.SendMessag eCore(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/DefenseTravelSy stem-8-127675689321875 000
ProcessId: 1912
Process Name:
\\?\C:\WINDOWS\ Microsoft.NET\F ramework\v1.1.4 322\aspnet_wp.e xe
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?

Aug 3 '05 #2
Thank you.. I just want to write to the default application event log and so
far so good however I am now getting the following error:

The description for Event ID ( 1 ) in Source ( Application ) cannot be
found. The local computer may not have the necessary registry information or
message DLL files to display messages from a remote computer. You may be able
to use the /AUXSOURCE= flag to retrieve this description; see Help and
Support for details. The following information is part of the event:
Timestamp: 8/3/2005 7:13:31 PM

Also how do I reflect DTS as the source description versus Application as it
is now?

<sinks>
<sink xsi:type="Event LogSinkData" name="Event Log Sink"
eventLogName="A pplication" eventSourceName ="Applicatio n" />
<sink xsi:type="FlatF ileSinkData" name="Flat File Sink"
fileName="trace .log" header="----------------------------------------"
footer="----------------------------------------" />
</sinks>
<categories>
<category name="General">
<destinations >
<destination name="Event Log Destination" sink="Event Log Sink"
format="Text Formatter" />
</destinations>
</category>
</categories>

"Nick Malik [Microsoft]" wrote:
yes. You have a web app, don't you?

Web apps run in a special account that lacks most of the privileges of
normal user accounts. Depending on your setup, windows apps will behave the
same way depending on the account you run them under.

Since you configured that the event should should use its own event source,
the block attempts to create the event source the first time you try to
write to the log. This throws a permission error. After the event source
is created, this problem doesn't happen any more.

So, you have a couple of options:
1) the correct way to use a custom event source is to use an installer to
create your app, and put code into your installer to install the event
source. If you want to continue to use a custom event source, do this.
2) run your app under admin privileges once. That will create the event
source. Then you can switch back to normal permissions to keep running.

Hope this helps,

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Steven" <St****@discuss ions.microsoft. com> wrote in message
news:52******** *************** ***********@mic rosoft.com...
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="Exception s">
<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="Event LogSinkData" name="Event Log Sink"
eventLogName="A pplication" 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(lo g);
}

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/DefenseTravelSy stem-8-127675689321875 000
ProcessId: 1912
Process Name:
\\?\C:\WINDOWS\ Microsoft.NET\F ramework\v1.1.4 322\aspnet_wp.e xe
Thread Name:
Win32 ThreadId:3280
Extended Properties:
--> MachineName: EXTREMEDEV
--> TimeStamp: 8/3/2005 1:55:37 PM
--> FullName: Microsoft.Pract ices.Enterprise Library.Common,
Version=1.1.0.0 ,
Culture=neutral , PublicKeyToken= null
--> AppDomainName:
/LM/W3SVC/1/Root/DefenseTravelSy stem-8-127675689321875 000
--> WindowsIdentity : EXTREMEDEV\ASPN ET

Exception Information Details:
=============== =============== ========
Exception Type: System.Security .SecurityExcept ion
PermissionType: NULL
PermissionState : NULL
GrantedSet: NULL
RefusedSet: NULL
Message: Requested registry access is not allowed.
TargetSite: Microsoft.Win32 .RegistryKey OpenSubKey(Syst em.String, Boolean)
HelpLink: NULL
Source: mscorlib

StackTrace Information Details:
=============== =============== ========
at Microsoft.Win32 .RegistryKey.Op enSubKey(String name, Boolean writable)
at System.Diagnost ics.EventLog.Fi ndSourceRegistr ation(String source,
String machineName, Boolean readOnly)
at System.Diagnost ics.EventLog.So urceExists(Stri ng source, String
machineName)
at System.Diagnost ics.EventLog.Wr iteEntry(String message,
EventLogEntryTy pe type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnost ics.EventLog.Wr iteEntry(String message,
EventLogEntryTy pe type, Int32 eventID, Int16 category)
at
Microsoft.Pract ices.Enterprise Library.Logging .Sinks.EventLog Sink.SendMessag eCore(LogEntry
logEntry)
at
Microsoft.Pract ices.Enterprise Library.Logging .Sinks.LogSink. SendMessage(Log Entry
entry)
at
Microsoft.Pract ices.Enterprise Library.Logging .Distributor.Lo gDistributor.Di stributeLogEntr y(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 .SecurityExcept ion: Requested registry
access is not allowed.
at Microsoft.Win32 .RegistryKey.Op enSubKey(String name, Boolean writable)
at System.Diagnost ics.EventLog.Fi ndSourceRegistr ation(String source,
String machineName, Boolean readOnly)
at System.Diagnost ics.EventLog.So urceExists(Stri ng source, String
machineName)
at System.Diagnost ics.EventLog.Wr iteEntry(String message,
EventLogEntryTy pe type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnost ics.EventLog.Wr iteEntry(String message,
EventLogEntryTy pe type, Int32 eventID, Int16 category)
at
Microsoft.Pract ices.Enterprise Library.Logging .Sinks.EventLog Sink.SendMessag eCore(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/DefenseTravelSy stem-8-127675689321875 000
ProcessId: 1912
Process Name:
\\?\C:\WINDOWS\ Microsoft.NET\F ramework\v1.1.4 322\aspnet_wp.e xe
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?


Aug 4 '05 #3
BTW, it is in fact a web app....

I have the following that the admin may run to establish the event source:
using System;
using System.Diagnost ics;
using System.Componen tModel;
using System.Configur ation.Install;

namespace EventLogSourceI nstaller
{
/// <summary>
/// Summary description for EventLogSourceI nstaller.
/// </summary>
[RunInstaller(tr ue)]
public class MyEventLogInsta ller: Installer
{
private EventLogInstall er myEventLogInsta ller;
public MyEventLogInsta ller()
{
// Create an instance of 'EventLogInstal ler'.
myEventLogInsta ller = new EventLogInstall er();
// Set the 'Source' of the event log, to be created.
myEventLogInsta ller.Source = "Defense Travel System";
// Set the 'Log' that the source is created in.
myEventLogInsta ller.Log = "Defense Travel System";
// Add myEventLogInsta ller to 'InstallerColle ction'.
Installers.Add( myEventLogInsta ller);
}
public static void Main()
{
}
}

}

My question is am I am going about logging the exception thrown properly?
try
{
ctrl.Attributes["class"] = "MenuItemSelect ed";

// set title
LiteralTitle.Te xt = _title;
}
catch (Exception ex)
{
LogEntry log = new LogEntry();
log.Category = "General";
log.Message = ex.Message;
log.EventId = 1;
log.Title = "ERROR: Page_Load method in MilitaryNavigat ion";

Logger.Write(lo g);
}
"Nick Malik [Microsoft]" wrote:
yes. You have a web app, don't you?

Web apps run in a special account that lacks most of the privileges of
normal user accounts. Depending on your setup, windows apps will behave the
same way depending on the account you run them under.

Since you configured that the event should should use its own event source,
the block attempts to create the event source the first time you try to
write to the log. This throws a permission error. After the event source
is created, this problem doesn't happen any more.

So, you have a couple of options:
1) the correct way to use a custom event source is to use an installer to
create your app, and put code into your installer to install the event
source. If you want to continue to use a custom event source, do this.
2) run your app under admin privileges once. That will create the event
source. Then you can switch back to normal permissions to keep running.

Hope this helps,

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Steven" <St****@discuss ions.microsoft. com> wrote in message
news:52******** *************** ***********@mic rosoft.com...
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="Exception s">
<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="Event LogSinkData" name="Event Log Sink"
eventLogName="A pplication" 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(lo g);
}

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/DefenseTravelSy stem-8-127675689321875 000
ProcessId: 1912
Process Name:
\\?\C:\WINDOWS\ Microsoft.NET\F ramework\v1.1.4 322\aspnet_wp.e xe
Thread Name:
Win32 ThreadId:3280
Extended Properties:
--> MachineName: EXTREMEDEV
--> TimeStamp: 8/3/2005 1:55:37 PM
--> FullName: Microsoft.Pract ices.Enterprise Library.Common,
Version=1.1.0.0 ,
Culture=neutral , PublicKeyToken= null
--> AppDomainName:
/LM/W3SVC/1/Root/DefenseTravelSy stem-8-127675689321875 000
--> WindowsIdentity : EXTREMEDEV\ASPN ET

Exception Information Details:
=============== =============== ========
Exception Type: System.Security .SecurityExcept ion
PermissionType: NULL
PermissionState : NULL
GrantedSet: NULL
RefusedSet: NULL
Message: Requested registry access is not allowed.
TargetSite: Microsoft.Win32 .RegistryKey OpenSubKey(Syst em.String, Boolean)
HelpLink: NULL
Source: mscorlib

StackTrace Information Details:
=============== =============== ========
at Microsoft.Win32 .RegistryKey.Op enSubKey(String name, Boolean writable)
at System.Diagnost ics.EventLog.Fi ndSourceRegistr ation(String source,
String machineName, Boolean readOnly)
at System.Diagnost ics.EventLog.So urceExists(Stri ng source, String
machineName)
at System.Diagnost ics.EventLog.Wr iteEntry(String message,
EventLogEntryTy pe type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnost ics.EventLog.Wr iteEntry(String message,
EventLogEntryTy pe type, Int32 eventID, Int16 category)
at
Microsoft.Pract ices.Enterprise Library.Logging .Sinks.EventLog Sink.SendMessag eCore(LogEntry
logEntry)
at
Microsoft.Pract ices.Enterprise Library.Logging .Sinks.LogSink. SendMessage(Log Entry
entry)
at
Microsoft.Pract ices.Enterprise Library.Logging .Distributor.Lo gDistributor.Di stributeLogEntr y(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 .SecurityExcept ion: Requested registry
access is not allowed.
at Microsoft.Win32 .RegistryKey.Op enSubKey(String name, Boolean writable)
at System.Diagnost ics.EventLog.Fi ndSourceRegistr ation(String source,
String machineName, Boolean readOnly)
at System.Diagnost ics.EventLog.So urceExists(Stri ng source, String
machineName)
at System.Diagnost ics.EventLog.Wr iteEntry(String message,
EventLogEntryTy pe type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnost ics.EventLog.Wr iteEntry(String message,
EventLogEntryTy pe type, Int32 eventID, Int16 category)
at
Microsoft.Pract ices.Enterprise Library.Logging .Sinks.EventLog Sink.SendMessag eCore(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/DefenseTravelSy stem-8-127675689321875 000
ProcessId: 1912
Process Name:
\\?\C:\WINDOWS\ Microsoft.NET\F ramework\v1.1.4 322\aspnet_wp.e xe
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?


Aug 4 '05 #4
I haven't dug under the code details in EAL, so I'm relying on what I can
tell from the Framework documentation.. .

I'm going to suggest that you comment out the line that sets the 'category'
parameter to a string. The API allows a category to be written to the event
log, but only as an integer, and only if you have already mapped category
strings to these integers. As far as I can tell, the Framework has no way
to do this. It has to be done through registry updates. I do not know if
the EAL does this updating... but your installer does not.

Therefore, try commenting out the following line:
log.Category = "General"; and see if that helps.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Steven" <St****@discuss ions.microsoft. com> wrote in message
news:C8******** *************** ***********@mic rosoft.com... BTW, it is in fact a web app....

I have the following that the admin may run to establish the event source:
using System;
using System.Diagnost ics;
using System.Componen tModel;
using System.Configur ation.Install;

namespace EventLogSourceI nstaller
{
/// <summary>
/// Summary description for EventLogSourceI nstaller.
/// </summary>
[RunInstaller(tr ue)]
public class MyEventLogInsta ller: Installer
{
private EventLogInstall er myEventLogInsta ller;
public MyEventLogInsta ller()
{
// Create an instance of 'EventLogInstal ler'.
myEventLogInsta ller = new EventLogInstall er();
// Set the 'Source' of the event log, to be created.
myEventLogInsta ller.Source = "Defense Travel System";
// Set the 'Log' that the source is created in.
myEventLogInsta ller.Log = "Defense Travel System";
// Add myEventLogInsta ller to 'InstallerColle ction'.
Installers.Add( myEventLogInsta ller);
}
public static void Main()
{
}
}

}

My question is am I am going about logging the exception thrown properly?
try
{
ctrl.Attributes["class"] = "MenuItemSelect ed";

// set title
LiteralTitle.Te xt = _title;
}
catch (Exception ex)
{
LogEntry log = new LogEntry();
log.Category = "General";
log.Message = ex.Message;
log.EventId = 1;
log.Title = "ERROR: Page_Load method in MilitaryNavigat ion";

Logger.Write(lo g);
}
"Nick Malik [Microsoft]" wrote:
yes. You have a web app, don't you?

Web apps run in a special account that lacks most of the privileges of
normal user accounts. Depending on your setup, windows apps will behave
the
same way depending on the account you run them under.

Since you configured that the event should should use its own event
source,
the block attempts to create the event source the first time you try to
write to the log. This throws a permission error. After the event
source
is created, this problem doesn't happen any more.

So, you have a couple of options:
1) the correct way to use a custom event source is to use an installer to
create your app, and put code into your installer to install the event
source. If you want to continue to use a custom event source, do this.
2) run your app under admin privileges once. That will create the event
source. Then you can switch back to normal permissions to keep running.

Hope this helps,

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Steven" <St****@discuss ions.microsoft. com> wrote in message
news:52******** *************** ***********@mic rosoft.com...
>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="Exception s">
> <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="Event LogSinkData" name="Event Log Sink"
> eventLogName="A pplication" 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(lo g);
> }
>
> 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/DefenseTravelSy stem-8-127675689321875 000
> ProcessId: 1912
> Process Name:
> \\?\C:\WINDOWS\ Microsoft.NET\F ramework\v1.1.4 322\aspnet_wp.e xe
> Thread Name:
> Win32 ThreadId:3280
> Extended Properties:
> --> MachineName: EXTREMEDEV
> --> TimeStamp: 8/3/2005 1:55:37 PM
> --> FullName: Microsoft.Pract ices.Enterprise Library.Common,
> Version=1.1.0.0 ,
> Culture=neutral , PublicKeyToken= null
> --> AppDomainName:
> /LM/W3SVC/1/Root/DefenseTravelSy stem-8-127675689321875 000
> --> WindowsIdentity : EXTREMEDEV\ASPN ET
>
> Exception Information Details:
> =============== =============== ========
> Exception Type: System.Security .SecurityExcept ion
> PermissionType: NULL
> PermissionState : NULL
> GrantedSet: NULL
> RefusedSet: NULL
> Message: Requested registry access is not allowed.
> TargetSite: Microsoft.Win32 .RegistryKey OpenSubKey(Syst em.String,
> Boolean)
> HelpLink: NULL
> Source: mscorlib
>
> StackTrace Information Details:
> =============== =============== ========
> at Microsoft.Win32 .RegistryKey.Op enSubKey(String name, Boolean
> writable)
> at System.Diagnost ics.EventLog.Fi ndSourceRegistr ation(String source,
> String machineName, Boolean readOnly)
> at System.Diagnost ics.EventLog.So urceExists(Stri ng source, String
> machineName)
> at System.Diagnost ics.EventLog.Wr iteEntry(String message,
> EventLogEntryTy pe type, Int32 eventID, Int16 category, Byte[] rawData)
> at System.Diagnost ics.EventLog.Wr iteEntry(String message,
> EventLogEntryTy pe type, Int32 eventID, Int16 category)
> at
> Microsoft.Pract ices.Enterprise Library.Logging .Sinks.EventLog Sink.SendMessag eCore(LogEntry
> logEntry)
> at
> Microsoft.Pract ices.Enterprise Library.Logging .Sinks.LogSink. SendMessage(Log Entry
> entry)
> at
> Microsoft.Pract ices.Enterprise Library.Logging .Distributor.Lo gDistributor.Di stributeLogEntr y(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 .SecurityExcept ion: Requested
> registry
> access is not allowed.
> at Microsoft.Win32 .RegistryKey.Op enSubKey(String name, Boolean
> writable)
> at System.Diagnost ics.EventLog.Fi ndSourceRegistr ation(String source,
> String machineName, Boolean readOnly)
> at System.Diagnost ics.EventLog.So urceExists(Stri ng source, String
> machineName)
> at System.Diagnost ics.EventLog.Wr iteEntry(String message,
> EventLogEntryTy pe type, Int32 eventID, Int16 category, Byte[] rawData)
> at System.Diagnost ics.EventLog.Wr iteEntry(String message,
> EventLogEntryTy pe type, Int32 eventID, Int16 category)
> at
> Microsoft.Pract ices.Enterprise Library.Logging .Sinks.EventLog Sink.SendMessag eCore(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/DefenseTravelSy stem-8-127675689321875 000
> ProcessId: 1912
> Process Name:
> \\?\C:\WINDOWS\ Microsoft.NET\F ramework\v1.1.4 322\aspnet_wp.e xe
> 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?


Aug 5 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1391
by: Philadelphia XML User Group | last post by:
Philadelphia XML Users' Group NEXT MEETING: June 13th, 6:00 to 8:00 pm The Users' Group is an open organization that invites participation from anyone in the Delaware Valley and Greater Philadelphia area interested in XML technologies. Meetings are hosted at the Elsevier office, 1600 John F. Kennedy Boulevard in Philadelphia.
0
1058
by: jmays | last post by:
Dev Direct June 2005 News Round Up http://www.devdirect.com/content/newsletters/dev200506.htm Dev Direct provides an authoritative and up-to-date catalog of 1000's of developer tools and software components. The products that we list can help you to reduce delivery times, improve quality and cut costs. We are dedicated to mapping the entire market for developer products to ensure that you get the best tools for the job, every time....
0
1808
by: Lester Knutsen | last post by:
Washington Area IBM Informix/DB2 User Group meeting - June 7, 2005 -------------------------------------------------------------- Mark the date, our next user group meeting will be another combined one with DB2 and Informix presentations.. Date: Tuseday, June 7, 2004 Time: 9:00-5:00 Location: IBM Fair Lakes Office
0
1055
by: Scott Nonnenberg [MSFT] | last post by:
As part of our standard every-other-thursday chat series, the C# Team is having a Post-TechEd wrapup chat this Thursday. We're trying to get our session content online before then, but only DEV370 (Debugging Smart Clients with VS 2005) is up at the moment. You can find links to that content from my blog (http://blogs.msdn.com/scottno). See you there! Scott Nonnenberg Program Manager
0
1249
by: Mythran | last post by:
I have installed NDoc and VSHIK2003. If I install a clean Enterprise Library June 2005, how can I go about getting the exact same documentation that is installed with the release (in the <installdir>\Docs folder)? My goal is to update the documentation with the changes I made, and getting an NDoc project to output the exact same files the the documentation that comes with the Enterprise Library is becoming a pain. Once I can get this...
4
224
by: Steven | last post by:
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>
1
1402
by: Manoj Nair | last post by:
Hi all, For our application we need to create a wrapper for the instrumentation and logging block of the Enterprise library june 2005 release. Can any one send a link which can help us in this ? Thanks in advance Regards Manoj
4
1933
by: Mukesh | last post by:
Hi I m using microsoft application blocks Enterprise Library june 2005 with .net framework 1.1 and VStudio2003 And C# as coding language Sql server 2000 database the project is running properly on the localhost server but my online server does not have the ms Ent lib installed and also de\oes not have visual studio that simply a .net 1.1 installed on that.
1
2566
by: =?Utf-8?B?TWlrZSBEb3Zlcg==?= | last post by:
Hi, I hope this is the appropriate group to ask the following question. How does one install the June 2005 Enterprise library (for .NET 1.1) on a production windows 2003 Internet server? My web project works in my dev environment as all installs properly there and am able to run Install Services. I've read that this is because my dev environ has vs.net. My problem is, how do I deploy an application that uses
0
10268
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10048
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9916
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8939
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6718
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5360
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5486
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2853
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.