none
Enterprise Library 2.0 logging problem RRS feed

  • Question

  •  

    Hi, im newbie wit Enterprise Library and triying to test the logging block.

     

    I have a simple windows application and i want to log some information to the "Event Log".

     

    Im using :

    Logger.Write(SomeInfoString);

     

    when I run the application nothing is logged and i get no errors.

    What am i missing ???

     

    Heres the app.config section for the logging:

     

     

    <configSections>

    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" />

    </configSections>

    <loggingConfiguration name="Logging Application Block" tracingEnabled="false"

    defaultCategory="" logWarningsWhenNoCategoriesMatch="false">

    <listeners>

    <add source="Enterprise Library Logging" formatter="Text Formatter"

    log="Application" machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"

    traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"

    name="Formatted EventLog TraceListener" />

    </listeners>

    <formatters>

    <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;)}{message}"

    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="Information" name="Category" />

    </categorySources>

    <specialSources>

    <allEvents switchValue="All" name="All Events" />

    <notProcessed switchValue="All" name="Unprocessed Category" />

    <errors switchValue="All" name="Logging Errors &amp; Warnings" />

    </specialSources>

    </loggingConfiguration>

    <appSettings>

    ........

     

     

    Thanks in advance

    Barak

    Friday, November 16, 2007 9:39 AM

Answers

All replies

  • Try posting below instead so you can get help from the Enterprise library experts.

     

    http://www.codeplex.com/entlib/Thread/List.aspx

     

    Friday, November 16, 2007 4:00 PM
  • Thanks, I already did and got answered.

    Ive opened this thread by mistake at the wrong forum.

     

    Monday, November 19, 2007 9:15 AM
  •  

    hi,

    i guess the problem is you havent given any trace listener. try configuring a trace listener (formatted event log or a flat file)...

    once you do that, your config file will have this section...

    .....................

    ................

    ......................

    ...................

    <specialSources>

    <allEvents switchValue="All" name="All Events" />

    <notProcessed switchValue="All" name="Unprocessed Category" />

    <errors switchValue="All" name="Logging Errors &amp; Warnings">

    <listeners>

    <add name="Formatted EventLog TraceListener" />

    </listeners>

    </errors>

    </specialSources>

    Tuesday, November 27, 2007 1:52 PM