public EventSchemaTraceListener(String fileName, String name, int bufferSize, TraceLogRetentionOption logRetentionOption, long maximumFileSize, int maximumNumberOfFiles) { 
        if (bufferSize < 0) 
            throw new ArgumentOutOfRangeException(s_optionBufferSize, SR.GetString(SR.ArgumentOutOfRange_NeedNonNegNum));
        if (logRetentionOption < TraceLogRetentionOption.UnlimitedSequentialFiles || logRetentionOption > TraceLogRetentionOption.SingleFileBoundedSize)  
            throw new ArgumentOutOfRangeException(s_optionLogRetention, SR.GetString(SR.ArgumentOutOfRange_NeedValidLogRetention));

        base.Name = name;
        this.fileName = fileName; 

        if (!String.IsNullOrEmpty(this.fileName) && (fileName[0] != Path.DirectorySeparatorChar) && (fileName[0] != Path.AltDirectorySeparatorChar) && !Path.IsPathRooted(fileName)) {
		this.fileName = Path.Combine(Path.GetDirectoryName(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile), this.fileName);
        }

        this._retention = logRetentionOption;
        this._bufferSize = bufferSize;
        _SetMaxFileSize(maximumFileSize, false);
        _SetMaxNumberOfFiles(maximumNumberOfFiles, false);
    }
示例#2
0
        public EventSchemaTraceListener(String fileName, String name, int bufferSize, TraceLogRetentionOption logRetentionOption, long maximumFileSize, int maximumNumberOfFiles)
        {
            if (bufferSize < 0)
            {
                throw new ArgumentOutOfRangeException(s_optionBufferSize, SR.GetString(SR.ArgumentOutOfRange_NeedNonNegNum));
            }
            if (logRetentionOption < TraceLogRetentionOption.UnlimitedSequentialFiles || logRetentionOption > TraceLogRetentionOption.SingleFileBoundedSize)
            {
                throw new ArgumentOutOfRangeException(s_optionLogRetention, SR.GetString(SR.ArgumentOutOfRange_NeedValidLogRetention));
            }

            base.Name     = name;
            this.fileName = fileName;

            if (!String.IsNullOrEmpty(this.fileName) && (fileName[0] != Path.DirectorySeparatorChar) && (fileName[0] != Path.AltDirectorySeparatorChar) && !Path.IsPathRooted(fileName))
            {
                this.fileName = Path.Combine(Path.GetDirectoryName(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile), this.fileName);
            }

            this._retention  = logRetentionOption;
            this._bufferSize = bufferSize;
            _SetMaxFileSize(maximumFileSize, false);
            _SetMaxNumberOfFiles(maximumNumberOfFiles, false);
        }
 internal TraceWriter(string _fileName, int bufferSize, TraceLogRetentionOption retention, long maxFileSize, int maxNumberOfFiles) : base(CultureInfo.InvariantCulture)
 {
     this.m_lockObject = new object();
     this.stream       = new LogStream(_fileName, bufferSize, (LogRetentionOption)retention, maxFileSize, maxNumberOfFiles);
 }
 public EventSchemaTraceListener(String fileName, String name, int bufferSize, TraceLogRetentionOption logRetentionOption, long maximumFileSize) 
     : this(fileName, name, bufferSize, logRetentionOption, maximumFileSize, LogStream.DefaultNumberOfFiles) { 
 }
 internal TraceWriter(string _fileName, int bufferSize, TraceLogRetentionOption retention, long maxFileSize, int maxNumberOfFiles): base(CultureInfo.InvariantCulture) {
     stream = new LogStream(_fileName, bufferSize, (LogRetentionOption)retention, maxFileSize, maxNumberOfFiles);
 }
 public EventSchemaTraceListener(String fileName, String name, int bufferSize, TraceLogRetentionOption logRetentionOption) 
     : this(fileName, name, bufferSize, logRetentionOption, LogStream.DefaultFileSize) { 
 }
    private void Init() {
        if (!_initialized) {
            // We could use Interlocked but this one time overhead is probably not a concern
            lock (m_lockObject) {    
                if (!_initialized) {
                    try {
                        if (Attributes.ContainsKey(s_optionBufferSize)) {
                            int bufferSize = Int32.Parse(Attributes[s_optionBufferSize], CultureInfo.InvariantCulture);
                            if (bufferSize > 0) 
                                _bufferSize = bufferSize;
                        }

                        if (Attributes.ContainsKey(s_optionLogRetention)) {

                            // Enum.Parse is costly!
                            string retOption = Attributes[s_optionLogRetention];
                            
                            if (String.Compare(retOption, "SingleFileUnboundedSize", StringComparison.OrdinalIgnoreCase) == 0)
                                _retention = TraceLogRetentionOption.SingleFileUnboundedSize;
                            else if (String.Compare(retOption, "LimitedCircularFiles", StringComparison.OrdinalIgnoreCase) == 0)
                                _retention = TraceLogRetentionOption.LimitedCircularFiles;
                            else if (String.Compare(retOption, "UnlimitedSequentialFiles", StringComparison.OrdinalIgnoreCase) == 0)
                                _retention = TraceLogRetentionOption.UnlimitedSequentialFiles;
                            else if (String.Compare(retOption, "SingleFileBoundedSize", StringComparison.OrdinalIgnoreCase) == 0)
                                _retention = TraceLogRetentionOption.SingleFileBoundedSize;
                            else if (String.Compare(retOption, "LimitedSequentialFiles", StringComparison.OrdinalIgnoreCase) == 0)
                                _retention = TraceLogRetentionOption.LimitedSequentialFiles;
                            else {   
                                _retention = TraceLogRetentionOption.SingleFileUnboundedSize;
                            }
                        }

                        if (Attributes.ContainsKey(s_optionMaximumFileSize)) {
                            long maxFileSize = Int64.Parse(Attributes[s_optionMaximumFileSize], CultureInfo.InvariantCulture);
                            _SetMaxFileSize(maxFileSize, false);
                        }

                        if (Attributes.ContainsKey(s_optionMaximumNumberOfFiles)) {
                            int maxNumberOfFiles = Int32.Parse(Attributes[s_optionMaximumNumberOfFiles], CultureInfo.InvariantCulture);
                            _SetMaxNumberOfFiles(maxNumberOfFiles, false);
                        }
                    }
                    catch(Exception) {
                        // Avoid trhowing errors from populating config values, let the defaults stand
                        Debug.Assert(false, "Exception while populating config values for EventSchemaTraceListener!");
                    }
                    finally {
                        _initialized = true;
                    }
                }
            }
        }
    }
