C# Library

Option 1:

To log using Enterprise Library put the following in your app.config:

    <configSections>         <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />     </configSections>     <loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">         <listeners>             <add listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.CustomTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"                 LogScopeId="2" type="Sidvall.LogManager.EL.EntityTraceListener, Sidvall.LogManager.EL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"                 name="EntityTraceListener" />         </listeners>         <formatters>             <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"                 template="Timestamp: {timestamp}{newline}&#xA;Message: {message}{newline}&#xA;Category: {category}{newline}&#xA;Priority: {priority}{newline}&#xA;EventId: {eventid}{newline}&#xA;Severity: {severity}{newline}&#xA;Title:{title}{newline}&#xA;Machine: {localMachine}{newline}&#xA;App Domain: {localAppDomain}{newline}&#xA;ProcessId: {localProcessId}{newline}&#xA;Process Name: {localProcessName}{newline}&#xA;Thread Name: {threadName}{newline}&#xA;Win32 ThreadId:{win32ThreadId}{newline}&#xA;Extended Properties: {dictionary({key} - {value}{newline})}"                 name="Text Formatter" />         </formatters>         <categorySources>             <add switchValue="All" name="General">                 <listeners>                     <add name="EntityTraceListener" />                 </listeners>             </add>         </categorySources>         <specialSources>             <allEvents switchValue="All" name="All Events" />             <notProcessed switchValue="All" name="Unprocessed Category">                 <listeners>                     <add name="EntityTraceListener" />                 </listeners>             </notProcessed>             <errors switchValue="All" name="Logging Errors &amp; Warnings">                 <listeners>                     <add name="EntityTraceListener" />                 </listeners>             </errors>         </specialSources>     </loggingConfiguration>

and then use:

Sidvall.SystemContext.Current.LogManager.Write("Message", Sidvall.Logging.LogCategories.WebApi, Logging.EventType.Information, "info");

Option 2:

To log using the LogManager put the following in your startup code:

Sidvall.Services.ServiceManager.Current.RegisterType<Sidvall.Logging.ILog, Sidvall.LogManager.Log>();

and then use:

Sidvall.SystemContext.Current.LogManager.Write("Message", Sidvall.Logging.LogCategories.WebApi, Logging.EventType.Information, "info");

Option 3:

To log without registration use:

Sidvall.LogManager.Log.Write(1, "Message", new string[] { "category 1" }, Logging.EventType.Information, "Title");

Management Tool

The management tool is available as a ClickOnce package.

Database

Database

Last edited Jul 2, 2014 at 8:58 AM by sidwall, version 6