logging (1)


Logging base con Enterprise Library 4.0

Semplice logging su file : 1: LogEntry logEntry = new LogEntry(); 2: logEntry.Message = “Test logging message”; 3: logEntry.Severity = System.Diagnostics.TraceEventType.Error; 4: logEntry.ExtendedProperties.Add(“Class”, “Program”); 5: logEntry.ExtendedProperties.Add(“Method”, “Main”); 6: Logger.Write(logEntry); App.config (contenente link a file di config esterno): 1: <?xml version=”1.0″ encoding=”utf-8″ ?> 2: <configuration> 3: <configSections> 4: <section name=”enterpriseLibrary.ConfigurationSource” type=”Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ /> […]