public static IAppender CreateDebugAppender(Level threshold) {
            var layout = new PatternLayout("%date %-5level %logger - %message%newline");
            layout.ActivateOptions();

            var appender = new DebugAppender() {
                Threshold = threshold,
                Layout = layout
            };

            appender.ActivateOptions();

            return appender;
        }
 internal static DebugAppender BuildDebugLog(ListeningLogOptions options)
 {
     var layout = new PatternLayout
     {
         ConversionPattern = options.Pattern
     };
     layout.ActivateOptions();
     var appender = new DebugAppender
     {
         Layout = layout,
         ImmediateFlush = options.ImmediateFlush
     };
     appender.ActivateOptions();
     return appender;
 }
        public static void Configure(string logFilesFolderPath, Log4NetConfigurator configurator)
        {
            if (logFilesFolderPath.StartsWith("~")) logFilesFolderPath = logFilesFolderPath.Substring(1);
            if (logFilesFolderPath.StartsWith("/")) logFilesFolderPath = logFilesFolderPath.Substring(1);

            var hierarchy = (Hierarchy)LogManager.GetRepository();

            hierarchy.Root.Level = Level.Warn;
            hierarchy.Configured = true;

            var patternLayout = new PatternLayout
            {
                ConversionPattern = "%date [%thread] %-5level %logger - %P{Tenant} - %message%newline"
            };
            patternLayout.ActivateOptions();

            var debugFileAppender = BaseFileAppender(patternLayout);
            debugFileAppender.Name = "debug-file";
            debugFileAppender.File = Path.Combine(logFilesFolderPath, "orchard-debug");
            debugFileAppender.ActivateOptions();
            hierarchy.Root.AddAppender(debugFileAppender);

            var errorFileAppender = BaseFileAppender(patternLayout);
            errorFileAppender.Name = "error-file";
            errorFileAppender.File = Path.Combine(logFilesFolderPath, "orchard-error");
            var levelFilter = new LevelRangeFilter { LevelMin = Level.Error };
            levelFilter.ActivateOptions();
            errorFileAppender.AddFilter(levelFilter);
            errorFileAppender.ActivateOptions();
            hierarchy.Root.AddAppender(errorFileAppender);

            var simpleLayout = new SimpleLayout();
            simpleLayout.ActivateOptions();
            var debuggerAppender = new DebugAppender();
            debuggerAppender.Name = "debugger";
            debuggerAppender.ImmediateFlush = true;
            debuggerAppender.Layout = simpleLayout;
            debuggerAppender.ActivateOptions();
            hierarchy.Root.AddAppender(debuggerAppender);

            GetLogger("Orchard").AddAppender(debuggerAppender);
            GetLogger("Orchard.Localization").Level = Level.Warn;
            GetLogger("NHibernate.Cache").Level = Level.Error;
            GetLogger("NHibernate.AdoNet.AbstractBatcher").Level = Level.Off;
            GetLogger("NHibernate.Util.ADOExceptionReporter").Level = Level.Off;

            configurator(hierarchy);
        }