Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FileTarget" /> class.
        /// </summary>
        /// <remarks>
        /// The default value of the layout is: <code>${longdate}|${level:uppercase=true}|${logger}|${message}</code>
        /// </remarks>
        public FileTarget()
        {
            this.ArchiveNumbering            = ArchiveNumberingMode.Sequence;
            this._MaxArchiveFilesField       = 9;
            this.ConcurrentWriteAttemptDelay = 1;
            this.ArchiveEvery            = FileArchivePeriod.None;
            this.ArchiveAboveSize        = -1;
            this.ConcurrentWriteAttempts = 10;
            this.ConcurrentWrites        = true;
#if SILVERLIGHT
            this.Encoding = Encoding.UTF8;
#else
            this.Encoding = Encoding.Default;
#endif
            this.BufferSize = 32768;
            this.AutoFlush  = true;
#if !SILVERLIGHT && !NET_CF
            this.FileAttributes = Win32FileAttributes.Normal;
#endif
            this.NewLineChars              = EnvironmentHelper.NewLine;
            this.EnableFileDelete          = true;
            this.OpenFileCacheTimeout      = -1;
            this.OpenFileCacheSize         = 5;
            this.CreateDirs                = true;
            this.dynamicArchiveFileHandler = new DynamicArchiveFileHandlerClass(MaxArchiveFiles);
            this.ForceManaged              = false;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FileTarget" /> class.
        /// </summary>
        /// <remarks>
        /// The default value of the layout is: <code>${longdate}|${level:uppercase=true}|${logger}|${message}</code>
        /// </remarks>
        public FileTarget()
        {
            this.ArchiveNumbering = ArchiveNumberingMode.Sequence;
            this._MaxArchiveFilesField = 9;
            this.ConcurrentWriteAttemptDelay = 1;
            this.ArchiveEvery = FileArchivePeriod.None;
            this.ArchiveAboveSize = -1;
            this.ConcurrentWriteAttempts = 10;
            this.ConcurrentWrites = true;
#if SILVERLIGHT
            this.Encoding = Encoding.UTF8;
#else
            this.Encoding = Encoding.Default;
#endif
            this.BufferSize = 32768;
            this.AutoFlush = true;
#if !SILVERLIGHT && !NET_CF
            this.FileAttributes = Win32FileAttributes.Normal;
#endif
            this.NewLineChars = EnvironmentHelper.NewLine;
            this.EnableFileDelete = true;
            this.OpenFileCacheTimeout = -1;
            this.OpenFileCacheSize = 5;
            this.CreateDirs = true;
            this.dynamicArchiveFileHandler = new DynamicArchiveFileHandlerClass(MaxArchiveFiles);
            this.ForceManaged = false;
            this.ArchiveDateFormat = string.Empty;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes file logging by creating data structures that
        /// enable efficient multi-file logging.
        /// </summary>
        protected override void InitializeTarget()
        {
            base.InitializeTarget();
            this.isolatedStorageFile = IsolatedStorageFile.GetStore(Scope, null, null);
            this.dynamicArchiveFileHandler = new DynamicArchiveFileHandlerClass(MaxArchiveFiles, isolatedStorageFile);
            this.recentAppenders = new IsolatedStorageFileAppender[this.OpenFileCacheSize];

            if ((this.OpenFileCacheSize > 0 || this.EnableFileDelete) && this.OpenFileCacheTimeout > 0)
            {
                this.autoClosingTimer = new Timer(
                    this.AutoClosingTimerCallback,
                    null,
                    this.OpenFileCacheTimeout * 1000,
                    this.OpenFileCacheTimeout * 1000);
            }

            // Console.Error.WriteLine("Name: {0} Factory: {1}", this.Name, this.appenderFactory.GetType().FullName);
        }