示例#8
0
 public EventSchemaTraceListener(String fileName, String name, int bufferSize, TraceLogRetentionOption logRetentionOption)
     : this(fileName, name, bufferSize, logRetentionOption, LogStream.DefaultFileSize)
 {
 }
示例#9
0
 public EventSchemaTraceListener(String fileName, String name, int bufferSize, TraceLogRetentionOption logRetentionOption, long maximumFileSize)
     : this(fileName, name, bufferSize, logRetentionOption, maximumFileSize, LogStream.DefaultNumberOfFiles)
 {
 }
 public EventSchemaTraceListener(string fileName, string name, int bufferSize, TraceLogRetentionOption logRetentionOption)
 {
 }
示例#11
0
        private void Init()
        {
            if (!_initialized)
            {
                // We could use Interlocked but this one time overhead is probably not a concern
                lock (m_lockObject) {
                    if (!_initialized)
                    {
                        try {
                            if (Attributes.ContainsKey(s_optionBufferSize))
                            {
                                int bufferSize = Int32.Parse(Attributes[s_optionBufferSize], CultureInfo.InvariantCulture);
                                if (bufferSize > 0)
                                {
                                    _bufferSize = bufferSize;
                                }
                            }

                            if (Attributes.ContainsKey(s_optionLogRetention))
                            {
                                // Enum.Parse is costly!
                                string retOption = Attributes[s_optionLogRetention];

                                if (String.Compare(retOption, "SingleFileUnboundedSize", StringComparison.OrdinalIgnoreCase) == 0)
                                {
                                    _retention = TraceLogRetentionOption.SingleFileUnboundedSize;
                                }
                                else if (String.Compare(retOption, "LimitedCircularFiles", StringComparison.OrdinalIgnoreCase) == 0)
                                {
                                    _retention = TraceLogRetentionOption.LimitedCircularFiles;
                                }
                                else if (String.Compare(retOption, "UnlimitedSequentialFiles", StringComparison.OrdinalIgnoreCase) == 0)
                                {
                                    _retention = TraceLogRetentionOption.UnlimitedSequentialFiles;
                                }
                                else if (String.Compare(retOption, "SingleFileBoundedSize", StringComparison.OrdinalIgnoreCase) == 0)
                                {
                                    _retention = TraceLogRetentionOption.SingleFileBoundedSize;
                                }
                                else if (String.Compare(retOption, "LimitedSequentialFiles", StringComparison.OrdinalIgnoreCase) == 0)
                                {
                                    _retention = TraceLogRetentionOption.LimitedSequentialFiles;
                                }
                                else
                                {
                                    _retention = TraceLogRetentionOption.SingleFileUnboundedSize;
                                }
                            }

                            if (Attributes.ContainsKey(s_optionMaximumFileSize))
                            {
                                long maxFileSize = Int64.Parse(Attributes[s_optionMaximumFileSize], CultureInfo.InvariantCulture);
                                _SetMaxFileSize(maxFileSize, false);
                            }

                            if (Attributes.ContainsKey(s_optionMaximumNumberOfFiles))
                            {
                                int maxNumberOfFiles = Int32.Parse(Attributes[s_optionMaximumNumberOfFiles], CultureInfo.InvariantCulture);
                                _SetMaxNumberOfFiles(maxNumberOfFiles, false);
                            }
                        }
                        catch (Exception) {
                            // Avoid trhowing errors from populating config values, let the defaults stand
                            Debug.Assert(false, "Exception while populating config values for EventSchemaTraceListener!");
                        }
                        finally {
                            _initialized = true;
                        }
                    }
                }
            }
        }
 public EventSchemaTraceListener(string fileName, string name, int bufferSize, TraceLogRetentionOption logRetentionOption, long maximumFileSize)
 {
 }
 public EventSchemaTraceListener(string fileName, string name, int bufferSize, TraceLogRetentionOption logRetentionOption)
 {
 }
 public EventSchemaTraceListener(string fileName, string name, int bufferSize, TraceLogRetentionOption logRetentionOption, long maximumFileSize)
 {
 }
 public EventSchemaTraceListener(string fileName, string name, int bufferSize, TraceLogRetentionOption logRetentionOption, long maximumFileSize, int maximumNumberOfFiles)
 {
     throw new NotImplementedException();
 }
 public EventSchemaTraceListener(string fileName, string name, int bufferSize, TraceLogRetentionOption logRetentionOption)
 {
     throw new NotImplementedException();
 }