Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 06, 2012 10:23 AM by sukumarraju
Member
2 Points
19 Posts
Jun 11, 2012 09:55 AM|LINK
I am using enterprise library 5.0 for logging and I am not sure how to switch off the logging. Currently it is switched on and workng as it should.
Here is my web.config section on logging, it was created with automatically with the EL 5.0 GUI.
<loggingConfiguration name="" tracingEnabled="true" defaultCategory="Logging Only"> <listeners> <add name="Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=..." listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=..." fileName="WMSlog.log" formatter="Text Formatter" /> <add enabled="false" name="Formatted EventLog TraceListener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=..." listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=..." source="Exception Handling" formatter="Text Formatter" /> </listeners> <formatters> <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=..." template="Timestamp: {timestamp}{newline}
Message: {message}{newline}
Category: {category}{newline}
Machine: {localMachine}{newline}
App Domain: {localAppDomain}{newline}
ProcessId: {localProcessId}{newline}
Process Name: {localProcessName}{newline}
Thread Name: {threadName}{newline}
Win32 ThreadId:{win32ThreadId}{newline}" name="Text Formatter" /> </formatters> <categorySources> <add switchValue="Information" name="Logging Only"> <listeners> <add name="Flat File Trace Listener" /> </listeners> </add> <add switchValue="Error" name="Errors Only"> <listeners> <add name="Formatted EventLog TraceListener" /> </listeners> </add> </categorySources> <specialSources> <allEvents switchValue="All" name="All Events" /> <notProcessed switchValue="All" name="Unprocessed Category" /> <errors switchValue="Information" name="Logging Errors & Warnings" /> </specialSources> </loggingConfiguration>
I have replaced my data with ... in some lines above.
At the moment I'm using this to log to a file:
if (Logger.IsLoggingEnabled()) { Logger.Write("Some text..."); }
I need to be able to make Logger.IsLoggingEnabled() return false by switching off logging for Logger, how do I do that?
Jun 12, 2012 04:40 PM|LINK
Anyone?
All-Star
16981 Points
2999 Posts
Jun 16, 2012 10:45 PM|LINK
http://stackoverflow.com/questions/5077696/enable-disable-enterprise-library-logging-on-production
Post your query at http://entlib.codeplex.com/discussions for best response.
Jul 06, 2012 10:23 AM|LINK
sd_dracula <add switchValue="Error" name="Errors Only">
<add switchValue="Error" name="Errors Only">
Set SwitchValue to "Off"
http://msdn.microsoft.com/en-us/library/ff648115.aspx#logenabledfilter
sd_dracula
Member
2 Points
19 Posts
EL 5.0 Switching off logging
Jun 11, 2012 09:55 AM|LINK
I am using enterprise library 5.0 for logging and I am not sure how to switch off the logging. Currently it is switched on and workng as it should.
Here is my web.config section on logging, it was created with automatically with the EL 5.0 GUI.
<loggingConfiguration name="" tracingEnabled="true" defaultCategory="Logging Only"> <listeners> <add name="Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=..." listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=..." fileName="WMSlog.log" formatter="Text Formatter" /> <add enabled="false" name="Formatted EventLog TraceListener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=..." listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=..." source="Exception Handling" formatter="Text Formatter" /> </listeners> <formatters> <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=..." template="Timestamp: {timestamp}{newline}
Message: {message}{newline}
Category: {category}{newline}
Machine: {localMachine}{newline}
App Domain: {localAppDomain}{newline}
ProcessId: {localProcessId}{newline}
Process Name: {localProcessName}{newline}
Thread Name: {threadName}{newline}
Win32 ThreadId:{win32ThreadId}{newline}" name="Text Formatter" /> </formatters> <categorySources> <add switchValue="Information" name="Logging Only"> <listeners> <add name="Flat File Trace Listener" /> </listeners> </add> <add switchValue="Error" name="Errors Only"> <listeners> <add name="Formatted EventLog TraceListener" /> </listeners> </add> </categorySources> <specialSources> <allEvents switchValue="All" name="All Events" /> <notProcessed switchValue="All" name="Unprocessed Category" /> <errors switchValue="Information" name="Logging Errors & Warnings" /> </specialSources> </loggingConfiguration>I have replaced my data with ... in some lines above.
At the moment I'm using this to log to a file:
if (Logger.IsLoggingEnabled()) { Logger.Write("Some text..."); }I need to be able to make Logger.IsLoggingEnabled() return false by switching off logging for Logger, how do I do that?
sd_dracula
Member
2 Points
19 Posts
Re: EL 5.0 Switching off logging
Jun 12, 2012 04:40 PM|LINK
Anyone?
sukumarraju
All-Star
16981 Points
2999 Posts
Re: EL 5.0 Switching off logging
Jun 16, 2012 10:45 PM|LINK
http://stackoverflow.com/questions/5077696/enable-disable-enterprise-library-logging-on-production
Post your query at http://entlib.codeplex.com/discussions for best response.
Application Architecture Guide 2.0
My Blog
Twitter
sukumarraju
All-Star
16981 Points
2999 Posts
Re: EL 5.0 Switching off logging
Jul 06, 2012 10:23 AM|LINK
Set SwitchValue to "Off"
http://msdn.microsoft.com/en-us/library/ff648115.aspx#logenabledfilter
Application Architecture Guide 2.0
My Blog
Twitter