Created
July 9, 2014 19:43
-
-
Save kkamegawa/7d50a2b4e37be0646d84 to your computer and use it in GitHub Desktop.
Enterprise 6.0 Logging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Diagnostics; | |
using Microsoft.Practices.EnterpriseLibrary.Logging; | |
using Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners; | |
namespace LogBlock | |
{ | |
class Program | |
{ | |
public void FlatText() | |
{ | |
var textWriter = new TextWriterTraceListener("test.txt"); | |
textWriter.WriteLine("Enterprise 6.0 Log"); | |
textWriter.Close(); | |
} | |
public void Logging() | |
{ | |
var config = new LoggingConfiguration(); | |
var flatTextFormatter = new FlatFileTraceListener("flatfilelog.txt", "--start here--", "--end here--"); | |
config.AddLogSource("Level1", SourceLevels.All, true, flatTextFormatter); | |
var writer = new LogWriter(config); | |
writer.Write("Test"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment