Skip to content

Instantly share code, notes, and snippets.

@kkamegawa
Created July 9, 2014 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkamegawa/7d50a2b4e37be0646d84 to your computer and use it in GitHub Desktop.
Save kkamegawa/7d50a2b4e37be0646d84 to your computer and use it in GitHub Desktop.
Enterprise 6.0 Logging
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