Deploy Entlib with my project

Topics: Logging Application Block
Oct 8, 2007 at 11:07 PM

I've seen this asked a few times, but never really answered. I've got a VS2005 project that is a collection of web services. I am using the Validation and Logging blocks. All works fine on my dev machine, as my Rolling Flat File Trace Listener is fine and logs everything I want and need. I also have an EventLog Trace Listener. When I deploy this project to a different environment (simply another machine) via VS's "Publish" method, nothing is ever logged. The validation blocks work fine.

Can someone point out how you've been successful in deploying something that uses the Logging Application Block to log to both text files and the event log? Or point me somewhere?

Oct 10, 2007 at 9:18 PM
Is this really so simple that it warrants no response? I've read all sorts of stuff about instrumentation, etc., but consensus seems to be that with the latest version (3.1, which I am using), this is off by default. So really all I need is the DLLs in my project, correct? Or is there something else that's so obvious that I'm missing? Could someone point me in the right direction? Thanks for your help.
Oct 10, 2007 at 9:21 PM
By the way, here is the relevant configuration in web.config:

<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching, Version=, Culture=neutral, 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 fileName="rolling.log" rollSizeKB="0" timeStampPattern="ddMMyyyy"
rollFileExistsBehavior="Overwrite" rollInterval="Day" formatter=""
header="----------------------------------------" footer="----------------------------------------"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
name="Rolling Flat File Trace Listener" />
<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" />
<add name="Rolling Flat File Trace Listener" />
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors & Warnings">
<add name="Formatted EventLog TraceListener" />

Thanks again.
Oct 10, 2007 at 9:47 PM
I know that we have had problems logging to the Event Log due to permissions. You may have to give the IUSR or IWAM system accounts on the deployment system permission to write to the Event Log. Also, if they don't have administrator priviliges, and the Log and/or Source you are using don't already exist, those may have to be created prior to the Ent Lib Logging successfully from the web services.