470,575 Members | 1,528 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,575 developers. It's quick & easy.

Using Enterprise Library to write in a custom event log


I've started using Enterprise Library 2.0 recently and I've encountered
a problem that seems to be ... well... undocumented :)

Basically, when I set a Trace Listener (formatted event log to be
precise), if i specify the name of a custom event log, the listener
won't log in it.

I've checked in the registry, the log is there. In the event viewer, I
can see the log but enterprise library wont use it. Actually, I've
noticed that if I overwrite "Application" with anything else it doesnt
work either. (like System or Security)

If I write in the log manually (in the code) it works just fine. But
the point of the whole thing is to use the MS Application Blocks so im
trying not to log the error myself.

Is there some kind of access right I have to set somewhere ?

Am I doing something wrong ?



Here's the code I can show you :

I've made a chunk of code to create the event log like so. Right now
its executed everytime the website is started since I'm still in dev.

Private Const cLMI_EVENT_SOURCE As String = "LMIV40"
If Not EventLog.SourceExists(cLMI_EVENT_SOURCE) Then
End If

Then, I've configured the weg.config like so (i've used the
entlibconfig tool)

<loggingConfiguration name="Logging Application Block"
defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
<add source="Enterprise Library Logging" formatter="Text
log="LMIV40" machineName=""
listenerDataType="Microsoft.Practices.EnterpriseLi brary.Logging.Configuration.FormattedEventLogTrace ListenerData,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=,
Culture=neutral, PublicKeyToken=null"
type="Microsoft.Practices.EnterpriseLibrary.Loggin g.TraceListeners.FormattedEventLogTraceListener,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=,
Culture=neutral, PublicKeyToken=null"
name="LMIV4.0 Tracer" />
<add template="Timestamp: {timestamp}&#xD;&#xA;Message:
{message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority:
{priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;Severity:
{severity}&#xD;&#xA;Title:{title}&#xD;&#xA;Machine :
{machine}&#xD;&#xA;Application Domain: {appDomain}&#xD;&#xA;Process Id:
{processId}&#xD;&#xA;Process Name: {processName}&#xD;&#xA;Win32 Thread
Id: {win32ThreadId}&#xD;&#xA;Thread Name:
{threadName}&#xD;&#xA;Extended Properties: {dictionary({key} -

type="Microsoft.Practices.EnterpriseLibrary.Loggin g.Formatters.TextFormatter,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=,
Culture=neutral, PublicKeyToken=null"
name="Text Formatter" />
<add switchValue="All" name="General">
<add name="LMIV4.0 Tracer" />
<allEvents switchValue="All" name="All Events">
<add name="LMIV4.0 Tracer" />
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors &amp; Warnings" />

Jun 15 '06 #1
0 4741

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by The_Incubator | last post: by
6 posts views Thread by Jonathan Crawford | last post: by
reply views Thread by John Dalberg | last post: by
1 post views Thread by Jerry | last post: by
1 post views Thread by Arne Garvander | last post: by
reply views Thread by =?Utf-8?B?U2hyaWthbnQgTW9yZQ==?= | last post: by
1 post views Thread by livre | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.