static void Main()
 {
     Logger logger = new Logger(new FileAppender(new SimpleLayout(), "log.txt"));
     logger.Critical("asdasd");
     logger.Warn("asdasd");
     logger.Info("asdasd");
 }
예제 #2
0
        public static void Main()
        {
            var simpleLayout = new SimpleLayout();
            var consoleAppender = new ConsoleAppender(simpleLayout);
            var fileAppender = new FileAppender(simpleLayout);
            fileAppender.File = "../../log.txt";
            fileAppender.ReportLevel = ReportLevel.Warning;
            consoleAppender.ReportLevel = ReportLevel.Error;

            var logger = new Logger(consoleAppender, fileAppender);

            logger.Info("Everything seems fine");
            logger.Warn("Warning: ping is too high - disconnect imminent");
            logger.Error("Error parsing request");
            logger.Critical("No connection string found in App.config");
            logger.Fatal("mscorlib.dll does not respond");
        }