Using Enterprise Library to write in a custom event log

E

Eniac

Hello,

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 ?

Thanks....

*********************

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
EventLog.CreateEventSource(cLMI_EVENT_SOURCE, cLMI_EVENT_SOURCE)
End If

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

<loggingConfiguration name="Logging Application Block"
tracingEnabled="true"
defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
<listeners>
<add source="Enterprise Library Logging" formatter="Text
Formatter"
log="LMIV40" machineName=""
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null"
traceOutputOptions="Callstack"
type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null"
name="LMIV4.0 Tracer" />
</listeners>
<formatters>
<add template="Timestamp: {timestamp}
Message:
{message}
Category: {category}
Priority:
{priority}
EventId: {eventid}
Severity:
{severity}
Title:{title}
Machine:
{machine}
Application Domain: {appDomain}
Process Id:
{processId}
Process Name: {processName}
Win32 Thread
Id: {win32ThreadId}
Thread Name:
{threadName}
Extended Properties: {dictionary({key} -
{value}
)}"

type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null"
name="Text Formatter" />
</formatters>
<categorySources>
<add switchValue="All" name="General">
<listeners>
<add name="LMIV4.0 Tracer" />
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events">
<listeners>
<add name="LMIV4.0 Tracer" />
</listeners>
</allEvents>
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors &amp; Warnings" />
</specialSources>
</loggingConfiguration>
 
Joined
Aug 1, 2008
Messages
1
Reaction score
0
I am facing the same problem. I am using Enterprise Library 3.1.
Did you find a workaround for this?

Thanks,

Kim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top