Last active
January 3, 2018 12:02
-
-
Save ilivewithian/6bf8c0e841456e2431645cfba9629c07 to your computer and use it in GitHub Desktop.
Simple Log4Net Config
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
public static class Logger | |
{ | |
public static ILog Create() | |
{ | |
var hierarchy = (Hierarchy)LogManager.GetRepository(typeof(Logger).Assembly); | |
hierarchy.Root.RemoveAllAppenders(); | |
var pl = new PatternLayout(); | |
pl.ConversionPattern = "%d [%t] %-5p %m%n"; | |
pl.ActivateOptions(); | |
var consoleAppender = new ConsoleAppender(); | |
consoleAppender.Layout = pl; | |
consoleAppender.ActivateOptions(); | |
BasicConfigurator.Configure(hierarchy, consoleAppender); | |
return LogManager.GetLogger(typeof(Logger)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment