コード例 #1
0
ファイル: NzbDroneLogger.cs プロジェクト: marodev/Radarr
        private static void RegisterAppFile(IAppFolderInfo appFolderInfo, string name, string fileName, int maxArchiveFiles, LogLevel minLogLevel)
        {
            var fileTarget = new NzbDroneFileTarget();

            fileTarget.Name                        = name;
            fileTarget.FileName                    = Path.Combine(appFolderInfo.GetLogFolder(), fileName);
            fileTarget.AutoFlush                   = true;
            fileTarget.KeepFileOpen                = false;
            fileTarget.ConcurrentWrites            = false;
            fileTarget.ConcurrentWriteAttemptDelay = 50;
            fileTarget.ConcurrentWriteAttempts     = 10;
            fileTarget.ArchiveAboveSize            = 1024000;
            fileTarget.MaxArchiveFiles             = maxArchiveFiles;
            fileTarget.EnableFileDelete            = true;
            fileTarget.ArchiveNumbering            = ArchiveNumberingMode.Rolling;
            fileTarget.Layout                      = FILE_LOG_LAYOUT;

            var loggingRule = new LoggingRule("*", minLogLevel, fileTarget);

            LogManager.Configuration.AddTarget(name, fileTarget);
            LogManager.Configuration.LoggingRules.Add(loggingRule);
        }
コード例 #2
0
        private static void RegisterAppFile(IAppFolderInfo appFolderInfo)
        {
            var fileTarget = new NzbDroneFileTarget();

            fileTarget.Name                        = "rollingFileLogger";
            fileTarget.FileName                    = Path.Combine(appFolderInfo.GetLogFolder(), "nzbdrone.txt");
            fileTarget.AutoFlush                   = true;
            fileTarget.KeepFileOpen                = false;
            fileTarget.ConcurrentWrites            = false;
            fileTarget.ConcurrentWriteAttemptDelay = 50;
            fileTarget.ConcurrentWriteAttempts     = 10;
            fileTarget.ArchiveAboveSize            = 1024000;
            fileTarget.MaxArchiveFiles             = 5;
            fileTarget.EnableFileDelete            = true;
            fileTarget.ArchiveNumbering            = ArchiveNumberingMode.Rolling;
            fileTarget.Layout                      = FILE_LOG_LAYOUT;

            var loggingRule = new LoggingRule("*", LogLevel.Trace, fileTarget);

            LogManager.Configuration.AddTarget("appfile", fileTarget);
            LogManager.Configuration.LoggingRules.Add(loggingRule);
        }
コード例 #3
0
ファイル: LogTargets.cs プロジェクト: niel/NzbDrone
        private static void RegisterAppFile(IAppFolderInfo appFolderInfo)
        {
            var fileTarget = new NzbDroneFileTarget();

            fileTarget.Name = "rollingFileLogger";
            fileTarget.FileName = Path.Combine(appFolderInfo.GetLogFolder(), "nzbdrone.txt");
            fileTarget.AutoFlush = true;
            fileTarget.KeepFileOpen = false;
            fileTarget.ConcurrentWrites = false;
            fileTarget.ConcurrentWriteAttemptDelay = 50;
            fileTarget.ConcurrentWriteAttempts = 10;
            fileTarget.ArchiveAboveSize = 1024000;
            fileTarget.MaxArchiveFiles = 5;
            fileTarget.EnableFileDelete = true;
            fileTarget.ArchiveNumbering = ArchiveNumberingMode.Rolling;
            fileTarget.Layout = FILE_LOG_LAYOUT;

            var loggingRule = new LoggingRule("*", LogLevel.Info, fileTarget);

            LogManager.Configuration.AddTarget("appfile", fileTarget);
            LogManager.Configuration.LoggingRules.Add(loggingRule);
        }
コード例 #4
0
        private static LoggingRule RegisterAppFile(IAppFolderInfo appFolderInfo, string name, string fileName, int maxArchiveFiles, LogLevel minLogLevel)
        {
            var fileTarget = new NzbDroneFileTarget();

            fileTarget.Name = name;
            fileTarget.FileName = Path.Combine(appFolderInfo.GetLogFolder(), fileName);
            fileTarget.AutoFlush = true;
            fileTarget.KeepFileOpen = false;
            fileTarget.ConcurrentWrites = false;
            fileTarget.ConcurrentWriteAttemptDelay = 50;
            fileTarget.ConcurrentWriteAttempts = 10;
            fileTarget.ArchiveAboveSize = 1024000;
            fileTarget.MaxArchiveFiles = maxArchiveFiles;
            fileTarget.EnableFileDelete = true;
            fileTarget.ArchiveNumbering = ArchiveNumberingMode.Rolling;
            fileTarget.Layout = FILE_LOG_LAYOUT;

            var loggingRule = new LoggingRule("*", minLogLevel, fileTarget);

            LogManager.Configuration.AddTarget(name, fileTarget);
            LogManager.Configuration.LoggingRules.Add(loggingRule);

            return loggingRule;
        }