Logger.Write() - no errors, no logging?

Topics: Logging Application Block
Jan 25, 2008 at 10:35 AM
BRAND NEW to EntLib Logging, so I could be missing something basic. I've gone through the steps, read some tutorials and finally launched the new integrated VS config editor and added logging to my SCSF shell project.

I've added a single call to Logger.Write("SomeMessage");
The call executes fine, no errors. There also isn't a log in the event viewer. I don't know what else to check...

Here are the relevant app.config sections:

<section name="loggingConfiguration" 
PublicKeyToken=b03f5f7f11d50a3a" />
<loggingConfiguration name="Logging Application Block" tracingEnabled="true"
    defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
      <add source="Enterprise Library Logging" formatter="Text Formatter"
        log="Application" machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        name="Formatted EventLog TraceListener" />
      <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} - {value}&#xD;&#xA;)}"
        type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        name="Text Formatter" />
      <add switchValue="All" name="General">
          <add name="Formatted EventLog TraceListener" />
      <allEvents switchValue="All" name="All Events" />
      <notProcessed switchValue="All" name="Unprocessed Category" />
      <errors switchValue="All" name="Logging Errors &amp; Warnings">
          <add name="Formatted EventLog TraceListener" />

Anyone know what else I can check?

Thanks for any help,
Jan 25, 2008 at 10:55 AM
I guess you have the same problem as I had. Your process identity does not have permission to create an Event Source which you then have to create manually or by an installer class. You can try to edit this in your registry (use regedit.exe):

HKLM\System\CurrentControlSet\Services\EventLog\Application\{source name}

Try it and let me here if that made it for you.....

Jan 25, 2008 at 11:30 AM
Hi RightCoder,

Thanks for the post.

I will give that a try, in the meantime I have added a flat file listener and it's also not being logged to (or created as far as I can tell).
I think I may have another problem going on. I will try to get my application in the registry per your suggestion.

Jan 25, 2008 at 8:03 PM
Hi RightCoder,

I'm at a loss for what changes I need to make in the Registry. I've tried different settings but none of them seem to have any effect.

Can anyone think of other reasons why even logging to a file seems to have no effect? (no log file even created)?