diff --git a/BUILDING.md b/BUILDING.md index f8de5e2c..2330e8cf 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -32,6 +32,7 @@ Options: - `npm run build` - optionally `npm test` to run all tests - optionally `npm run release` to generate release artifacts +- build via docker for windows, using the `build-with-docker-for-windows.bat` script - build via the vs2019 Windows AppVeyer image. There is an appveyer.yml file included which (should) build if you set up AppVeyer to track your fork. AppVeyer is free for open-source projects. diff --git a/package-lock.json b/package-lock.json index 5368c2fd..e02ddb9e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "log4net", - "version": "2.0.9", + "version": "2.0.12", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2623,9 +2623,9 @@ } }, "gulp-zip": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/gulp-zip/-/gulp-zip-5.0.1.tgz", - "integrity": "sha512-M/IWLh9RvOpuofDZkgDirtiyz9J3yIqnDOJ3muzk2D/XnZ1ruqPlPLRIpXnl/aZU+xXwKPdOIxjRzkUcVEQyZQ==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/gulp-zip/-/gulp-zip-5.0.2.tgz", + "integrity": "sha512-rZd0Ppuc8Bf7J2/WzcdNaeb+lcEXf1R8mV/PJ9Kdu7PmnInWVeLSmiXIka/2QSe6uhAsGVFAMffWSaMzAPGTBg==", "dev": true, "requires": { "get-stream": "^5.1.0", @@ -2636,9 +2636,9 @@ }, "dependencies": { "get-stream": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", - "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", "dev": true, "requires": { "pump": "^3.0.0" @@ -5488,11 +5488,12 @@ "dev": true }, "through2": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.1.tgz", - "integrity": "sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz", + "integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==", "dev": true, "requires": { + "inherits": "^2.0.4", "readable-stream": "2 || 3" } }, diff --git a/package.json b/package.json index 09ab351c..b535be67 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,11 @@ { "name": "log4net", - "version": "2.0.9", + "version": "2.0.12", "description": "Log4Net is a logging framework for .NET", "scripts": { "test": "cross-env NUNIT_PROCESS=Single MAX_CONCURRENCY=1 run-s clean-build \"zarro test-dotnet\" run-dotnet-core-tests", + "test-xplatform": "run-s build-xplatform run-dotnet-core-tests", + "build-xplatform": "cross-env DOTNET_CORE=1 BUILD_CONFIGURATION=CrossPlatform run-s build", "run-dotnet-core-tests": "cross-env DOTNET_CORE=1 run-s \"zarro quick-test-dotnet\"", "clean-build": "rimraf build", "build": "run-s clean-build \"zarro build\"", @@ -27,7 +29,7 @@ "homepage": "https://github.com/fluffynuts/logging-log4net#readme", "devDependencies": { "cross-env": "^7.0.2", - "gulp-zip": "^5.0.1", + "gulp-zip": "^5.0.2", "npm-run-all": "^4.1.5", "rimraf": "^3.0.2", "simple-git": "^2.20.1", diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 00000000..41fa9c90 --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,5 @@ + + + true + + diff --git a/src/MonoForFramework.targets b/src/MonoForFramework.targets new file mode 100644 index 00000000..4209d58f --- /dev/null +++ b/src/MonoForFramework.targets @@ -0,0 +1,28 @@ + + + + + + /Library/Frameworks/Mono.framework/Versions/Current/lib/mono + /usr/lib/mono + /usr/local/lib/mono + + $(BaseFrameworkPathOverrideForMono)/2.0-api + $(BaseFrameworkPathOverrideForMono)/3.5-api + $(BaseFrameworkPathOverrideForMono)/4.0-api + $(BaseFrameworkPathOverrideForMono)/4.5-api + $(BaseFrameworkPathOverrideForMono)/4.5.1-api + $(BaseFrameworkPathOverrideForMono)/4.5.2-api + $(BaseFrameworkPathOverrideForMono)/4.6-api + $(BaseFrameworkPathOverrideForMono)/4.6.1-api + $(BaseFrameworkPathOverrideForMono)/4.6.2-api + $(BaseFrameworkPathOverrideForMono)/4.7-api + $(BaseFrameworkPathOverrideForMono)/4.7.1-api + $(BaseFrameworkPathOverrideForMono)/4.7.2-api + $(BaseFrameworkPathOverrideForMono)/4.8-api + true + + $(FrameworkPathOverride)/Facades;$(AssemblySearchPaths) + + + diff --git a/src/log4net.Tests/LoggerRepository/ConfigurationMessages.cs b/src/log4net.Tests/LoggerRepository/ConfigurationMessages.cs index e9a88778..daa26724 100644 --- a/src/log4net.Tests/LoggerRepository/ConfigurationMessages.cs +++ b/src/log4net.Tests/LoggerRepository/ConfigurationMessages.cs @@ -80,7 +80,7 @@ static void rep_ConfigurationChanged(object sender, EventArgs e) public class LogLogAppender : AppenderSkeleton { - private readonly static Type declaringType = typeof(LogLogAppender); + private static readonly Type declaringType = typeof(LogLogAppender); public override void ActivateOptions() { diff --git a/src/log4net.Tests/log4net.Tests.csproj b/src/log4net.Tests/log4net.Tests.csproj index 6af4bf90..7da2aaf4 100644 --- a/src/log4net.Tests/log4net.Tests.csproj +++ b/src/log4net.Tests/log4net.Tests.csproj @@ -27,6 +27,8 @@ true ..\..\log4net.snk bin\$(Configuration) + Debug;Release;CrossPlatform + AnyCPU 285212672 @@ -60,6 +62,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -82,4 +88,5 @@ - \ No newline at end of file + + diff --git a/src/log4net.sln b/src/log4net.sln index e6e79280..c08c55c2 100644 --- a/src/log4net.sln +++ b/src/log4net.sln @@ -28,16 +28,21 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU + CrossPlatform|Any CPU = CrossPlatform|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {181FE707-E161-4722-9F38-6AAAB6FAA106}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {181FE707-E161-4722-9F38-6AAAB6FAA106}.Debug|Any CPU.Build.0 = Debug|Any CPU {181FE707-E161-4722-9F38-6AAAB6FAA106}.Release|Any CPU.ActiveCfg = Release|Any CPU {181FE707-E161-4722-9F38-6AAAB6FAA106}.Release|Any CPU.Build.0 = Release|Any CPU + {181FE707-E161-4722-9F38-6AAAB6FAA106}.CrossPlatform|Any CPU.ActiveCfg = CrossPlatform|Any CPU + {181FE707-E161-4722-9F38-6AAAB6FAA106}.CrossPlatform|Any CPU.Build.0 = CrossPlatform|Any CPU {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Debug|Any CPU.Build.0 = Debug|Any CPU {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Release|Any CPU.ActiveCfg = Release|Any CPU {B0530F10-0238-49A9-93B0-8EF412E90BCF}.Release|Any CPU.Build.0 = Release|Any CPU + {B0530F10-0238-49A9-93B0-8EF412E90BCF}.CrossPlatform|Any CPU.ActiveCfg = CrossPlatform|Any CPU + {B0530F10-0238-49A9-93B0-8EF412E90BCF}.CrossPlatform|Any CPU.Build.0 = CrossPlatform|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/log4net/Appender/AdoNetAppender.cs b/src/log4net/Appender/AdoNetAppender.cs index 72a5a762..dd9939ba 100644 --- a/src/log4net/Appender/AdoNetAppender.cs +++ b/src/log4net/Appender/AdoNetAppender.cs @@ -407,7 +407,7 @@ protected IDbConnection Connection /// must be called again. /// /// - override public void ActivateOptions() + public override void ActivateOptions() { base.ActivateOptions(); @@ -431,7 +431,7 @@ override public void ActivateOptions() /// Closes the database command and database connection. /// /// - override protected void OnClose() + protected override void OnClose() { base.OnClose(); DiposeConnection(); @@ -451,7 +451,7 @@ override protected void OnClose() /// array into the database. /// /// - override protected void SendBuffer(LoggingEvent[] events) + protected override void SendBuffer(LoggingEvent[] events) { if (ReconnectOnError && (Connection == null || Connection.State != ConnectionState.Open)) { @@ -536,7 +536,7 @@ public void AddParameter(AdoNetAppenderParameter parameter) /// property for more information. /// /// - virtual protected void SendBuffer(IDbTransaction dbTran, LoggingEvent[] events) + protected virtual void SendBuffer(IDbTransaction dbTran, LoggingEvent[] events) { // string.IsNotNullOrWhiteSpace() does not exist in ancient .NET frameworks if (CommandText != null && CommandText.Trim() != "") @@ -608,7 +608,7 @@ virtual protected void SendBuffer(IDbTransaction dbTran, LoggingEvent[] events) /// /// Text that can be passed to a . /// - virtual protected string GetLogStatement(LoggingEvent logEvent) + protected virtual string GetLogStatement(LoggingEvent logEvent) { if (Layout == null) { @@ -632,7 +632,7 @@ virtual protected string GetLogStatement(LoggingEvent logEvent) /// The of the object. /// The connectionString output from the ResolveConnectionString method. /// An instance with a valid connection string. - virtual protected IDbConnection CreateConnection(Type connectionType, string connectionString) + protected virtual IDbConnection CreateConnection(Type connectionType, string connectionString) { IDbConnection connection = (IDbConnection)Activator.CreateInstance(connectionType); connection.ConnectionString = connectionString; @@ -648,7 +648,7 @@ virtual protected IDbConnection CreateConnection(Type connectionType, string con /// /// Additional information describing the connection string. /// A connection string used to connect to the database. - virtual protected string ResolveConnectionString(out string connectionStringContext) + protected virtual string ResolveConnectionString(out string connectionStringContext) { if (ConnectionString != null && ConnectionString.Length > 0) { @@ -702,7 +702,7 @@ virtual protected string ResolveConnectionString(out string connectionStringCont /// /// /// The of the ADO.NET provider - virtual protected Type ResolveConnectionType() + protected virtual Type ResolveConnectionType() { try { @@ -858,7 +858,7 @@ private void DiposeConnection() /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(AdoNetAppender); + private static readonly Type declaringType = typeof(AdoNetAppender); #endregion Private Static Fields } @@ -1053,7 +1053,7 @@ public IRawLayout Layout /// this parameter to its collection of parameters. /// /// - virtual public void Prepare(IDbCommand command) + public virtual void Prepare(IDbCommand command) { // Create a new parameter IDbDataParameter param = command.CreateParameter(); @@ -1093,7 +1093,7 @@ virtual public void Prepare(IDbCommand command) /// object. Sets the value of the parameter on the command object. /// /// - virtual public void FormatValue(IDbCommand command, LoggingEvent loggingEvent) + public virtual void FormatValue(IDbCommand command, LoggingEvent loggingEvent) { // Lookup the parameter IDbDataParameter param = (IDbDataParameter)command.Parameters[ParameterName]; diff --git a/src/log4net/Appender/AnsiColorTerminalAppender.cs b/src/log4net/Appender/AnsiColorTerminalAppender.cs index 2f074766..50a6875c 100644 --- a/src/log4net/Appender/AnsiColorTerminalAppender.cs +++ b/src/log4net/Appender/AnsiColorTerminalAppender.cs @@ -246,7 +246,7 @@ public AnsiColorTerminalAppender() /// This is either "Console.Out" or "Console.Error". /// /// - virtual public string Target + public virtual string Target { get { return m_writeToErrorStream ? ConsoleError : ConsoleOut; } set @@ -296,7 +296,7 @@ public void AddMapping(LevelColors mapping) /// The format of the output will depend on the appender's layout. /// /// - override protected void Append(log4net.Core.LoggingEvent loggingEvent) + protected override void Append(log4net.Core.LoggingEvent loggingEvent) { string loggingMessage = RenderLoggingEvent(loggingEvent); @@ -366,7 +366,7 @@ override protected void Append(log4net.Core.LoggingEvent loggingEvent) /// This appender requires a to be set. /// /// - override protected bool RequiresLayout + protected override bool RequiresLayout { get { return true; } } diff --git a/src/log4net/Appender/AppenderCollection.cs b/src/log4net/Appender/AppenderCollection.cs index 21987b84..14f2304b 100644 --- a/src/log4net/Appender/AppenderCollection.cs +++ b/src/log4net/Appender/AppenderCollection.cs @@ -160,7 +160,7 @@ public AppenderCollection(ICollection col) /// Used to access protected constructor /// /// - internal protected enum Tag + protected internal enum Tag { /// /// A value @@ -173,7 +173,7 @@ internal protected enum Tag /// /// /// - internal protected AppenderCollection(Tag tag) + protected internal AppenderCollection(Tag tag) { m_array = null; } diff --git a/src/log4net/Appender/AppenderSkeleton.cs b/src/log4net/Appender/AppenderSkeleton.cs index 44fb6904..44b68c75 100644 --- a/src/log4net/Appender/AppenderSkeleton.cs +++ b/src/log4net/Appender/AppenderSkeleton.cs @@ -121,7 +121,7 @@ public Level Threshold /// implementation for the property. /// /// - virtual public IErrorHandler ErrorHandler + public virtual IErrorHandler ErrorHandler { get { return this.m_errorHandler; } set @@ -152,7 +152,7 @@ virtual public IErrorHandler ErrorHandler /// and so all Filters on this Appender are available through the result. /// /// - virtual public IFilter FilterHead + public virtual IFilter FilterHead { get { return m_headFilter; } } @@ -167,7 +167,7 @@ virtual public IFilter FilterHead /// /// /// - virtual public ILayout Layout + public virtual ILayout Layout { get { return m_layout; } set { m_layout = value; } @@ -193,7 +193,7 @@ virtual public ILayout Layout /// must be called again. /// /// - virtual public void ActivateOptions() + public virtual void ActivateOptions() { } @@ -479,7 +479,7 @@ public void DoAppend(LoggingEvent[] loggingEvents) /// /// /// - virtual protected bool FilterEvent(LoggingEvent loggingEvent) + protected virtual bool FilterEvent(LoggingEvent loggingEvent) { if (!IsAsSevereAsThreshold(loggingEvent.Level)) { @@ -523,7 +523,7 @@ virtual protected bool FilterEvent(LoggingEvent loggingEvent) /// back of the filter chain. /// /// - virtual public void AddFilter(IFilter filter) + public virtual void AddFilter(IFilter filter) { if (filter == null) { @@ -549,7 +549,7 @@ virtual public void AddFilter(IFilter filter) /// Clears the filter list for this appender. /// /// - virtual public void ClearFilters() + public virtual void ClearFilters() { m_headFilter = m_tailFilter = null; } @@ -571,7 +571,7 @@ virtual public void ClearFilters() /// true if the meets the /// requirements of this appender. /// - virtual protected bool IsAsSevereAsThreshold(Level level) + protected virtual bool IsAsSevereAsThreshold(Level level) { return ((m_threshold == null) || level >= m_threshold); } @@ -589,7 +589,7 @@ virtual protected bool IsAsSevereAsThreshold(Level level) /// It is a programming error to append to a closed appender. /// /// - virtual protected void OnClose() + protected virtual void OnClose() { // Do nothing by default } @@ -612,7 +612,7 @@ virtual protected void OnClose() /// override the method. /// /// - abstract protected void Append(LoggingEvent loggingEvent); + protected abstract void Append(LoggingEvent loggingEvent); /// /// Append a bulk array of logging events. @@ -628,7 +628,7 @@ virtual protected void OnClose() /// override this method in addition to . /// /// - virtual protected void Append(LoggingEvent[] loggingEvents) + protected virtual void Append(LoggingEvent[] loggingEvents) { foreach(LoggingEvent loggingEvent in loggingEvents) { @@ -654,7 +654,7 @@ virtual protected void Append(LoggingEvent[] loggingEvents) /// /// /// true if the call to should proceed. - virtual protected bool PreAppendCheck() + protected virtual bool PreAppendCheck() { if ((m_layout == null) && RequiresLayout) { @@ -775,7 +775,7 @@ protected void RenderLoggingEvent(TextWriter writer, LoggingEvent loggingEvent) /// /// true if the appender requires a layout object, otherwise false. /// - virtual protected bool RequiresLayout + protected virtual bool RequiresLayout { get { return false; } } @@ -902,7 +902,7 @@ public virtual bool Flush(int millisecondsTimeout) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(AppenderSkeleton); + private static readonly Type declaringType = typeof(AppenderSkeleton); #endregion Private Static Fields } diff --git a/src/log4net/Appender/AspNetTraceAppender.cs b/src/log4net/Appender/AspNetTraceAppender.cs index a8e3f522..bffa0459 100644 --- a/src/log4net/Appender/AspNetTraceAppender.cs +++ b/src/log4net/Appender/AspNetTraceAppender.cs @@ -85,7 +85,7 @@ public AspNetTraceAppender() /// (). /// /// - override protected void Append(LoggingEvent loggingEvent) + protected override void Append(LoggingEvent loggingEvent) { // check if log4net is running in the context of an ASP.NET application if (HttpContext.Current != null) @@ -114,7 +114,7 @@ override protected void Append(LoggingEvent loggingEvent) /// This appender requires a to be set. /// /// - override protected bool RequiresLayout + protected override bool RequiresLayout { get { return true; } } diff --git a/src/log4net/Appender/BufferingAppenderSkeleton.cs b/src/log4net/Appender/BufferingAppenderSkeleton.cs index 91b49f45..c49d8382 100644 --- a/src/log4net/Appender/BufferingAppenderSkeleton.cs +++ b/src/log4net/Appender/BufferingAppenderSkeleton.cs @@ -222,7 +222,7 @@ public ITriggeringEventEvaluator LossyEvaluator /// /// [Obsolete("Use Fix property")] - virtual public bool OnlyFixPartialEventData + public virtual bool OnlyFixPartialEventData { get { return (Fix == FixFlags.Partial); } set @@ -252,7 +252,7 @@ virtual public bool OnlyFixPartialEventData /// /// /// - virtual public FixFlags Fix + public virtual FixFlags Fix { get { return m_fixFlags; } set { m_fixFlags = value; } @@ -381,7 +381,7 @@ public virtual void Flush(bool flushLossyBuffer) /// must be called again. /// /// - override public void ActivateOptions() + public override void ActivateOptions() { base.ActivateOptions(); @@ -417,7 +417,7 @@ override public void ActivateOptions() /// the buffer must be sent when the appender is closed. /// /// - override protected void OnClose() + protected override void OnClose() { // Flush the buffer on close Flush(true); @@ -453,7 +453,7 @@ override protected void OnClose() /// is processed. /// /// - override protected void Append(LoggingEvent loggingEvent) + protected override void Append(LoggingEvent loggingEvent) { // If the buffer size is set to 1 or less then the buffer will be // sent immediately because there is not enough space in the buffer @@ -542,7 +542,7 @@ override protected void Append(LoggingEvent loggingEvent) /// The subclass must override . /// /// - virtual protected void SendFromBuffer(LoggingEvent firstLoggingEvent, CyclicBuffer buffer) + protected virtual void SendFromBuffer(LoggingEvent firstLoggingEvent, CyclicBuffer buffer) { LoggingEvent[] bufferEvents = buffer.PopAll(); @@ -576,7 +576,7 @@ virtual protected void SendFromBuffer(LoggingEvent firstLoggingEvent, CyclicBuff /// The subclass must override this method to process the buffered events. /// /// - abstract protected void SendBuffer(LoggingEvent[] events); + protected abstract void SendBuffer(LoggingEvent[] events); #region Private Static Fields diff --git a/src/log4net/Appender/BufferingForwardingAppender.cs b/src/log4net/Appender/BufferingForwardingAppender.cs index 17d02b89..20c36241 100644 --- a/src/log4net/Appender/BufferingForwardingAppender.cs +++ b/src/log4net/Appender/BufferingForwardingAppender.cs @@ -74,7 +74,7 @@ public BufferingForwardingAppender() /// It is a programming error to append to a closed appender. /// /// - override protected void OnClose() + protected override void OnClose() { // Remove all the attached appenders lock(this) @@ -102,7 +102,7 @@ override protected void OnClose() /// Forwards the events to the attached appenders. /// /// - override protected void SendBuffer(LoggingEvent[] events) + protected override void SendBuffer(LoggingEvent[] events) { // Pass the logging event on to the attached appenders if (m_appenderAttachedImpl != null) @@ -126,7 +126,7 @@ override protected void SendBuffer(LoggingEvent[] events) /// appenders, then it won't be added again. /// /// - virtual public void AddAppender(IAppender newAppender) + public virtual void AddAppender(IAppender newAppender) { if (newAppender == null) { @@ -153,7 +153,7 @@ virtual public void AddAppender(IAppender newAppender) /// /// A collection of the appenders in this appender. /// - virtual public AppenderCollection Appenders + public virtual AppenderCollection Appenders { get { @@ -183,7 +183,7 @@ virtual public AppenderCollection Appenders /// Get the named appender attached to this buffering appender. /// /// - virtual public IAppender GetAppender(string name) + public virtual IAppender GetAppender(string name) { lock(this) { @@ -204,7 +204,7 @@ virtual public IAppender GetAppender(string name) /// This is useful when re-reading configuration information. /// /// - virtual public void RemoveAllAppenders() + public virtual void RemoveAllAppenders() { lock(this) { @@ -226,7 +226,7 @@ virtual public void RemoveAllAppenders() /// If you are discarding the appender you must call /// on the appender removed. /// - virtual public IAppender RemoveAppender(IAppender appender) + public virtual IAppender RemoveAppender(IAppender appender) { lock(this) { @@ -248,7 +248,7 @@ virtual public IAppender RemoveAppender(IAppender appender) /// If you are discarding the appender you must call /// on the appender removed. /// - virtual public IAppender RemoveAppender(string name) + public virtual IAppender RemoveAppender(string name) { lock(this) { diff --git a/src/log4net/Appender/ColoredConsoleAppender.cs b/src/log4net/Appender/ColoredConsoleAppender.cs index d3949708..cbcc8757 100644 --- a/src/log4net/Appender/ColoredConsoleAppender.cs +++ b/src/log4net/Appender/ColoredConsoleAppender.cs @@ -216,7 +216,7 @@ public ColoredConsoleAppender(ILayout layout, bool writeToErrorStream) /// This is either "Console.Out" or "Console.Error". /// /// - virtual public string Target + public virtual string Target { get { return m_writeToErrorStream ? ConsoleError : ConsoleOut; } set @@ -270,7 +270,7 @@ public void AddMapping(LevelColors mapping) [System.Security.SecuritySafeCritical] #endif [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)] - override protected void Append(log4net.Core.LoggingEvent loggingEvent) + protected override void Append(log4net.Core.LoggingEvent loggingEvent) { if (m_consoleOutputWriter != null) { @@ -422,7 +422,7 @@ override protected void Append(log4net.Core.LoggingEvent loggingEvent) /// This appender requires a to be set. /// /// - override protected bool RequiresLayout + protected override bool RequiresLayout { get { return true; } } diff --git a/src/log4net/Appender/ConsoleAppender.cs b/src/log4net/Appender/ConsoleAppender.cs index d5d6a702..760aace4 100644 --- a/src/log4net/Appender/ConsoleAppender.cs +++ b/src/log4net/Appender/ConsoleAppender.cs @@ -115,7 +115,7 @@ public ConsoleAppender(ILayout layout, bool writeToErrorStream) /// This is either "Console.Out" or "Console.Error". /// /// - virtual public string Target + public virtual string Target { get { return m_writeToErrorStream ? ConsoleError : ConsoleOut; } set @@ -149,7 +149,7 @@ virtual public string Target /// The format of the output will depend on the appender's layout. /// /// - override protected void Append(LoggingEvent loggingEvent) + protected override void Append(LoggingEvent loggingEvent) { #if NETCF_1_0 // Write to the output stream @@ -177,7 +177,7 @@ override protected void Append(LoggingEvent loggingEvent) /// This appender requires a to be set. /// /// - override protected bool RequiresLayout + protected override bool RequiresLayout { get { return true; } } diff --git a/src/log4net/Appender/DebugAppender.cs b/src/log4net/Appender/DebugAppender.cs index b4f32957..c1eda997 100644 --- a/src/log4net/Appender/DebugAppender.cs +++ b/src/log4net/Appender/DebugAppender.cs @@ -164,7 +164,7 @@ public override bool Flush(int millisecondsTimeout) /// /// #endif - override protected void Append(LoggingEvent loggingEvent) + protected override void Append(LoggingEvent loggingEvent) { // // Write the string to the Debug system @@ -205,7 +205,7 @@ override protected void Append(LoggingEvent loggingEvent) /// This appender requires a to be set. /// /// - override protected bool RequiresLayout + protected override bool RequiresLayout { get { return true; } } diff --git a/src/log4net/Appender/EventLogAppender.cs b/src/log4net/Appender/EventLogAppender.cs index 0784cbff..0d1f3c89 100644 --- a/src/log4net/Appender/EventLogAppender.cs +++ b/src/log4net/Appender/EventLogAppender.cs @@ -275,7 +275,7 @@ public short Category /// must be called again. /// /// - override public void ActivateOptions() + public override void ActivateOptions() { try { @@ -381,7 +381,7 @@ private static void CreateEventSource(string source, string logName, string mach /// There is a limit of 32K characters for an event log message /// /// - override protected void Append(LoggingEvent loggingEvent) + protected override void Append(LoggingEvent loggingEvent) { // // Write the resulting string to the event log system @@ -484,7 +484,7 @@ override protected void Append(LoggingEvent loggingEvent) /// This appender requires a to be set. /// /// - override protected bool RequiresLayout + protected override bool RequiresLayout { get { return true; } } @@ -504,7 +504,7 @@ override protected bool RequiresLayout /// this is a one way mapping. There is /// a loss of information during the conversion. /// - virtual protected EventLogEntryType GetEntryType(Level level) + protected virtual EventLogEntryType GetEntryType(Level level) { // see if there is a specified lookup. Level2EventLogEntryType entryType = m_levelMapping.Lookup(level) as Level2EventLogEntryType; @@ -614,7 +614,7 @@ public EventLogEntryType EventLogEntryType /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(EventLogAppender); + private static readonly Type declaringType = typeof(EventLogAppender); /// /// The maximum size supported by default. @@ -628,7 +628,7 @@ public EventLogEntryType EventLogEntryType /// the event log! See: System.Diagnostics.EventLogInternal.InternalWriteEvent() /// for the use of the 32766 max size. /// - private readonly static int MAX_EVENTLOG_MESSAGE_SIZE_DEFAULT = 32766; + private static readonly int MAX_EVENTLOG_MESSAGE_SIZE_DEFAULT = 32766; /// /// The maximum size supported by a windows operating system that is vista @@ -659,7 +659,7 @@ public EventLogEntryType EventLogEntryType /// terminator of #0#0, as we cannot see the source of ReportEvent (though we could use an API monitor to examine the /// buffer, given enough time). /// - private readonly static int MAX_EVENTLOG_MESSAGE_SIZE_VISTA_OR_NEWER = 31839 - 2; + private static readonly int MAX_EVENTLOG_MESSAGE_SIZE_VISTA_OR_NEWER = 31839 - 2; /// /// The maximum size that the operating system supports for @@ -670,7 +670,7 @@ public EventLogEntryType EventLogEntryType /// to the operating system event log and eventually truncate a string /// that exceeds the limits. /// - private readonly static int MAX_EVENTLOG_MESSAGE_SIZE = GetMaxEventLogMessageSize(); + private static readonly int MAX_EVENTLOG_MESSAGE_SIZE = GetMaxEventLogMessageSize(); /// /// This method determines the maximum event log message size allowed for diff --git a/src/log4net/Appender/FileAppender.cs b/src/log4net/Appender/FileAppender.cs index f0c2bc1f..dbade37f 100644 --- a/src/log4net/Appender/FileAppender.cs +++ b/src/log4net/Appender/FileAppender.cs @@ -965,7 +965,7 @@ public FileAppender(ILayout layout, string filename) /// the application base directory. /// /// - virtual public string File + public virtual string File { get { return m_fileName; } set { m_fileName = value; } @@ -1101,7 +1101,7 @@ public FileAppender.LockingModelBase LockingModel /// This will cause the file to be opened. /// /// - override public void ActivateOptions() + public override void ActivateOptions() { base.ActivateOptions(); @@ -1145,7 +1145,7 @@ override public void ActivateOptions() /// Resets the filename and the file stream. /// /// - override protected void Reset() + protected override void Reset() { base.Reset(); m_fileName = null; @@ -1154,7 +1154,7 @@ override protected void Reset() /// /// Close this appender instance. The underlying stream or writer is also closed. /// - override protected void OnClose() + protected override void OnClose() { base.OnClose(); m_lockingModel.OnClose(); @@ -1169,7 +1169,7 @@ override protected void OnClose() /// successfully opened. /// /// - override protected void PrepareWriter() + protected override void PrepareWriter() { SafeOpenFile(m_fileName, m_appendToFile); } @@ -1188,7 +1188,7 @@ override protected void PrepareWriter() /// The format of the output will depend on the appender's layout. /// /// - override protected void Append(LoggingEvent loggingEvent) + protected override void Append(LoggingEvent loggingEvent) { if (m_stream.AcquireLock()) { @@ -1214,7 +1214,7 @@ override protected void Append(LoggingEvent loggingEvent) /// the stream. /// /// - override protected void Append(LoggingEvent[] loggingEvents) + protected override void Append(LoggingEvent[] loggingEvents) { if (m_stream.AcquireLock()) { @@ -1337,7 +1337,7 @@ protected void CloseFile() /// Errors are passed to the . /// /// - virtual protected void SafeOpenFile(string fileName, bool append) + protected virtual void SafeOpenFile(string fileName, bool append) { try { @@ -1364,7 +1364,7 @@ virtual protected void SafeOpenFile(string fileName, bool append) /// for the specified exists. /// /// - virtual protected void OpenFile(string fileName, bool append) + protected virtual void OpenFile(string fileName, bool append) { if (LogLog.IsErrorEnabled) { @@ -1427,7 +1427,7 @@ virtual protected void OpenFile(string fileName, bool append) /// data using a System.Security.Cryptography.CryptoStream. /// /// - virtual protected void SetQWForFiles(Stream fileStream) + protected virtual void SetQWForFiles(Stream fileStream) { #pragma warning disable CA2000 // Dispose objects before losing scope StreamWriter writer = new StreamWriter(fileStream, m_encoding); @@ -1445,7 +1445,7 @@ virtual protected void SetQWForFiles(Stream fileStream) /// wrap the in some way. /// /// - virtual protected void SetQWForFiles(TextWriter writer) + protected virtual void SetQWForFiles(TextWriter writer) { QuietWriter = new QuietTextWriter(writer, ErrorHandler); } @@ -1518,7 +1518,7 @@ protected static string ConvertToFullPath(string path) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(FileAppender); + private static readonly Type declaringType = typeof(FileAppender); #endregion Private Static Fields } diff --git a/src/log4net/Appender/ForwardingAppender.cs b/src/log4net/Appender/ForwardingAppender.cs index 681f8125..20a99ccc 100644 --- a/src/log4net/Appender/ForwardingAppender.cs +++ b/src/log4net/Appender/ForwardingAppender.cs @@ -68,7 +68,7 @@ public ForwardingAppender() /// It is a programming error to append to a closed appender. /// /// - override protected void OnClose() + protected override void OnClose() { // Remove all the attached appenders lock(this) @@ -89,7 +89,7 @@ override protected void OnClose() /// Delivers the logging event to all the attached appenders. /// /// - override protected void Append(LoggingEvent loggingEvent) + protected override void Append(LoggingEvent loggingEvent) { // Pass the logging event on the the attached appenders if (m_appenderAttachedImpl != null) @@ -107,7 +107,7 @@ override protected void Append(LoggingEvent loggingEvent) /// Delivers the logging events to all the attached appenders. /// /// - override protected void Append(LoggingEvent[] loggingEvents) + protected override void Append(LoggingEvent[] loggingEvents) { // Pass the logging event on the the attached appenders if (m_appenderAttachedImpl != null) @@ -131,7 +131,7 @@ override protected void Append(LoggingEvent[] loggingEvents) /// appenders, then it won't be added again. /// /// - virtual public void AddAppender(IAppender newAppender) + public virtual void AddAppender(IAppender newAppender) { if (newAppender == null) { @@ -158,7 +158,7 @@ virtual public void AddAppender(IAppender newAppender) /// /// A collection of the appenders in this appender. /// - virtual public AppenderCollection Appenders + public virtual AppenderCollection Appenders { get { @@ -188,7 +188,7 @@ virtual public AppenderCollection Appenders /// Get the named appender attached to this appender. /// /// - virtual public IAppender GetAppender(string name) + public virtual IAppender GetAppender(string name) { lock(this) { @@ -209,7 +209,7 @@ virtual public IAppender GetAppender(string name) /// This is useful when re-reading configuration information. /// /// - virtual public void RemoveAllAppenders() + public virtual void RemoveAllAppenders() { lock(this) { @@ -231,7 +231,7 @@ virtual public void RemoveAllAppenders() /// If you are discarding the appender you must call /// on the appender removed. /// - virtual public IAppender RemoveAppender(IAppender appender) + public virtual IAppender RemoveAppender(IAppender appender) { lock(this) { @@ -253,7 +253,7 @@ virtual public IAppender RemoveAppender(IAppender appender) /// If you are discarding the appender you must call /// on the appender removed. /// - virtual public IAppender RemoveAppender(string name) + public virtual IAppender RemoveAppender(string name) { lock(this) { diff --git a/src/log4net/Appender/LocalSyslogAppender.cs b/src/log4net/Appender/LocalSyslogAppender.cs index 13efc54f..ad31b5df 100644 --- a/src/log4net/Appender/LocalSyslogAppender.cs +++ b/src/log4net/Appender/LocalSyslogAppender.cs @@ -433,7 +433,7 @@ protected override void OnClose() /// This appender requires a to be set. /// /// - override protected bool RequiresLayout + protected override bool RequiresLayout { get { return true; } } @@ -452,7 +452,7 @@ override protected bool RequiresLayout /// Translates a log4net level to a syslog severity. /// /// - virtual protected SyslogSeverity GetSeverity(Level level) + protected virtual SyslogSeverity GetSeverity(Level level) { LevelSeverity levelSeverity = m_levelMapping.Lookup(level) as LevelSeverity; if (levelSeverity != null) diff --git a/src/log4net/Appender/ManagedColoredConsoleAppender.cs b/src/log4net/Appender/ManagedColoredConsoleAppender.cs index 9efe65d0..9edfce50 100644 --- a/src/log4net/Appender/ManagedColoredConsoleAppender.cs +++ b/src/log4net/Appender/ManagedColoredConsoleAppender.cs @@ -126,7 +126,7 @@ public ManagedColoredConsoleAppender() /// This is either "Console.Out" or "Console.Error". /// /// - virtual public string Target + public virtual string Target { get { return m_writeToErrorStream ? ConsoleError : ConsoleOut; } set @@ -174,7 +174,7 @@ public void AddMapping(LevelColors mapping) /// The format of the output will depend on the appender's layout. /// /// - override protected void Append(log4net.Core.LoggingEvent loggingEvent) + protected override void Append(log4net.Core.LoggingEvent loggingEvent) { System.IO.TextWriter writer; @@ -216,7 +216,7 @@ override protected void Append(log4net.Core.LoggingEvent loggingEvent) /// This appender requires a to be set. /// /// - override protected bool RequiresLayout + protected override bool RequiresLayout { get { return true; } } diff --git a/src/log4net/Appender/MemoryAppender.cs b/src/log4net/Appender/MemoryAppender.cs index e0ec7413..441569ce 100644 --- a/src/log4net/Appender/MemoryAppender.cs +++ b/src/log4net/Appender/MemoryAppender.cs @@ -84,7 +84,7 @@ public MemoryAppender() : base() /// Gets the events that have been logged. /// /// - virtual public LoggingEvent[] GetEvents() + public virtual LoggingEvent[] GetEvents() { lock (m_eventsList.SyncRoot) { @@ -110,7 +110,7 @@ virtual public LoggingEvent[] GetEvents() /// /// [Obsolete("Use Fix property")] - virtual public bool OnlyFixPartialEventData + public virtual bool OnlyFixPartialEventData { get { return (Fix == FixFlags.Partial); } set @@ -136,7 +136,7 @@ virtual public bool OnlyFixPartialEventData /// for details. /// /// - virtual public FixFlags Fix + public virtual FixFlags Fix { get { return m_fixFlags; } set { m_fixFlags = value; } @@ -153,7 +153,7 @@ virtual public FixFlags Fix /// /// Stores the in the events list. /// - override protected void Append(LoggingEvent loggingEvent) + protected override void Append(LoggingEvent loggingEvent) { // Because we are caching the LoggingEvent beyond the // lifetime of the Append() method we must fix any @@ -176,7 +176,7 @@ override protected void Append(LoggingEvent loggingEvent) /// /// Clear the list of events /// - virtual public void Clear() + public virtual void Clear() { lock (m_eventsList.SyncRoot) { @@ -193,7 +193,7 @@ virtual public void Clear() /// Gets the events that have been logged and clears the list of events. /// /// - virtual public LoggingEvent[] PopAllEvents() + public virtual LoggingEvent[] PopAllEvents() { lock (m_eventsList.SyncRoot) { diff --git a/src/log4net/Appender/NetSendAppender.cs b/src/log4net/Appender/NetSendAppender.cs index a72076f0..b03d21d6 100644 --- a/src/log4net/Appender/NetSendAppender.cs +++ b/src/log4net/Appender/NetSendAppender.cs @@ -344,7 +344,7 @@ protected override void Append(LoggingEvent loggingEvent) /// This appender requires a to be set. /// /// - override protected bool RequiresLayout + protected override bool RequiresLayout { get { return true; } } diff --git a/src/log4net/Appender/OutputDebugStringAppender.cs b/src/log4net/Appender/OutputDebugStringAppender.cs index f010fd58..1a13512b 100644 --- a/src/log4net/Appender/OutputDebugStringAppender.cs +++ b/src/log4net/Appender/OutputDebugStringAppender.cs @@ -80,7 +80,7 @@ public OutputDebugStringAppender() #if !NETCF && !NETSTANDARD1_3 [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)] #endif - override protected void Append(LoggingEvent loggingEvent) + protected override void Append(LoggingEvent loggingEvent) { #if NETSTANDARD if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) @@ -101,7 +101,7 @@ override protected void Append(LoggingEvent loggingEvent) /// This appender requires a to be set. /// /// - override protected bool RequiresLayout + protected override bool RequiresLayout { get { return true; } } diff --git a/src/log4net/Appender/RemoteSyslogAppender.cs b/src/log4net/Appender/RemoteSyslogAppender.cs index a70bb564..675d6f97 100644 --- a/src/log4net/Appender/RemoteSyslogAppender.cs +++ b/src/log4net/Appender/RemoteSyslogAppender.cs @@ -456,7 +456,7 @@ public override void ActivateOptions() /// Translates a log4net level to a syslog severity. /// /// - virtual protected SyslogSeverity GetSeverity(Level level) + protected virtual SyslogSeverity GetSeverity(Level level) { LevelSeverity levelSeverity = m_levelMapping.Lookup(level) as LevelSeverity; if (levelSeverity != null) diff --git a/src/log4net/Appender/RemotingAppender.cs b/src/log4net/Appender/RemotingAppender.cs index f4fa6f1f..7c095f89 100644 --- a/src/log4net/Appender/RemotingAppender.cs +++ b/src/log4net/Appender/RemotingAppender.cs @@ -141,7 +141,7 @@ public string Sink #if NET_4_0 || MONO_4_0 [System.Security.SecuritySafeCritical] #endif - override public void ActivateOptions() + public override void ActivateOptions() { base.ActivateOptions(); @@ -173,7 +173,7 @@ override public void ActivateOptions() /// the events will block in the thread pool manager until a thread is available. /// /// The events to send. - override protected void SendBuffer(LoggingEvent[] events) + protected override void SendBuffer(LoggingEvent[] events) { // Setup for an async send BeginAsyncSend(); @@ -207,7 +207,7 @@ override protected void SendBuffer(LoggingEvent[] events) /// exit the runtime limits the time that a /// event handler is allowed to run for. /// - override protected void OnClose() + protected override void OnClose() { base.OnClose(); diff --git a/src/log4net/Appender/RollingFileAppender.cs b/src/log4net/Appender/RollingFileAppender.cs index 9da3fb85..b5bf2532 100644 --- a/src/log4net/Appender/RollingFileAppender.cs +++ b/src/log4net/Appender/RollingFileAppender.cs @@ -547,7 +547,7 @@ public bool StaticLogFileName /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(RollingFileAppender); + private static readonly Type declaringType = typeof(RollingFileAppender); #endregion Private Static Fields @@ -560,7 +560,7 @@ public bool StaticLogFileName /// This method can be overridden by sub classes. /// /// the writer to set - override protected void SetQWForFiles(TextWriter writer) + protected override void SetQWForFiles(TextWriter writer) { QuietWriter = new CountingQuietTextWriter(writer, ErrorHandler); } @@ -576,7 +576,7 @@ override protected void SetQWForFiles(TextWriter writer) /// is need and then appends to the file last. /// /// - override protected void Append(LoggingEvent loggingEvent) + protected override void Append(LoggingEvent loggingEvent) { AdjustFileBeforeAppend(); base.Append(loggingEvent); @@ -593,7 +593,7 @@ override protected void Append(LoggingEvent loggingEvent) /// is need and then appends to the file last. /// /// - override protected void Append(LoggingEvent[] loggingEvents) + protected override void Append(LoggingEvent[] loggingEvents) { AdjustFileBeforeAppend(); base.Append(loggingEvents); @@ -609,7 +609,7 @@ override protected void Append(LoggingEvent[] loggingEvents) /// is need and then appends to the file last. /// /// - virtual protected void AdjustFileBeforeAppend() + protected virtual void AdjustFileBeforeAppend() { // reuse the file appenders locking model to lock the rolling #if !NETCF @@ -663,7 +663,7 @@ virtual protected void AdjustFileBeforeAppend() /// This method will ensure that the directory structure /// for the specified exists. /// - override protected void OpenFile(string fileName, bool append) + protected override void OpenFile(string fileName, bool append) { lock(this) { @@ -1114,7 +1114,7 @@ private RollPoint ComputeCheckPeriod(string datePattern) /// the current number of backups. /// /// - override public void ActivateOptions() + public override void ActivateOptions() { if (m_dateTime == null) { diff --git a/src/log4net/Appender/SmtpAppender.cs b/src/log4net/Appender/SmtpAppender.cs index bbe8bd51..98b6bb61 100644 --- a/src/log4net/Appender/SmtpAppender.cs +++ b/src/log4net/Appender/SmtpAppender.cs @@ -381,7 +381,7 @@ public Encoding BodyEncoding /// Sends the contents of the cyclic buffer as an e-mail message. /// /// The logging events to send. - override protected void SendBuffer(LoggingEvent[] events) + protected override void SendBuffer(LoggingEvent[] events) { // Note: this code already owns the monitor for this // appender. This frees us from needing to synchronize again. @@ -428,7 +428,7 @@ override protected void SendBuffer(LoggingEvent[] events) /// This appender requires a to be set. /// /// - override protected bool RequiresLayout + protected override bool RequiresLayout { get { return true; } } @@ -441,7 +441,7 @@ override protected bool RequiresLayout /// Send the email message /// /// the body text to include in the mail - virtual protected void SendEmail(string messageBody) + protected virtual void SendEmail(string messageBody) { #if NET_2_0 || MONO_2_0 || NETSTANDARD2_0 // .NET 2.0 has a new API for SMTP email System.Net.Mail diff --git a/src/log4net/Appender/SmtpPickupDirAppender.cs b/src/log4net/Appender/SmtpPickupDirAppender.cs index b9a97ef9..17a6af4e 100644 --- a/src/log4net/Appender/SmtpPickupDirAppender.cs +++ b/src/log4net/Appender/SmtpPickupDirAppender.cs @@ -201,7 +201,7 @@ public SecurityContext SecurityContext /// Sends the contents of the cyclic buffer as an e-mail message. /// /// - override protected void SendBuffer(LoggingEvent[] events) + protected override void SendBuffer(LoggingEvent[] events) { // Note: this code already owns the monitor for this // appender. This frees us from needing to synchronize again. @@ -280,7 +280,7 @@ override protected void SendBuffer(LoggingEvent[] events) /// must be called again. /// /// - override public void ActivateOptions() + public override void ActivateOptions() { base.ActivateOptions(); @@ -304,7 +304,7 @@ override public void ActivateOptions() /// This appender requires a to be set. /// /// - override protected bool RequiresLayout + protected override bool RequiresLayout { get { return true; } } diff --git a/src/log4net/Appender/TelnetAppender.cs b/src/log4net/Appender/TelnetAppender.cs index b117ca03..0d61a002 100644 --- a/src/log4net/Appender/TelnetAppender.cs +++ b/src/log4net/Appender/TelnetAppender.cs @@ -79,7 +79,7 @@ public TelnetAppender() /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(TelnetAppender); + private static readonly Type declaringType = typeof(TelnetAppender); #endregion Private Static Fields diff --git a/src/log4net/Appender/TextWriterAppender.cs b/src/log4net/Appender/TextWriterAppender.cs index 94826073..6eb943cc 100644 --- a/src/log4net/Appender/TextWriterAppender.cs +++ b/src/log4net/Appender/TextWriterAppender.cs @@ -144,7 +144,7 @@ public bool ImmediateFlush /// Note: Logging to an unopened will fail. /// /// - virtual public TextWriter Writer + public virtual TextWriter Writer { get { return m_qtw; } set @@ -175,7 +175,7 @@ virtual public TextWriter Writer /// /// /// false if any of the preconditions fail. - override protected bool PreAppendCheck() + protected override bool PreAppendCheck() { if (!base.PreAppendCheck()) { @@ -216,7 +216,7 @@ override protected bool PreAppendCheck() /// The format of the output will depend on the appender's layout. /// /// - override protected void Append(LoggingEvent loggingEvent) + protected override void Append(LoggingEvent loggingEvent) { RenderLoggingEvent(m_qtw, loggingEvent); @@ -237,7 +237,7 @@ override protected void Append(LoggingEvent loggingEvent) /// before flushing the stream. /// /// - override protected void Append(LoggingEvent[] loggingEvents) + protected override void Append(LoggingEvent[] loggingEvents) { foreach(LoggingEvent loggingEvent in loggingEvents) { @@ -256,7 +256,7 @@ override protected void Append(LoggingEvent[] loggingEvents) /// /// Closed appenders cannot be reused. /// - override protected void OnClose() + protected override void OnClose() { lock(this) { @@ -271,7 +271,7 @@ override protected void OnClose() /// /// The for this appender. /// - override public IErrorHandler ErrorHandler + public override IErrorHandler ErrorHandler { get { return base.ErrorHandler; } set @@ -303,7 +303,7 @@ override public IErrorHandler ErrorHandler /// This appender requires a to be set. /// /// - override protected bool RequiresLayout + protected override bool RequiresLayout { get { return true; } } @@ -320,7 +320,7 @@ override protected bool RequiresLayout /// Writes the footer and closes the underlying . /// /// - virtual protected void WriteFooterAndCloseWriter() + protected virtual void WriteFooterAndCloseWriter() { WriteFooter(); CloseWriter(); @@ -334,7 +334,7 @@ virtual protected void WriteFooterAndCloseWriter() /// Closes the underlying . /// /// - virtual protected void CloseWriter() + protected virtual void CloseWriter() { if (m_qtw != null) { @@ -360,7 +360,7 @@ virtual protected void CloseWriter() /// Subclasses can override this method for an alternate closing behavior. /// /// - virtual protected void Reset() + protected virtual void Reset() { WriteFooterAndCloseWriter(); m_qtw = null; @@ -374,7 +374,7 @@ virtual protected void Reset() /// Writes a footer as produced by the embedded layout's property. /// /// - virtual protected void WriteFooter() + protected virtual void WriteFooter() { if (Layout != null && m_qtw != null && !m_qtw.Closed) { @@ -394,7 +394,7 @@ virtual protected void WriteFooter() /// Writes a header produced by the embedded layout's property. /// /// - virtual protected void WriteHeader() + protected virtual void WriteHeader() { if (Layout != null && m_qtw != null && !m_qtw.Closed) { @@ -416,7 +416,7 @@ virtual protected void WriteHeader() /// attempt to initialize the writer multiple times. /// /// - virtual protected void PrepareWriter() + protected virtual void PrepareWriter() { } @@ -478,7 +478,7 @@ protected QuietTextWriter QuietWriter /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(TextWriterAppender); + private static readonly Type declaringType = typeof(TextWriterAppender); #endregion Private Static Fields diff --git a/src/log4net/Appender/TraceAppender.cs b/src/log4net/Appender/TraceAppender.cs index 18dd480b..8e6cb7f3 100644 --- a/src/log4net/Appender/TraceAppender.cs +++ b/src/log4net/Appender/TraceAppender.cs @@ -141,7 +141,7 @@ public PatternLayout Category /// Writes the logging event to the system. /// /// - override protected void Append(LoggingEvent loggingEvent) + protected override void Append(LoggingEvent loggingEvent) { // // Write the string to the Trace system @@ -174,7 +174,7 @@ override protected void Append(LoggingEvent loggingEvent) /// This appender requires a to be set. /// /// - override protected bool RequiresLayout + protected override bool RequiresLayout { get { return true; } } diff --git a/src/log4net/Appender/UdpAppender.cs b/src/log4net/Appender/UdpAppender.cs index 99a6a8c6..e2cafe49 100644 --- a/src/log4net/Appender/UdpAppender.cs +++ b/src/log4net/Appender/UdpAppender.cs @@ -428,7 +428,7 @@ protected override void Append(LoggingEvent loggingEvent) /// This appender requires a to be set. /// /// - override protected bool RequiresLayout + protected override bool RequiresLayout { get { return true; } } @@ -443,7 +443,7 @@ override protected bool RequiresLayout /// and unmanaged resources associated with the . /// /// - override protected void OnClose() + protected override void OnClose() { base.OnClose(); diff --git a/src/log4net/AssemblyInfo.cs b/src/log4net/AssemblyInfo.cs index 5264ed2a..9539a78e 100644 --- a/src/log4net/AssemblyInfo.cs +++ b/src/log4net/AssemblyInfo.cs @@ -54,77 +54,77 @@ // #if (CLI_1_0) -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.CLI 1.0")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.CLI 1.0")] [assembly: AssemblyTitle("Apache log4net for CLI 1.0 Compatible Frameworks")] #elif (NET_1_0) -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET 1.0")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET 1.0")] [assembly: AssemblyTitle("Apache log4net for .NET Framework 1.0")] #elif (NET_1_1) -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET 1.1")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET 1.1")] [assembly: AssemblyTitle("Apache log4net for .NET Framework 1.1")] #elif (NET_4_5) -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET 4.5")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET 4.5")] [assembly: AssemblyTitle("Apache log4net for .NET Framework 4.5")] #elif (NET_4_0) #if CLIENT_PROFILE -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET 4.0 CP")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET 4.0 CP")] [assembly: AssemblyTitle("Apache log4net for .NET Framework 4.0 Client Profile")] #else -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET 4.0")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET 4.0")] [assembly: AssemblyTitle("Apache log4net for .NET Framework 4.0")] #endif // Client Profile #elif (NET_3_5) #if CLIENT_PROFILE -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET 3.5 CP")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET 3.5 CP")] [assembly: AssemblyTitle("Apache log4net for .NET Framework 3.5 Client Profile")] #else -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET 3.5")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET 3.5")] [assembly: AssemblyTitle("Apache log4net for .NET Framework 3.5")] #endif // Client Profile #elif (NET_2_0) -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET 2.0")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET 2.0")] [assembly: AssemblyTitle("Apache log4net for .NET Framework 2.0")] #elif (NETCF_1_0) -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NETCF 1.0")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NETCF 1.0")] [assembly: AssemblyTitle("Apache log4net for .NET Compact Framework 1.0")] #elif (NETCF_2_0) -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NETCF 2.0")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NETCF 2.0")] [assembly: AssemblyTitle("Apache log4net for .NET Compact Framework 2.0")] #elif (MONO_1_0) -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-Mono 1.0")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-Mono 1.0")] [assembly: AssemblyTitle("Apache log4net for Mono 1.0")] #elif (MONO_2_0) -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-Mono 2.0")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-Mono 2.0")] [assembly: AssemblyTitle("Apache log4net for Mono 2.0")] #elif (MONO_3_5) -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-Mono 3.5")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-Mono 3.5")] [assembly: AssemblyTitle("Apache log4net for Mono 3.5")] #elif (MONO_4_0) -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-Mono 4.0")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-Mono 4.0")] [assembly: AssemblyTitle("Apache log4net for Mono 4.0")] #elif (SSCLI_1_0) -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-SSCLI 1.0")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-SSCLI 1.0")] [assembly: AssemblyTitle("Apache log4net for Shared Source CLI 1.0")] #elif (NET) -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET")] [assembly: AssemblyTitle("Apache log4net for .NET Framework")] #elif (NETSTANDARD1_3) -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET Standard 1.3")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET Standard 1.3")] [assembly: AssemblyTitle("Apache log4net for .NET Standard 1.3")] #elif (NETSTANDARD2_0) -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET Standard 2.0")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET Standard 2.0")] [assembly: AssemblyTitle("Apache log4net for .NET Standard 2.0")] #elif (NETCF) -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NETCF")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NETCF")] [assembly: AssemblyTitle("Apache log4net for .NET Compact Framework")] #elif (MONO) -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-Mono")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-Mono")] [assembly: AssemblyTitle("Apache log4net for Mono")] #elif (SSCLI) -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-SSCLI")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-SSCLI")] [assembly: AssemblyTitle("Apache log4net for Shared Source CLI")] #else -[assembly: AssemblyInformationalVersionAttribute("2.0.11.0")] +[assembly: AssemblyInformationalVersionAttribute("2.0.12.0")] [assembly: AssemblyTitle("Apache log4net")] #endif diff --git a/src/log4net/AssemblyVersionInfo.cs b/src/log4net/AssemblyVersionInfo.cs index 0b62aa9c..1bde4670 100644 --- a/src/log4net/AssemblyVersionInfo.cs +++ b/src/log4net/AssemblyVersionInfo.cs @@ -28,11 +28,11 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: System.Reflection.AssemblyVersion("2.0.11.0")] +[assembly: System.Reflection.AssemblyVersion("2.0.12.0")] #if !NETCF #if !SSCLI -[assembly: System.Reflection.AssemblyFileVersion("2.0.11.0")] +[assembly: System.Reflection.AssemblyFileVersion("2.0.12.0")] #endif #endif diff --git a/src/log4net/Config/BasicConfigurator.cs b/src/log4net/Config/BasicConfigurator.cs index 4f0ee650..374cf72b 100644 --- a/src/log4net/Config/BasicConfigurator.cs +++ b/src/log4net/Config/BasicConfigurator.cs @@ -62,7 +62,7 @@ public sealed class BasicConfigurator /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(BasicConfigurator); + private static readonly Type declaringType = typeof(BasicConfigurator); #endregion Private Static Fields @@ -97,7 +97,7 @@ private BasicConfigurator() /// layout style. /// /// - static public ICollection Configure() + public static ICollection Configure() { return BasicConfigurator.Configure(LogManager.GetRepository(Assembly.GetCallingAssembly())); } @@ -111,7 +111,7 @@ static public ICollection Configure() /// Initializes the log4net system using the specified appenders. /// /// - static public ICollection Configure(params IAppender[] appenders) + public static ICollection Configure(params IAppender[] appenders) { ArrayList configurationMessages = new ArrayList(); @@ -136,7 +136,7 @@ static public ICollection Configure(params IAppender[] appenders) /// Initializes the log4net system using the specified appender. /// /// - static public ICollection Configure(IAppender appender) + public static ICollection Configure(IAppender appender) { return Configure(new IAppender[] { appender }); } @@ -155,7 +155,7 @@ static public ICollection Configure(IAppender appender) /// layout style. /// /// - static public ICollection Configure(ILoggerRepository repository) + public static ICollection Configure(ILoggerRepository repository) { ArrayList configurationMessages = new ArrayList(); @@ -189,7 +189,7 @@ static public ICollection Configure(ILoggerRepository repository) /// Initializes the using the specified appender. /// /// - static public ICollection Configure(ILoggerRepository repository, IAppender appender) + public static ICollection Configure(ILoggerRepository repository, IAppender appender) { return Configure(repository, new IAppender[] { appender }); } @@ -204,7 +204,7 @@ static public ICollection Configure(ILoggerRepository repository, IAppender appe /// Initializes the using the specified appender. /// /// - static public ICollection Configure(ILoggerRepository repository, params IAppender[] appenders) + public static ICollection Configure(ILoggerRepository repository, params IAppender[] appenders) { ArrayList configurationMessages = new ArrayList(); @@ -218,7 +218,7 @@ static public ICollection Configure(ILoggerRepository repository, params IAppend return configurationMessages; } - static private void InternalConfigure(ILoggerRepository repository, params IAppender[] appenders) + private static void InternalConfigure(ILoggerRepository repository, params IAppender[] appenders) { IBasicRepositoryConfigurator configurableRepository = repository as IBasicRepositoryConfigurator; if (configurableRepository != null) diff --git a/src/log4net/Config/DOMConfigurator.cs b/src/log4net/Config/DOMConfigurator.cs index fd8eeb44..2dd16d84 100644 --- a/src/log4net/Config/DOMConfigurator.cs +++ b/src/log4net/Config/DOMConfigurator.cs @@ -75,7 +75,7 @@ private DOMConfigurator() /// log4net that contains the configuration data. /// [Obsolete("Use XmlConfigurator.Configure instead of DOMConfigurator.Configure")] - static public void Configure() + public static void Configure() { XmlConfigurator.Configure(LogManager.GetRepository(Assembly.GetCallingAssembly())); } @@ -96,7 +96,7 @@ static public void Configure() /// /// The repository to configure. [Obsolete("Use XmlConfigurator.Configure instead of DOMConfigurator.Configure")] - static public void Configure(ILoggerRepository repository) + public static void Configure(ILoggerRepository repository) { XmlConfigurator.Configure(repository); } @@ -113,7 +113,7 @@ static public void Configure(ILoggerRepository repository) /// /// The element to parse. [Obsolete("Use XmlConfigurator.Configure instead of DOMConfigurator.Configure")] - static public void Configure(XmlElement element) + public static void Configure(XmlElement element) { XmlConfigurator.Configure(LogManager.GetRepository(Assembly.GetCallingAssembly()), element); } @@ -132,7 +132,7 @@ static public void Configure(XmlElement element) /// The repository to configure. /// The element to parse. [Obsolete("Use XmlConfigurator.Configure instead of DOMConfigurator.Configure")] - static public void Configure(ILoggerRepository repository, XmlElement element) + public static void Configure(ILoggerRepository repository, XmlElement element) { XmlConfigurator.Configure(repository, element); } @@ -180,7 +180,7 @@ static public void Configure(ILoggerRepository repository, XmlElement element) /// /// [Obsolete("Use XmlConfigurator.Configure instead of DOMConfigurator.Configure")] - static public void Configure(FileInfo configFile) + public static void Configure(FileInfo configFile) { XmlConfigurator.Configure(LogManager.GetRepository(Assembly.GetCallingAssembly()), configFile); } @@ -203,7 +203,7 @@ static public void Configure(FileInfo configFile) /// /// [Obsolete("Use XmlConfigurator.Configure instead of DOMConfigurator.Configure")] - static public void Configure(Stream configStream) + public static void Configure(Stream configStream) { XmlConfigurator.Configure(LogManager.GetRepository(Assembly.GetCallingAssembly()), configStream); } @@ -253,7 +253,7 @@ static public void Configure(Stream configStream) /// /// [Obsolete("Use XmlConfigurator.Configure instead of DOMConfigurator.Configure")] - static public void Configure(ILoggerRepository repository, FileInfo configFile) + public static void Configure(ILoggerRepository repository, FileInfo configFile) { XmlConfigurator.Configure(repository, configFile); } @@ -279,7 +279,7 @@ static public void Configure(ILoggerRepository repository, FileInfo configFile) /// /// [Obsolete("Use XmlConfigurator.Configure instead of DOMConfigurator.Configure")] - static public void Configure(ILoggerRepository repository, Stream configStream) + public static void Configure(ILoggerRepository repository, Stream configStream) { XmlConfigurator.Configure(repository, configStream); } @@ -315,7 +315,7 @@ static public void Configure(ILoggerRepository repository, Stream configStream) /// /// [Obsolete("Use XmlConfigurator.ConfigureAndWatch instead of DOMConfigurator.ConfigureAndWatch")] - static public void ConfigureAndWatch(FileInfo configFile) + public static void ConfigureAndWatch(FileInfo configFile) { XmlConfigurator.ConfigureAndWatch(LogManager.GetRepository(Assembly.GetCallingAssembly()), configFile); } @@ -347,7 +347,7 @@ static public void ConfigureAndWatch(FileInfo configFile) /// /// [Obsolete("Use XmlConfigurator.ConfigureAndWatch instead of DOMConfigurator.ConfigureAndWatch")] - static public void ConfigureAndWatch(ILoggerRepository repository, FileInfo configFile) + public static void ConfigureAndWatch(ILoggerRepository repository, FileInfo configFile) { XmlConfigurator.ConfigureAndWatch(repository, configFile); } diff --git a/src/log4net/Config/PluginAttribute.cs b/src/log4net/Config/PluginAttribute.cs index 67bbc08b..b6629725 100644 --- a/src/log4net/Config/PluginAttribute.cs +++ b/src/log4net/Config/PluginAttribute.cs @@ -175,7 +175,7 @@ public IPlugin CreatePlugin() /// /// /// A representation of the properties of this object - override public string ToString() + public override string ToString() { if (m_type != null) { diff --git a/src/log4net/Config/SecurityContextProviderAttribute.cs b/src/log4net/Config/SecurityContextProviderAttribute.cs index c6f85572..7698c1be 100644 --- a/src/log4net/Config/SecurityContextProviderAttribute.cs +++ b/src/log4net/Config/SecurityContextProviderAttribute.cs @@ -102,7 +102,7 @@ public Type ProviderType /// Sets this as the default security context provider . /// /// - override public void Configure(Assembly sourceAssembly, ILoggerRepository targetRepository) + public override void Configure(Assembly sourceAssembly, ILoggerRepository targetRepository) { if (m_providerType == null) { @@ -142,7 +142,7 @@ override public void Configure(Assembly sourceAssembly, ILoggerRepository target /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(SecurityContextProviderAttribute); + private static readonly Type declaringType = typeof(SecurityContextProviderAttribute); #endregion Private Static Fields } diff --git a/src/log4net/Config/XmlConfigurator.cs b/src/log4net/Config/XmlConfigurator.cs index cd9ebfea..ce37d2d3 100644 --- a/src/log4net/Config/XmlConfigurator.cs +++ b/src/log4net/Config/XmlConfigurator.cs @@ -94,7 +94,7 @@ private XmlConfigurator() /// /// The repository to configure. #endif - static public ICollection Configure(ILoggerRepository repository) + public static ICollection Configure(ILoggerRepository repository) { ArrayList configurationMessages = new ArrayList(); @@ -108,7 +108,7 @@ static public ICollection Configure(ILoggerRepository repository) return configurationMessages; } - static private void InternalConfigure(ILoggerRepository repository) + private static void InternalConfigure(ILoggerRepository repository) { LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using .config file section"); @@ -194,7 +194,7 @@ static private void InternalConfigure(ILoggerRepository repository) /// /// #endif - static public ICollection Configure() + public static ICollection Configure() { return Configure(LogManager.GetRepository(Assembly.GetCallingAssembly())); } @@ -209,7 +209,7 @@ static public ICollection Configure() /// /// /// The element to parse. - static public ICollection Configure(XmlElement element) + public static ICollection Configure(XmlElement element) { ArrayList configurationMessages = new ArrayList(); @@ -312,7 +312,7 @@ static public ICollection Configure(XmlElement element) /// /// #endif - static public ICollection Configure(FileInfo configFile) + public static ICollection Configure(FileInfo configFile) { ArrayList configurationMessages = new ArrayList(); @@ -338,7 +338,7 @@ static public ICollection Configure(FileInfo configFile) /// The must support the URI scheme specified. /// /// - static public ICollection Configure(Uri configUri) + public static ICollection Configure(Uri configUri) { ArrayList configurationMessages = new ArrayList(); @@ -367,7 +367,7 @@ static public ICollection Configure(Uri configUri) /// Note that this method will NOT close the stream parameter. /// /// - static public ICollection Configure(Stream configStream) + public static ICollection Configure(Stream configStream) { ArrayList configurationMessages = new ArrayList(); @@ -393,7 +393,7 @@ static public ICollection Configure(Stream configStream) /// /// The repository to configure. /// The element to parse. - static public ICollection Configure(ILoggerRepository repository, XmlElement element) + public static ICollection Configure(ILoggerRepository repository, XmlElement element) { ArrayList configurationMessages = new ArrayList(); @@ -500,7 +500,7 @@ static public ICollection Configure(ILoggerRepository repository, XmlElement ele /// /// #endif - static public ICollection Configure(ILoggerRepository repository, FileInfo configFile) + public static ICollection Configure(ILoggerRepository repository, FileInfo configFile) { ArrayList configurationMessages = new ArrayList(); @@ -514,7 +514,7 @@ static public ICollection Configure(ILoggerRepository repository, FileInfo confi return configurationMessages; } - static private void InternalConfigure(ILoggerRepository repository, FileInfo configFile) + private static void InternalConfigure(ILoggerRepository repository, FileInfo configFile) { LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using file [" + configFile + "]"); @@ -589,7 +589,7 @@ static private void InternalConfigure(ILoggerRepository repository, FileInfo con /// The must support the URI scheme specified. /// /// - static public ICollection Configure(ILoggerRepository repository, Uri configUri) + public static ICollection Configure(ILoggerRepository repository, Uri configUri) { ArrayList configurationMessages = new ArrayList(); @@ -603,7 +603,7 @@ static public ICollection Configure(ILoggerRepository repository, Uri configUri) return configurationMessages; } - static private void InternalConfigure(ILoggerRepository repository, Uri configUri) + private static void InternalConfigure(ILoggerRepository repository, Uri configUri) { LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using URI ["+configUri+"]"); @@ -683,7 +683,7 @@ static private void InternalConfigure(ILoggerRepository repository, Uri configUr /// Note that this method will NOT close the stream parameter. /// /// - static public ICollection Configure(ILoggerRepository repository, Stream configStream) + public static ICollection Configure(ILoggerRepository repository, Stream configStream) { ArrayList configurationMessages = new ArrayList(); @@ -697,7 +697,7 @@ static public ICollection Configure(ILoggerRepository repository, Stream configS return configurationMessages; } - static private void InternalConfigure(ILoggerRepository repository, Stream configStream) + private static void InternalConfigure(ILoggerRepository repository, Stream configStream) { LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using stream"); @@ -803,7 +803,7 @@ static private void InternalConfigure(ILoggerRepository repository, Stream confi /// /// /// - static public ICollection ConfigureAndWatch(FileInfo configFile) + public static ICollection ConfigureAndWatch(FileInfo configFile) { ArrayList configurationMessages = new ArrayList(); @@ -843,7 +843,7 @@ static public ICollection ConfigureAndWatch(FileInfo configFile) /// /// /// - static public ICollection ConfigureAndWatch(ILoggerRepository repository, FileInfo configFile) + public static ICollection ConfigureAndWatch(ILoggerRepository repository, FileInfo configFile) { ArrayList configurationMessages = new ArrayList(); @@ -857,7 +857,7 @@ static public ICollection ConfigureAndWatch(ILoggerRepository repository, FileIn return configurationMessages; } - static private void InternalConfigureAndWatch(ILoggerRepository repository, FileInfo configFile) + private static void InternalConfigureAndWatch(ILoggerRepository repository, FileInfo configFile) { LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using file [" + configFile + "] watching for file updates"); @@ -1070,7 +1070,7 @@ public void Dispose() /// to load the configuration from an . /// /// - static private void InternalConfigureFromXml(ILoggerRepository repository, XmlElement element) + private static void InternalConfigureFromXml(ILoggerRepository repository, XmlElement element) { if (element == null) { @@ -1116,7 +1116,7 @@ static private void InternalConfigureFromXml(ILoggerRepository repository, XmlEl /// ConfigAndWatchHandler to dispose of its FileSystemWatcher when a repository is /// reconfigured. /// - private readonly static Hashtable m_repositoryName2ConfigAndWatchHandler = new Hashtable(); + private static readonly Hashtable m_repositoryName2ConfigAndWatchHandler = new Hashtable(); /// /// The fully qualified type of the XmlConfigurator class. @@ -1125,7 +1125,7 @@ static private void InternalConfigureFromXml(ILoggerRepository repository, XmlEl /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(XmlConfigurator); + private static readonly Type declaringType = typeof(XmlConfigurator); #endregion Private Static Fields } diff --git a/src/log4net/Config/XmlConfiguratorAttribute.cs b/src/log4net/Config/XmlConfiguratorAttribute.cs index 6c3ea3e3..b5cc702f 100644 --- a/src/log4net/Config/XmlConfiguratorAttribute.cs +++ b/src/log4net/Config/XmlConfiguratorAttribute.cs @@ -196,7 +196,7 @@ public bool Watch /// /// /// The does not extend . - override public void Configure(Assembly sourceAssembly, ILoggerRepository targetRepository) + public override void Configure(Assembly sourceAssembly, ILoggerRepository targetRepository) { IList configurationMessages = new ArrayList(); @@ -460,7 +460,7 @@ private void ConfigureFromUri(Assembly sourceAssembly, ILoggerRepository targetR /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(XmlConfiguratorAttribute); + private static readonly Type declaringType = typeof(XmlConfiguratorAttribute); #endregion Private Static Fields } diff --git a/src/log4net/Core/CompactRepositorySelector.cs b/src/log4net/Core/CompactRepositorySelector.cs index dd46f6d5..b1b2805d 100644 --- a/src/log4net/Core/CompactRepositorySelector.cs +++ b/src/log4net/Core/CompactRepositorySelector.cs @@ -311,7 +311,7 @@ public ILoggerRepository[] GetAllRepositories() /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(CompactRepositorySelector); + private static readonly Type declaringType = typeof(CompactRepositorySelector); #endregion Private Static Fields diff --git a/src/log4net/Core/DefaultRepositorySelector.cs b/src/log4net/Core/DefaultRepositorySelector.cs index ce399217..2cc84d26 100644 --- a/src/log4net/Core/DefaultRepositorySelector.cs +++ b/src/log4net/Core/DefaultRepositorySelector.cs @@ -891,7 +891,7 @@ private void LoadAliases(Assembly assembly, ILoggerRepository repository) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(DefaultRepositorySelector); + private static readonly Type declaringType = typeof(DefaultRepositorySelector); private const string DefaultRepositoryName = "log4net-default-repository"; diff --git a/src/log4net/Core/Level.cs b/src/log4net/Core/Level.cs index 713918dd..767d03ee 100644 --- a/src/log4net/Core/Level.cs +++ b/src/log4net/Core/Level.cs @@ -83,7 +83,7 @@ namespace log4net.Core #if !NETCF [Serializable] #endif - sealed public class Level : IComparable + public sealed class Level : IComparable { #region Public Instance Constructors @@ -202,7 +202,7 @@ public string DisplayName /// Returns the level . /// /// - override public string ToString() + public override string ToString() { return m_levelName; } @@ -219,7 +219,7 @@ override public string ToString() /// instance. /// /// - override public bool Equals(object o) + public override bool Equals(object o) { Level otherLevel = o as Level; if (otherLevel != null) @@ -245,7 +245,7 @@ override public bool Equals(object o) /// Returns the hash code of the level . /// /// - override public int GetHashCode() + public override int GetHashCode() { return m_levelValue; } @@ -500,107 +500,107 @@ public static int Compare(Level l, Level r) /// /// The level designates a higher level than all the rest. /// - public readonly static Level Off = new Level(int.MaxValue, "OFF"); + public static readonly Level Off = new Level(int.MaxValue, "OFF"); /// /// The level designates very severe error events. /// System unusable, emergencies. /// - public readonly static Level Log4Net_Debug = new Level(120000, "log4net:DEBUG"); + public static readonly Level Log4Net_Debug = new Level(120000, "log4net:DEBUG"); /// /// The level designates very severe error events. /// System unusable, emergencies. /// - public readonly static Level Emergency = new Level(120000, "EMERGENCY"); + public static readonly Level Emergency = new Level(120000, "EMERGENCY"); /// /// The level designates very severe error events /// that will presumably lead the application to abort. /// - public readonly static Level Fatal = new Level(110000, "FATAL"); + public static readonly Level Fatal = new Level(110000, "FATAL"); /// /// The level designates very severe error events. /// Take immediate action, alerts. /// - public readonly static Level Alert = new Level(100000, "ALERT"); + public static readonly Level Alert = new Level(100000, "ALERT"); /// /// The level designates very severe error events. /// Critical condition, critical. /// - public readonly static Level Critical = new Level(90000, "CRITICAL"); + public static readonly Level Critical = new Level(90000, "CRITICAL"); /// /// The level designates very severe error events. /// - public readonly static Level Severe = new Level(80000, "SEVERE"); + public static readonly Level Severe = new Level(80000, "SEVERE"); /// /// The level designates error events that might /// still allow the application to continue running. /// - public readonly static Level Error = new Level(70000, "ERROR"); + public static readonly Level Error = new Level(70000, "ERROR"); /// /// The level designates potentially harmful /// situations. /// - public readonly static Level Warn = new Level(60000, "WARN"); + public static readonly Level Warn = new Level(60000, "WARN"); /// /// The level designates informational messages /// that highlight the progress of the application at the highest level. /// - public readonly static Level Notice = new Level(50000, "NOTICE"); + public static readonly Level Notice = new Level(50000, "NOTICE"); /// /// The level designates informational messages that /// highlight the progress of the application at coarse-grained level. /// - public readonly static Level Info = new Level(40000, "INFO"); + public static readonly Level Info = new Level(40000, "INFO"); /// /// The level designates fine-grained informational /// events that are most useful to debug an application. /// - public readonly static Level Debug = new Level(30000, "DEBUG"); + public static readonly Level Debug = new Level(30000, "DEBUG"); /// /// The level designates fine-grained informational /// events that are most useful to debug an application. /// - public readonly static Level Fine = new Level(30000, "FINE"); + public static readonly Level Fine = new Level(30000, "FINE"); /// /// The level designates fine-grained informational /// events that are most useful to debug an application. /// - public readonly static Level Trace = new Level(20000, "TRACE"); + public static readonly Level Trace = new Level(20000, "TRACE"); /// /// The level designates fine-grained informational /// events that are most useful to debug an application. /// - public readonly static Level Finer = new Level(20000, "FINER"); + public static readonly Level Finer = new Level(20000, "FINER"); /// /// The level designates fine-grained informational /// events that are most useful to debug an application. /// - public readonly static Level Verbose = new Level(10000, "VERBOSE"); + public static readonly Level Verbose = new Level(10000, "VERBOSE"); /// /// The level designates fine-grained informational /// events that are most useful to debug an application. /// - public readonly static Level Finest = new Level(10000, "FINEST"); + public static readonly Level Finest = new Level(10000, "FINEST"); /// /// The level designates the lowest level possible. /// - public readonly static Level All = new Level(int.MinValue, "ALL"); + public static readonly Level All = new Level(int.MinValue, "ALL"); #endregion Public Static Fields diff --git a/src/log4net/Core/LocationInfo.cs b/src/log4net/Core/LocationInfo.cs index d8ae92bd..d364f9dc 100644 --- a/src/log4net/Core/LocationInfo.cs +++ b/src/log4net/Core/LocationInfo.cs @@ -307,7 +307,7 @@ public StackFrameItem[] StackFrames /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(LocationInfo); + private static readonly Type declaringType = typeof(LocationInfo); /// /// When location information is not available the constant diff --git a/src/log4net/Core/LogImpl.cs b/src/log4net/Core/LogImpl.cs index 64c2edf9..f997ac36 100644 --- a/src/log4net/Core/LogImpl.cs +++ b/src/log4net/Core/LogImpl.cs @@ -165,7 +165,7 @@ protected virtual void ReloadLevels(ILoggerRepository repository) /// form instead. /// /// - virtual public void Debug(object message) + public virtual void Debug(object message) { Logger.Log(ThisDeclaringType, m_levelDebug, message, null); } @@ -186,7 +186,7 @@ virtual public void Debug(object message) /// /// /// - virtual public void Debug(object message, Exception exception) + public virtual void Debug(object message, Exception exception) { Logger.Log(ThisDeclaringType, m_levelDebug, message, exception); } @@ -213,7 +213,7 @@ virtual public void Debug(object message, Exception exception) /// methods instead. /// /// - virtual public void DebugFormat(string format, params object[] args) + public virtual void DebugFormat(string format, params object[] args) { if (IsDebugEnabled) { @@ -243,7 +243,7 @@ virtual public void DebugFormat(string format, params object[] args) /// methods instead. /// /// - virtual public void DebugFormat(string format, object arg0) + public virtual void DebugFormat(string format, object arg0) { if (IsDebugEnabled) { @@ -274,7 +274,7 @@ virtual public void DebugFormat(string format, object arg0) /// methods instead. /// /// - virtual public void DebugFormat(string format, object arg0, object arg1) + public virtual void DebugFormat(string format, object arg0, object arg1) { if (IsDebugEnabled) { @@ -306,7 +306,7 @@ virtual public void DebugFormat(string format, object arg0, object arg1) /// methods instead. /// /// - virtual public void DebugFormat(string format, object arg0, object arg1, object arg2) + public virtual void DebugFormat(string format, object arg0, object arg1, object arg2) { if (IsDebugEnabled) { @@ -332,7 +332,7 @@ virtual public void DebugFormat(string format, object arg0, object arg1, object /// methods instead. /// /// - virtual public void DebugFormat(IFormatProvider provider, string format, params object[] args) + public virtual void DebugFormat(IFormatProvider provider, string format, params object[] args) { if (IsDebugEnabled) { @@ -363,7 +363,7 @@ virtual public void DebugFormat(IFormatProvider provider, string format, params /// form instead. /// /// - virtual public void Info(object message) + public virtual void Info(object message) { Logger.Log(ThisDeclaringType, m_levelInfo, message, null); } @@ -384,7 +384,7 @@ virtual public void Info(object message) /// /// /// - virtual public void Info(object message, Exception exception) + public virtual void Info(object message, Exception exception) { Logger.Log(ThisDeclaringType, m_levelInfo, message, exception); } @@ -411,7 +411,7 @@ virtual public void Info(object message, Exception exception) /// methods instead. /// /// - virtual public void InfoFormat(string format, params object[] args) + public virtual void InfoFormat(string format, params object[] args) { if (IsInfoEnabled) { @@ -441,7 +441,7 @@ virtual public void InfoFormat(string format, params object[] args) /// methods instead. /// /// - virtual public void InfoFormat(string format, object arg0) + public virtual void InfoFormat(string format, object arg0) { if (IsInfoEnabled) { @@ -472,7 +472,7 @@ virtual public void InfoFormat(string format, object arg0) /// methods instead. /// /// - virtual public void InfoFormat(string format, object arg0, object arg1) + public virtual void InfoFormat(string format, object arg0, object arg1) { if (IsInfoEnabled) { @@ -504,7 +504,7 @@ virtual public void InfoFormat(string format, object arg0, object arg1) /// methods instead. /// /// - virtual public void InfoFormat(string format, object arg0, object arg1, object arg2) + public virtual void InfoFormat(string format, object arg0, object arg1, object arg2) { if (IsInfoEnabled) { @@ -530,7 +530,7 @@ virtual public void InfoFormat(string format, object arg0, object arg1, object a /// methods instead. /// /// - virtual public void InfoFormat(IFormatProvider provider, string format, params object[] args) + public virtual void InfoFormat(IFormatProvider provider, string format, params object[] args) { if (IsInfoEnabled) { @@ -561,7 +561,7 @@ virtual public void InfoFormat(IFormatProvider provider, string format, params o /// form instead. /// /// - virtual public void Warn(object message) + public virtual void Warn(object message) { Logger.Log(ThisDeclaringType, m_levelWarn, message, null); } @@ -582,7 +582,7 @@ virtual public void Warn(object message) /// /// /// - virtual public void Warn(object message, Exception exception) + public virtual void Warn(object message, Exception exception) { Logger.Log(ThisDeclaringType, m_levelWarn, message, exception); } @@ -609,7 +609,7 @@ virtual public void Warn(object message, Exception exception) /// methods instead. /// /// - virtual public void WarnFormat(string format, params object[] args) + public virtual void WarnFormat(string format, params object[] args) { if (IsWarnEnabled) { @@ -639,7 +639,7 @@ virtual public void WarnFormat(string format, params object[] args) /// methods instead. /// /// - virtual public void WarnFormat(string format, object arg0) + public virtual void WarnFormat(string format, object arg0) { if (IsWarnEnabled) { @@ -670,7 +670,7 @@ virtual public void WarnFormat(string format, object arg0) /// methods instead. /// /// - virtual public void WarnFormat(string format, object arg0, object arg1) + public virtual void WarnFormat(string format, object arg0, object arg1) { if (IsWarnEnabled) { @@ -702,7 +702,7 @@ virtual public void WarnFormat(string format, object arg0, object arg1) /// methods instead. /// /// - virtual public void WarnFormat(string format, object arg0, object arg1, object arg2) + public virtual void WarnFormat(string format, object arg0, object arg1, object arg2) { if (IsWarnEnabled) { @@ -728,7 +728,7 @@ virtual public void WarnFormat(string format, object arg0, object arg1, object a /// methods instead. /// /// - virtual public void WarnFormat(IFormatProvider provider, string format, params object[] args) + public virtual void WarnFormat(IFormatProvider provider, string format, params object[] args) { if (IsWarnEnabled) { @@ -759,7 +759,7 @@ virtual public void WarnFormat(IFormatProvider provider, string format, params o /// form instead. /// /// - virtual public void Error(object message) + public virtual void Error(object message) { Logger.Log(ThisDeclaringType, m_levelError, message, null); } @@ -780,7 +780,7 @@ virtual public void Error(object message) /// /// /// - virtual public void Error(object message, Exception exception) + public virtual void Error(object message, Exception exception) { Logger.Log(ThisDeclaringType, m_levelError, message, exception); } @@ -807,7 +807,7 @@ virtual public void Error(object message, Exception exception) /// methods instead. /// /// - virtual public void ErrorFormat(string format, params object[] args) + public virtual void ErrorFormat(string format, params object[] args) { if (IsErrorEnabled) { @@ -837,7 +837,7 @@ virtual public void ErrorFormat(string format, params object[] args) /// methods instead. /// /// - virtual public void ErrorFormat(string format, object arg0) + public virtual void ErrorFormat(string format, object arg0) { if (IsErrorEnabled) { @@ -868,7 +868,7 @@ virtual public void ErrorFormat(string format, object arg0) /// methods instead. /// /// - virtual public void ErrorFormat(string format, object arg0, object arg1) + public virtual void ErrorFormat(string format, object arg0, object arg1) { if (IsErrorEnabled) { @@ -900,7 +900,7 @@ virtual public void ErrorFormat(string format, object arg0, object arg1) /// methods instead. /// /// - virtual public void ErrorFormat(string format, object arg0, object arg1, object arg2) + public virtual void ErrorFormat(string format, object arg0, object arg1, object arg2) { if (IsErrorEnabled) { @@ -926,7 +926,7 @@ virtual public void ErrorFormat(string format, object arg0, object arg1, object /// methods instead. /// /// - virtual public void ErrorFormat(IFormatProvider provider, string format, params object[] args) + public virtual void ErrorFormat(IFormatProvider provider, string format, params object[] args) { if (IsErrorEnabled) { @@ -957,7 +957,7 @@ virtual public void ErrorFormat(IFormatProvider provider, string format, params /// form instead. /// /// - virtual public void Fatal(object message) + public virtual void Fatal(object message) { Logger.Log(ThisDeclaringType, m_levelFatal, message, null); } @@ -978,7 +978,7 @@ virtual public void Fatal(object message) /// /// /// - virtual public void Fatal(object message, Exception exception) + public virtual void Fatal(object message, Exception exception) { Logger.Log(ThisDeclaringType, m_levelFatal, message, exception); } @@ -1005,7 +1005,7 @@ virtual public void Fatal(object message, Exception exception) /// methods instead. /// /// - virtual public void FatalFormat(string format, params object[] args) + public virtual void FatalFormat(string format, params object[] args) { if (IsFatalEnabled) { @@ -1035,7 +1035,7 @@ virtual public void FatalFormat(string format, params object[] args) /// methods instead. /// /// - virtual public void FatalFormat(string format, object arg0) + public virtual void FatalFormat(string format, object arg0) { if (IsFatalEnabled) { @@ -1066,7 +1066,7 @@ virtual public void FatalFormat(string format, object arg0) /// methods instead. /// /// - virtual public void FatalFormat(string format, object arg0, object arg1) + public virtual void FatalFormat(string format, object arg0, object arg1) { if (IsFatalEnabled) { @@ -1098,7 +1098,7 @@ virtual public void FatalFormat(string format, object arg0, object arg1) /// methods instead. /// /// - virtual public void FatalFormat(string format, object arg0, object arg1, object arg2) + public virtual void FatalFormat(string format, object arg0, object arg1, object arg2) { if (IsFatalEnabled) { @@ -1124,7 +1124,7 @@ virtual public void FatalFormat(string format, object arg0, object arg1, object /// methods instead. /// /// - virtual public void FatalFormat(IFormatProvider provider, string format, params object[] args) + public virtual void FatalFormat(IFormatProvider provider, string format, params object[] args) { if (IsFatalEnabled) { @@ -1175,7 +1175,7 @@ virtual public void FatalFormat(IFormatProvider provider, string format, params /// takes to actually log. /// /// - virtual public bool IsDebugEnabled + public virtual bool IsDebugEnabled { get { return Logger.IsEnabledFor(m_levelDebug); } } @@ -1194,7 +1194,7 @@ virtual public bool IsDebugEnabled /// /// /// - virtual public bool IsInfoEnabled + public virtual bool IsInfoEnabled { get { return Logger.IsEnabledFor(m_levelInfo); } } @@ -1213,7 +1213,7 @@ virtual public bool IsInfoEnabled /// /// /// - virtual public bool IsWarnEnabled + public virtual bool IsWarnEnabled { get { return Logger.IsEnabledFor(m_levelWarn); } } @@ -1231,7 +1231,7 @@ virtual public bool IsWarnEnabled /// /// /// - virtual public bool IsErrorEnabled + public virtual bool IsErrorEnabled { get { return Logger.IsEnabledFor(m_levelError); } } @@ -1249,7 +1249,7 @@ virtual public bool IsErrorEnabled /// /// /// - virtual public bool IsFatalEnabled + public virtual bool IsFatalEnabled { get { return Logger.IsEnabledFor(m_levelFatal); } } @@ -1279,7 +1279,7 @@ private void LoggerRepositoryConfigurationChanged(object sender, EventArgs e) /// /// The fully qualified name of this declaring type not the type of any subclass. /// - private readonly static Type ThisDeclaringType = typeof(LogImpl); + private static readonly Type ThisDeclaringType = typeof(LogImpl); #endregion Private Static Instance Fields diff --git a/src/log4net/Core/LoggerManager.cs b/src/log4net/Core/LoggerManager.cs index 52b6c7b2..98a2fe8e 100644 --- a/src/log4net/Core/LoggerManager.cs +++ b/src/log4net/Core/LoggerManager.cs @@ -866,7 +866,7 @@ private static void OnProcessExit(object sender, EventArgs e) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(LoggerManager); + private static readonly Type declaringType = typeof(LoggerManager); /// /// Initialize the default repository selector diff --git a/src/log4net/Core/LoggerWrapperImpl.cs b/src/log4net/Core/LoggerWrapperImpl.cs index fff496d0..26f016df 100644 --- a/src/log4net/Core/LoggerWrapperImpl.cs +++ b/src/log4net/Core/LoggerWrapperImpl.cs @@ -67,7 +67,7 @@ protected LoggerWrapperImpl(ILogger logger) /// the log events. /// /// - virtual public ILogger Logger + public virtual ILogger Logger { get { return m_logger; } } diff --git a/src/log4net/Core/LoggingEvent.cs b/src/log4net/Core/LoggingEvent.cs index 0c733006..878fbf7f 100644 --- a/src/log4net/Core/LoggingEvent.cs +++ b/src/log4net/Core/LoggingEvent.cs @@ -1,4 +1,5 @@ #region Apache License + // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with @@ -15,85 +16,87 @@ // See the License for the specific language governing permissions and // limitations under the License. // + #endregion using System; using System.Collections; using System.IO; using System.Runtime.Serialization; +using System.Security; #if !NETCF && !NETSTANDARD1_3 using System.Security.Principal; #endif - using log4net.Util; using log4net.Repository; namespace log4net.Core { - /// - /// Portable data structure used by - /// - /// - /// - /// Portable data structure used by - /// - /// - /// Nicko Cadell - public struct LoggingEventData - { - #region Public Instance Fields - - /// - /// The logger name. - /// - /// - /// - /// The logger name. - /// - /// - public string LoggerName; - - /// - /// Level of logging event. - /// - /// - /// - /// Level of logging event. Level cannot be Serializable - /// because it is a flyweight. Due to its special serialization it - /// cannot be declared final either. - /// - /// - public Level Level; - - /// - /// The application supplied message. - /// - /// - /// - /// The application supplied message of logging event. - /// - /// - public string Message; - - /// - /// The name of thread - /// - /// - /// - /// The name of thread in which this logging event was generated - /// - /// - public string ThreadName; - - /// - /// Gets or sets the local time the event was logged - /// - /// + /// + /// Portable data structure used by + /// + /// + /// + /// Portable data structure used by + /// + /// + /// Nicko Cadell + public struct LoggingEventData + { + #region Public Instance Fields + + /// + /// The logger name. + /// + /// + /// + /// The logger name. + /// + /// + public string LoggerName; + + /// + /// Level of logging event. + /// + /// + /// + /// Level of logging event. Level cannot be Serializable + /// because it is a flyweight. Due to its special serialization it + /// cannot be declared final either. + /// + /// + public Level Level; + + /// + /// The application supplied message. + /// + /// + /// + /// The application supplied message of logging event. + /// + /// + public string Message; + + /// + /// The name of thread + /// + /// + /// + /// The name of thread in which this logging event was generated + /// + /// + public string ThreadName; + + /// + /// Gets or sets the local time the event was logged + /// + /// /// /// Prefer using the setter, since local time can be ambiguous. - /// - /// - [Obsolete("Prefer using TimeStampUtc, since local time can be ambiguous in time zones with daylight savings time.")] + /// + /// + [Obsolete( + "Prefer using TimeStampUtc, since local time can be ambiguous in time zones with daylight savings time.")] public DateTime TimeStamp; /// @@ -109,13 +112,14 @@ public DateTime TimeStampUtc { get { - if (TimeStamp != default(DateTime) && + if (TimeStamp != default(DateTime) && _timeStampUtc == default(DateTime)) { // TimeStamp field has been set explicitly but TimeStampUtc hasn't // => use TimeStamp return TimeStamp.ToUniversalTime(); } + return _timeStampUtc; } set @@ -125,410 +129,422 @@ public DateTime TimeStampUtc TimeStamp = _timeStampUtc.ToLocalTime(); } } + private DateTime _timeStampUtc; #pragma warning restore 618 /// - /// Location information for the caller. - /// - /// - /// - /// Location information for the caller. - /// - /// - public LocationInfo LocationInfo; - - /// - /// String representation of the user - /// - /// - /// - /// String representation of the user's windows name, - /// like DOMAIN\username - /// - /// - public string UserName; - - /// - /// String representation of the identity. - /// - /// - /// - /// String representation of the current thread's principal identity. - /// - /// - public string Identity; - - /// - /// The string representation of the exception - /// - /// - /// - /// The string representation of the exception - /// - /// - public string ExceptionString; - - /// - /// String representation of the AppDomain. - /// - /// - /// - /// String representation of the AppDomain. - /// - /// - public string Domain; - - /// - /// Additional event specific properties - /// - /// - /// - /// A logger or an appender may attach additional - /// properties to specific events. These properties - /// have a string key and an object value. - /// - /// - public PropertiesDictionary Properties; - - #endregion Public Instance Fields - } - - /// - /// Flags passed to the property - /// - /// - /// - /// Flags passed to the property - /// - /// - /// Nicko Cadell - [Flags] public enum FixFlags - { - /// - /// Fix the MDC - /// - [Obsolete("Replaced by composite Properties")] - Mdc = 0x01, - - /// - /// Fix the NDC - /// - Ndc = 0x02, - - /// - /// Fix the rendered message - /// - Message = 0x04, - - /// - /// Fix the thread name - /// - ThreadName = 0x08, - - /// - /// Fix the callers location information - /// - /// - /// CAUTION: Very slow to generate - /// - LocationInfo = 0x10, - - /// - /// Fix the callers windows user name - /// - /// - /// CAUTION: Slow to generate - /// - UserName = 0x20, - - /// - /// Fix the domain friendly name - /// - Domain = 0x40, - - /// - /// Fix the callers principal name - /// - /// - /// CAUTION: May be slow to generate - /// - Identity = 0x80, - - /// - /// Fix the exception text - /// - Exception = 0x100, - - /// - /// Fix the event properties. Active properties must implement in order to be eligible for fixing. - /// - Properties = 0x200, - - /// - /// No fields fixed - /// - None = 0x0, - - /// - /// All fields fixed - /// - All = 0xFFFFFFF, - - /// - /// Partial fields fixed - /// - /// - /// - /// This set of partial fields gives good performance. The following fields are fixed: - /// - /// - /// - /// - /// - /// - /// - /// - /// - Partial = Message | ThreadName | Exception | Domain | Properties, - } - - /// - /// The internal representation of logging events. - /// - /// - /// - /// When an affirmative decision is made to log then a - /// instance is created. This instance - /// is passed around to the different log4net components. - /// - /// - /// This class is of concern to those wishing to extend log4net. - /// - /// - /// Some of the values in instances of - /// are considered volatile, that is the values are correct at the - /// time the event is delivered to appenders, but will not be consistent - /// at any time afterwards. If an event is to be stored and then processed - /// at a later time these volatile values must be fixed by calling - /// . There is a performance penalty - /// for incurred by calling but it - /// is essential to maintaining data consistency. - /// - /// - /// Nicko Cadell - /// Gert Driesen - /// Douglas de la Torre - /// Daniel Cazzulino + /// Location information for the caller. + /// + /// + /// + /// Location information for the caller. + /// + /// + public LocationInfo LocationInfo; + + /// + /// String representation of the user + /// + /// + /// + /// String representation of the user's windows name, + /// like DOMAIN\username + /// + /// + public string UserName; + + /// + /// String representation of the identity. + /// + /// + /// + /// String representation of the current thread's principal identity. + /// + /// + public string Identity; + + /// + /// The string representation of the exception + /// + /// + /// + /// The string representation of the exception + /// + /// + public string ExceptionString; + + /// + /// String representation of the AppDomain. + /// + /// + /// + /// String representation of the AppDomain. + /// + /// + public string Domain; + + /// + /// Additional event specific properties + /// + /// + /// + /// A logger or an appender may attach additional + /// properties to specific events. These properties + /// have a string key and an object value. + /// + /// + public PropertiesDictionary Properties; + + #endregion Public Instance Fields + } + + /// + /// Flags passed to the property + /// + /// + /// + /// Flags passed to the property + /// + /// + /// Nicko Cadell + [Flags] + public enum FixFlags + { + /// + /// Fix the MDC + /// + [Obsolete("Replaced by composite Properties")] + Mdc = 0x01, + + /// + /// Fix the NDC + /// + Ndc = 0x02, + + /// + /// Fix the rendered message + /// + Message = 0x04, + + /// + /// Fix the thread name + /// + ThreadName = 0x08, + + /// + /// Fix the callers location information + /// + /// + /// CAUTION: Very slow to generate + /// + LocationInfo = 0x10, + + /// + /// Fix the callers windows user name + /// + /// + /// CAUTION: Slow to generate + /// + UserName = 0x20, + + /// + /// Fix the domain friendly name + /// + Domain = 0x40, + + /// + /// Fix the callers principal name + /// + /// + /// CAUTION: May be slow to generate + /// + Identity = 0x80, + + /// + /// Fix the exception text + /// + Exception = 0x100, + + /// + /// Fix the event properties. Active properties must implement in order to be eligible for fixing. + /// + Properties = 0x200, + + /// + /// No fields fixed + /// + None = 0x0, + + /// + /// All fields fixed + /// + All = 0xFFFFFFF, + + /// + /// Partial fields fixed + /// + /// + /// + /// This set of partial fields gives good performance. The following fields are fixed: + /// + /// + /// + /// + /// + /// + /// + /// + /// + Partial = Message | ThreadName | Exception | Domain | Properties, + } + + /// + /// The internal representation of logging events. + /// + /// + /// + /// When an affirmative decision is made to log then a + /// instance is created. This instance + /// is passed around to the different log4net components. + /// + /// + /// This class is of concern to those wishing to extend log4net. + /// + /// + /// Some of the values in instances of + /// are considered volatile, that is the values are correct at the + /// time the event is delivered to appenders, but will not be consistent + /// at any time afterwards. If an event is to be stored and then processed + /// at a later time these volatile values must be fixed by calling + /// . There is a performance penalty + /// for incurred by calling but it + /// is essential to maintaining data consistency. + /// + /// + /// Nicko Cadell + /// Gert Driesen + /// Douglas de la Torre + /// Daniel Cazzulino #if !NETCF - [Serializable] + [Serializable] #endif - public class LoggingEvent + public class LoggingEvent #if !NETCF - : ISerializable + : ISerializable #endif - { - private readonly static Type declaringType = typeof(LoggingEvent); - - #region Public Instance Constructors - - /// - /// Initializes a new instance of the class - /// from the supplied parameters. - /// - /// The declaring type of the method that is - /// the stack boundary into the logging system for this call. - /// The repository this event is logged in. - /// The name of the logger of this event. - /// The level of this event. - /// The message of this event. - /// The exception for this event. - /// - /// - /// Except , and , - /// all fields of LoggingEvent are filled when actually needed. Call - /// to cache all data locally - /// to prevent inconsistencies. - /// - /// This method is called by the log4net framework - /// to create a logging event. - /// - /// - public LoggingEvent(Type callerStackBoundaryDeclaringType, log4net.Repository.ILoggerRepository repository, string loggerName, Level level, object message, Exception exception) - { - m_callerStackBoundaryDeclaringType = callerStackBoundaryDeclaringType; - m_message = message; - m_repository = repository; - m_thrownException = exception; - - m_data.LoggerName = loggerName; - m_data.Level = level; - - // Store the event creation time - m_data.TimeStampUtc = DateTime.UtcNow; - } - - /// - /// Initializes a new instance of the class - /// using specific data. - /// - /// The declaring type of the method that is - /// the stack boundary into the logging system for this call. - /// The repository this event is logged in. - /// Data used to initialize the logging event. - /// The fields in the struct that have already been fixed. - /// - /// - /// This constructor is provided to allow a - /// to be created independently of the log4net framework. This can - /// be useful if you require a custom serialization scheme. - /// - /// - /// Use the method to obtain an - /// instance of the class. - /// - /// - /// The parameter should be used to specify which fields in the - /// struct have been preset. Fields not specified in the - /// will be captured from the environment if requested or fixed. - /// - /// - public LoggingEvent(Type callerStackBoundaryDeclaringType, log4net.Repository.ILoggerRepository repository, LoggingEventData data, FixFlags fixedData) - { - m_callerStackBoundaryDeclaringType = callerStackBoundaryDeclaringType; - m_repository = repository; - - m_data = data; - m_fixFlags = fixedData; - } - - /// - /// Initializes a new instance of the class - /// using specific data. - /// - /// The declaring type of the method that is - /// the stack boundary into the logging system for this call. - /// The repository this event is logged in. - /// Data used to initialize the logging event. - /// - /// - /// This constructor is provided to allow a - /// to be created independently of the log4net framework. This can - /// be useful if you require a custom serialization scheme. - /// - /// - /// Use the method to obtain an - /// instance of the class. - /// - /// - /// This constructor sets this objects flags to , - /// this assumes that all the data relating to this event is passed in via the - /// parameter and no other data should be captured from the environment. - /// - /// - public LoggingEvent(Type callerStackBoundaryDeclaringType, log4net.Repository.ILoggerRepository repository, LoggingEventData data) : this(callerStackBoundaryDeclaringType, repository, data, FixFlags.All) - { - } - - /// - /// Initializes a new instance of the class - /// using specific data. - /// - /// Data used to initialize the logging event. - /// - /// - /// This constructor is provided to allow a - /// to be created independently of the log4net framework. This can - /// be useful if you require a custom serialization scheme. - /// - /// - /// Use the method to obtain an - /// instance of the class. - /// - /// - /// This constructor sets this objects flags to , - /// this assumes that all the data relating to this event is passed in via the - /// parameter and no other data should be captured from the environment. - /// - /// - public LoggingEvent(LoggingEventData data) : this(null, null, data) - { - } - - #endregion Public Instance Constructors - - #region Protected Instance Constructors + { + private static readonly Type declaringType = typeof(LoggingEvent); + + #region Public Instance Constructors + + /// + /// Initializes a new instance of the class + /// from the supplied parameters. + /// + /// The declaring type of the method that is + /// the stack boundary into the logging system for this call. + /// The repository this event is logged in. + /// The name of the logger of this event. + /// The level of this event. + /// The message of this event. + /// The exception for this event. + /// + /// + /// Except , and , + /// all fields of LoggingEvent are filled when actually needed. Call + /// to cache all data locally + /// to prevent inconsistencies. + /// + /// This method is called by the log4net framework + /// to create a logging event. + /// + /// + public LoggingEvent(Type callerStackBoundaryDeclaringType, + log4net.Repository.ILoggerRepository repository, + string loggerName, + Level level, + object message, + Exception exception) + { + m_callerStackBoundaryDeclaringType = callerStackBoundaryDeclaringType; + m_message = message; + m_repository = repository; + m_thrownException = exception; + + m_data.LoggerName = loggerName; + m_data.Level = level; + + // Store the event creation time + m_data.TimeStampUtc = DateTime.UtcNow; + } + + /// + /// Initializes a new instance of the class + /// using specific data. + /// + /// The declaring type of the method that is + /// the stack boundary into the logging system for this call. + /// The repository this event is logged in. + /// Data used to initialize the logging event. + /// The fields in the struct that have already been fixed. + /// + /// + /// This constructor is provided to allow a + /// to be created independently of the log4net framework. This can + /// be useful if you require a custom serialization scheme. + /// + /// + /// Use the method to obtain an + /// instance of the class. + /// + /// + /// The parameter should be used to specify which fields in the + /// struct have been preset. Fields not specified in the + /// will be captured from the environment if requested or fixed. + /// + /// + public LoggingEvent(Type callerStackBoundaryDeclaringType, + log4net.Repository.ILoggerRepository repository, + LoggingEventData data, + FixFlags fixedData) + { + m_callerStackBoundaryDeclaringType = callerStackBoundaryDeclaringType; + m_repository = repository; + + m_data = data; + m_fixFlags = fixedData; + } + + /// + /// Initializes a new instance of the class + /// using specific data. + /// + /// The declaring type of the method that is + /// the stack boundary into the logging system for this call. + /// The repository this event is logged in. + /// Data used to initialize the logging event. + /// + /// + /// This constructor is provided to allow a + /// to be created independently of the log4net framework. This can + /// be useful if you require a custom serialization scheme. + /// + /// + /// Use the method to obtain an + /// instance of the class. + /// + /// + /// This constructor sets this objects flags to , + /// this assumes that all the data relating to this event is passed in via the + /// parameter and no other data should be captured from the environment. + /// + /// + public LoggingEvent(Type callerStackBoundaryDeclaringType, + log4net.Repository.ILoggerRepository repository, + LoggingEventData data) : this(callerStackBoundaryDeclaringType, repository, data, FixFlags.All) + { + } + + /// + /// Initializes a new instance of the class + /// using specific data. + /// + /// Data used to initialize the logging event. + /// + /// + /// This constructor is provided to allow a + /// to be created independently of the log4net framework. This can + /// be useful if you require a custom serialization scheme. + /// + /// + /// Use the method to obtain an + /// instance of the class. + /// + /// + /// This constructor sets this objects flags to , + /// this assumes that all the data relating to this event is passed in via the + /// parameter and no other data should be captured from the environment. + /// + /// + public LoggingEvent(LoggingEventData data) : this(null, null, data) + { + } + + #endregion Public Instance Constructors + + #region Protected Instance Constructors #if !NETCF - /// - /// Serialization constructor - /// - /// The that holds the serialized object data. - /// The that contains contextual information about the source or destination. - /// - /// - /// Initializes a new instance of the class - /// with serialized data. - /// - /// - protected LoggingEvent(SerializationInfo info, StreamingContext context) - { - m_data.LoggerName = info.GetString("LoggerName"); - - // Note we are deserializing the whole level object. That is the - // name and the value. This value is correct for the source - // hierarchy but may not be for the target hierarchy that this - // event may be re-logged into. If it is to be re-logged it may - // be necessary to re-lookup the level based only on the name. - m_data.Level = (Level)info.GetValue("Level", typeof(Level)); - - m_data.Message = info.GetString("Message"); - m_data.ThreadName = info.GetString("ThreadName"); - m_data.TimeStampUtc = info.GetDateTime("TimeStamp").ToUniversalTime(); - m_data.LocationInfo = (LocationInfo) info.GetValue("LocationInfo", typeof(LocationInfo)); - m_data.UserName = info.GetString("UserName"); - m_data.ExceptionString = info.GetString("ExceptionString"); - m_data.Properties = (PropertiesDictionary) info.GetValue("Properties", typeof(PropertiesDictionary)); - m_data.Domain = info.GetString("Domain"); - m_data.Identity = info.GetString("Identity"); - - // We have restored all the values of this instance, i.e. all the values are fixed - // Set the fix flags otherwise the data values may be overwritten from the current environment. - m_fixFlags = FixFlags.All; - } + /// + /// Serialization constructor + /// + /// The that holds the serialized object data. + /// The that contains contextual information about the source or destination. + /// + /// + /// Initializes a new instance of the class + /// with serialized data. + /// + /// + protected LoggingEvent(SerializationInfo info, StreamingContext context) + { + m_data.LoggerName = info.GetString("LoggerName"); + + // Note we are deserializing the whole level object. That is the + // name and the value. This value is correct for the source + // hierarchy but may not be for the target hierarchy that this + // event may be re-logged into. If it is to be re-logged it may + // be necessary to re-lookup the level based only on the name. + m_data.Level = (Level) info.GetValue("Level", typeof(Level)); + + m_data.Message = info.GetString("Message"); + m_data.ThreadName = info.GetString("ThreadName"); + m_data.TimeStampUtc = info.GetDateTime("TimeStamp").ToUniversalTime(); + m_data.LocationInfo = (LocationInfo) info.GetValue("LocationInfo", typeof(LocationInfo)); + m_data.UserName = info.GetString("UserName"); + m_data.ExceptionString = info.GetString("ExceptionString"); + m_data.Properties = (PropertiesDictionary) info.GetValue("Properties", typeof(PropertiesDictionary)); + m_data.Domain = info.GetString("Domain"); + m_data.Identity = info.GetString("Identity"); + + // We have restored all the values of this instance, i.e. all the values are fixed + // Set the fix flags otherwise the data values may be overwritten from the current environment. + m_fixFlags = FixFlags.All; + } #endif - #endregion Protected Instance Constructors - - #region Public Instance Properties - - /// - /// Gets the time when the current process started. - /// - /// - /// This is the time when this process started. - /// - /// - /// - /// The TimeStamp is stored internally in UTC and converted to the local time zone for this computer. - /// - /// - /// Tries to get the start time for the current process. - /// Failing that it returns the time of the first call to - /// this property. - /// - /// - /// Note that AppDomains may be loaded and unloaded within the - /// same process without the process terminating and therefore - /// without the process start time being reset. - /// - /// - public static DateTime StartTime - { - get { return SystemInfo.ProcessStartTimeUtc.ToLocalTime(); } - } + #endregion Protected Instance Constructors + + #region Public Instance Properties + + /// + /// Gets the time when the current process started. + /// + /// + /// This is the time when this process started. + /// + /// + /// + /// The TimeStamp is stored internally in UTC and converted to the local time zone for this computer. + /// + /// + /// Tries to get the start time for the current process. + /// Failing that it returns the time of the first call to + /// this property. + /// + /// + /// Note that AppDomains may be loaded and unloaded within the + /// same process without the process terminating and therefore + /// without the process start time being reset. + /// + /// + public static DateTime StartTime + { + get { return SystemInfo.ProcessStartTimeUtc.ToLocalTime(); } + } /// /// Gets the UTC time when the current process started. @@ -551,39 +567,39 @@ public static DateTime StartTime public static DateTime StartTimeUtc { get { return SystemInfo.ProcessStartTimeUtc; } - } - - /// - /// Gets the of the logging event. - /// - /// - /// The of the logging event. - /// - /// - /// - /// Gets the of the logging event. - /// - /// - public Level Level - { - get { return m_data.Level; } - } - - /// - /// Gets the time of the logging event. - /// - /// - /// The time of the logging event. - /// - /// - /// - /// The TimeStamp is stored in UTC and converted to the local time zone for this computer. - /// - /// - public DateTime TimeStamp - { - get { return m_data.TimeStampUtc.ToLocalTime(); } - } + } + + /// + /// Gets the of the logging event. + /// + /// + /// The of the logging event. + /// + /// + /// + /// Gets the of the logging event. + /// + /// + public Level Level + { + get { return m_data.Level; } + } + + /// + /// Gets the time of the logging event. + /// + /// + /// The time of the logging event. + /// + /// + /// + /// The TimeStamp is stored in UTC and converted to the local time zone for this computer. + /// + /// + public DateTime TimeStamp + { + get { return m_data.TimeStampUtc.ToLocalTime(); } + } /// /// Gets UTC the time of the logging event. @@ -594,1029 +610,1051 @@ public DateTime TimeStamp public DateTime TimeStampUtc { get { return m_data.TimeStampUtc; } - } - - /// - /// Gets the name of the logger that logged the event. - /// - /// - /// The name of the logger that logged the event. - /// - /// - /// - /// Gets the name of the logger that logged the event. - /// - /// - public string LoggerName - { - get { return m_data.LoggerName; } - } - - /// - /// Gets the location information for this logging event. - /// - /// - /// The location information for this logging event. - /// - /// - /// - /// The collected information is cached for future use. - /// - /// - /// See the class for more information on - /// supported frameworks and the different behavior in Debug and - /// Release builds. - /// - /// - public LocationInfo LocationInformation - { - get - { - if (m_data.LocationInfo == null && this.m_cacheUpdatable) - { - m_data.LocationInfo = new LocationInfo(m_callerStackBoundaryDeclaringType); - } - return m_data.LocationInfo; - } - } - - /// - /// Gets the message object used to initialize this event. - /// - /// - /// The message object used to initialize this event. - /// - /// - /// - /// Gets the message object used to initialize this event. - /// Note that this event may not have a valid message object. - /// If the event is serialized the message object will not - /// be transferred. To get the text of the message the - /// property must be used - /// not this property. - /// - /// - /// If there is no defined message object for this event then - /// null will be returned. - /// - /// - public object MessageObject - { - get { return m_message; } - } - - /// - /// Gets the exception object used to initialize this event. - /// - /// - /// The exception object used to initialize this event. - /// - /// - /// - /// Gets the exception object used to initialize this event. - /// Note that this event may not have a valid exception object. - /// If the event is serialized the exception object will not - /// be transferred. To get the text of the exception the - /// method must be used - /// not this property. - /// - /// - /// If there is no defined exception object for this event then - /// null will be returned. - /// - /// - public Exception ExceptionObject - { - get { return m_thrownException; } - } - - /// - /// The that this event was created in. - /// - /// - /// - /// The that this event was created in. - /// - /// - public ILoggerRepository Repository - { - get { return m_repository; } - } - - /// - /// Ensure that the repository is set. - /// - /// the value for the repository - internal void EnsureRepository(ILoggerRepository repository) - { - if (repository != null) - { - m_repository = repository; - } - } - - /// - /// Gets the message, rendered through the . - /// - /// - /// The message rendered through the . - /// - /// - /// - /// The collected information is cached for future use. - /// - /// - public string RenderedMessage - { - get - { - if (m_data.Message == null && this.m_cacheUpdatable) - { - if (m_message == null) - { - m_data.Message = ""; - } - else if (m_message is string) - { - m_data.Message = (m_message as string); - } - else if (m_repository != null) - { - m_data.Message = m_repository.RendererMap.FindAndRender(m_message); - } - else - { - // Very last resort - m_data.Message = m_message.ToString(); - } - } - return m_data.Message; - } - } - - /// - /// Write the rendered message to a TextWriter - /// - /// the writer to write the message to - /// - /// - /// Unlike the property this method - /// does store the message data in the internal cache. Therefore - /// if called only once this method should be faster than the - /// property, however if the message is - /// to be accessed multiple times then the property will be more efficient. - /// - /// - public void WriteRenderedMessage(TextWriter writer) - { - if (m_data.Message != null) - { - writer.Write(m_data.Message); - } - else - { - if (m_message != null) - { - if (m_message is string) - { - writer.Write(m_message as string); - } - else if (m_repository != null) - { - m_repository.RendererMap.FindAndRender(m_message, writer); - } - else - { - // Very last resort - writer.Write(m_message.ToString()); - } - } - } - } - - /// - /// Gets the name of the current thread. - /// - /// - /// The name of the current thread, or the thread ID when - /// the name is not available. - /// - /// - /// - /// The collected information is cached for future use. - /// - /// - public string ThreadName - { - get - { - if (m_data.ThreadName == null && this.m_cacheUpdatable) - { -#if NETCF - // Get thread ID only - m_data.ThreadName = SystemInfo.CurrentThreadId.ToString(System.Globalization.NumberFormatInfo.InvariantInfo); -#else - m_data.ThreadName = System.Threading.Thread.CurrentThread.Name; - if (m_data.ThreadName == null || m_data.ThreadName.Length == 0) - { - // The thread name is not available. Therefore we - // go the the AppDomain to get the ID of the - // current thread. (Why don't Threads know their own ID?) - try - { - m_data.ThreadName = SystemInfo.CurrentThreadId.ToString(System.Globalization.NumberFormatInfo.InvariantInfo); - } - catch(System.Security.SecurityException) - { - // This security exception will occur if the caller does not have - // some undefined set of SecurityPermission flags. - LogLog.Debug(declaringType, "Security exception while trying to get current thread ID. Error Ignored. Empty thread name."); - - // As a last resort use the hash code of the Thread object - m_data.ThreadName = System.Threading.Thread.CurrentThread.GetHashCode().ToString(System.Globalization.CultureInfo.InvariantCulture); - } - } -#endif - } - return m_data.ThreadName; - } - } - - /// - /// Gets the name of the current user. - /// - /// - /// The name of the current user, or NOT AVAILABLE when the - /// underlying runtime has no support for retrieving the name of the - /// current user. - /// - /// - /// - /// Calls WindowsIdentity.GetCurrent().Name to get the name of - /// the current windows user. - /// - /// - /// To improve performance, we could cache the string representation of - /// the name, and reuse that as long as the identity stayed constant. - /// Once the identity changed, we would need to re-assign and re-render - /// the string. - /// - /// - /// However, the WindowsIdentity.GetCurrent() call seems to - /// return different objects every time, so the current implementation - /// doesn't do this type of caching. - /// - /// - /// Timing for these operations: - /// - /// - /// - /// Method - /// Results - /// - /// - /// WindowsIdentity.GetCurrent() - /// 10000 loops, 00:00:00.2031250 seconds - /// - /// - /// WindowsIdentity.GetCurrent().Name - /// 10000 loops, 00:00:08.0468750 seconds - /// - /// - /// - /// This means we could speed things up almost 40 times by caching the - /// value of the WindowsIdentity.GetCurrent().Name property, since - /// this takes (8.04-0.20) = 7.84375 seconds. - /// - /// - public string UserName - { - get - { - if (m_data.UserName == null && this.m_cacheUpdatable) - { -#if (NETCF || SSCLI || NETSTANDARD1_3) // NETSTANDARD1_3 TODO requires platform-specific code - // On compact framework there's no notion of current Windows user - m_data.UserName = SystemInfo.NotAvailableText; -#else - try - { - WindowsIdentity windowsIdentity = WindowsIdentity.GetCurrent(); - if (windowsIdentity != null && windowsIdentity.Name != null) - { - m_data.UserName = windowsIdentity.Name; - } - else - { - m_data.UserName = ""; - } - } - catch(System.Security.SecurityException) - { - // This security exception will occur if the caller does not have - // some undefined set of SecurityPermission flags. - LogLog.Debug(declaringType, "Security exception while trying to get current windows identity. Error Ignored. Empty user name."); - - m_data.UserName = ""; - } -#endif - } - return m_data.UserName; - } - } - - /// - /// Gets the identity of the current thread principal. - /// - /// - /// The string name of the identity of the current thread principal. - /// - /// - /// - /// Calls System.Threading.Thread.CurrentPrincipal.Identity.Name to get - /// the name of the current thread principal. - /// - /// - public string Identity - { - get - { - if (m_data.Identity == null && this.m_cacheUpdatable) - { -#if (NETCF || SSCLI || NETSTANDARD1_3) - // On compact framework there's no notion of current thread principals - m_data.Identity = SystemInfo.NotAvailableText; -#else - try - { - if (System.Threading.Thread.CurrentPrincipal != null && - System.Threading.Thread.CurrentPrincipal.Identity != null && - System.Threading.Thread.CurrentPrincipal.Identity.Name != null) - { - m_data.Identity = System.Threading.Thread.CurrentPrincipal.Identity.Name; - } - else - { - m_data.Identity = ""; - } - } - catch (ObjectDisposedException) - { - // This exception will occur if System.Threading.Thread.CurrentPrincipal.Identity is not null but - // the getter of the property Name tries to access disposed objects. - // Seen to happen on IIS 7 or greater with windows authentication. - LogLog.Debug(declaringType, "Object disposed exception while trying to get current thread principal. Error Ignored. Empty identity name."); - - m_data.Identity = ""; - } - catch (System.Security.SecurityException) - { - // This security exception will occur if the caller does not have - // some undefined set of SecurityPermission flags. - LogLog.Debug(declaringType, "Security exception while trying to get current thread principal. Error Ignored. Empty identity name."); - - m_data.Identity = ""; - } -#endif - } - return m_data.Identity; - } - } - - /// - /// Gets the AppDomain friendly name. - /// - /// - /// The AppDomain friendly name. - /// - /// - /// - /// Gets the AppDomain friendly name. - /// - /// - public string Domain - { - get - { - if (m_data.Domain == null && this.m_cacheUpdatable) - { - m_data.Domain = SystemInfo.ApplicationFriendlyName; - } - return m_data.Domain; - } - } - - /// - /// Additional event specific properties. - /// - /// - /// Additional event specific properties. - /// - /// - /// - /// A logger or an appender may attach additional - /// properties to specific events. These properties - /// have a string key and an object value. - /// - /// - /// This property is for events that have been added directly to - /// this event. The aggregate properties (which include these - /// event properties) can be retrieved using - /// and . - /// - /// - /// Once the properties have been fixed this property - /// returns the combined cached properties. This ensures that updates to - /// this property are always reflected in the underlying storage. When - /// returning the combined properties there may be more keys in the - /// Dictionary than expected. - /// - /// - public PropertiesDictionary Properties - { - get - { - // If we have cached properties then return that otherwise changes will be lost - if (m_data.Properties != null) - { - return m_data.Properties; - } - - if (m_eventProperties == null) - { - m_eventProperties = new PropertiesDictionary(); - } - return m_eventProperties; - } - } - - /// - /// The fixed fields in this event - /// - /// - /// The set of fields that are fixed in this event - /// - /// - /// - /// Fields will not be fixed if they have previously been fixed. - /// It is not possible to 'unfix' a field. - /// - /// - public FixFlags Fix - { - get { return m_fixFlags; } - set { this.FixVolatileData(value); } - } - - #endregion Public Instance Properties - - #region Implementation of ISerializable - -#if !NETCF + } - /// - /// Serializes this object into the provided. - /// - /// The to populate with data. - /// The destination for this serialization. - /// - /// - /// The data in this event must be fixed before it can be serialized. - /// - /// - /// The method must be called during the - /// method call if this event - /// is to be used outside that method. - /// - /// -#if NET_4_0 || MONO_4_0 || NETSTANDARD - [System.Security.SecurityCritical] -#endif -#if !NETCF && !NETSTANDARD1_3 - [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter = true)] -#endif - public virtual void GetObjectData(SerializationInfo info, StreamingContext context) - { - // The caller must call FixVolatileData before this object - // can be serialized. - - info.AddValue("LoggerName", m_data.LoggerName); - info.AddValue("Level", m_data.Level); - info.AddValue("Message", m_data.Message); - info.AddValue("ThreadName", m_data.ThreadName); - // TODO: consider serializing UTC rather than local time. Not implemented here because it + /// + /// Gets the name of the logger that logged the event. + /// + /// + /// The name of the logger that logged the event. + /// + /// + /// + /// Gets the name of the logger that logged the event. + /// + /// + public string LoggerName + { + get { return m_data.LoggerName; } + } + + /// + /// Gets the location information for this logging event. + /// + /// + /// The location information for this logging event. + /// + /// + /// + /// The collected information is cached for future use. + /// + /// + /// See the class for more information on + /// supported frameworks and the different behavior in Debug and + /// Release builds. + /// + /// + public LocationInfo LocationInformation + { + get + { + if (m_data.LocationInfo == null && this.m_cacheUpdatable) + { + m_data.LocationInfo = new LocationInfo(m_callerStackBoundaryDeclaringType); + } + + return m_data.LocationInfo; + } + } + + /// + /// Gets the message object used to initialize this event. + /// + /// + /// The message object used to initialize this event. + /// + /// + /// + /// Gets the message object used to initialize this event. + /// Note that this event may not have a valid message object. + /// If the event is serialized the message object will not + /// be transferred. To get the text of the message the + /// property must be used + /// not this property. + /// + /// + /// If there is no defined message object for this event then + /// null will be returned. + /// + /// + public object MessageObject + { + get { return m_message; } + } + + /// + /// Gets the exception object used to initialize this event. + /// + /// + /// The exception object used to initialize this event. + /// + /// + /// + /// Gets the exception object used to initialize this event. + /// Note that this event may not have a valid exception object. + /// If the event is serialized the exception object will not + /// be transferred. To get the text of the exception the + /// method must be used + /// not this property. + /// + /// + /// If there is no defined exception object for this event then + /// null will be returned. + /// + /// + public Exception ExceptionObject + { + get { return m_thrownException; } + } + + /// + /// The that this event was created in. + /// + /// + /// + /// The that this event was created in. + /// + /// + public ILoggerRepository Repository + { + get { return m_repository; } + } + + /// + /// Ensure that the repository is set. + /// + /// the value for the repository + internal void EnsureRepository(ILoggerRepository repository) + { + if (repository != null) + { + m_repository = repository; + } + } + + /// + /// Gets the message, rendered through the . + /// + /// + /// The message rendered through the . + /// + /// + /// + /// The collected information is cached for future use. + /// + /// + public string RenderedMessage + { + get + { + if (m_data.Message == null && this.m_cacheUpdatable) + { + if (m_message == null) + { + m_data.Message = ""; + } + else if (m_message is string) + { + m_data.Message = (m_message as string); + } + else if (m_repository != null) + { + m_data.Message = m_repository.RendererMap.FindAndRender(m_message); + } + else + { + // Very last resort + m_data.Message = m_message.ToString(); + } + } + + return m_data.Message; + } + } + + /// + /// Write the rendered message to a TextWriter + /// + /// the writer to write the message to + /// + /// + /// Unlike the property this method + /// does store the message data in the internal cache. Therefore + /// if called only once this method should be faster than the + /// property, however if the message is + /// to be accessed multiple times then the property will be more efficient. + /// + /// + public void WriteRenderedMessage(TextWriter writer) + { + if (m_data.Message != null) + { + writer.Write(m_data.Message); + } + else + { + if (m_message != null) + { + if (m_message is string) + { + writer.Write(m_message as string); + } + else if (m_repository != null) + { + m_repository.RendererMap.FindAndRender(m_message, writer); + } + else + { + // Very last resort + writer.Write(m_message.ToString()); + } + } + } + } + + /// + /// Gets the name of the current thread. + /// + /// + /// The name of the current thread, or the thread ID when + /// the name is not available. + /// + /// + /// + /// The collected information is cached for future use. + /// + /// + public string ThreadName + { + get + { + if (m_data.ThreadName == null && this.m_cacheUpdatable) + { +#if NETCF + // Get thread ID only + m_data.ThreadName = + SystemInfo.CurrentThreadId.ToString(System.Globalization.NumberFormatInfo.InvariantInfo); +#else + m_data.ThreadName = System.Threading.Thread.CurrentThread.Name; + if (m_data.ThreadName == null || m_data.ThreadName.Length == 0) + { + // The thread name is not available. Therefore we + // go the the AppDomain to get the ID of the + // current thread. (Why don't Threads know their own ID?) + try + { + m_data.ThreadName = + SystemInfo.CurrentThreadId.ToString(System.Globalization.NumberFormatInfo + .InvariantInfo); + } + catch (System.Security.SecurityException) + { + // This security exception will occur if the caller does not have + // some undefined set of SecurityPermission flags. + LogLog.Debug(declaringType, + "Security exception while trying to get current thread ID. Error Ignored. Empty thread name."); + + // As a last resort use the hash code of the Thread object + m_data.ThreadName = System.Threading.Thread.CurrentThread.GetHashCode() + .ToString(System.Globalization.CultureInfo.InvariantCulture); + } + } +#endif + } + + return m_data.ThreadName; + } + } + + /// + /// Gets the name of the current user. + /// + /// + /// The name of the current user, or NOT AVAILABLE when the + /// underlying runtime has no support for retrieving the name of the + /// current user. + /// + /// + /// + /// Calls WindowsIdentity.GetCurrent().Name to get the name of + /// the current windows user. + /// + /// + /// To improve performance, we could cache the string representation of + /// the name, and reuse that as long as the identity stayed constant. + /// Once the identity changed, we would need to re-assign and re-render + /// the string. + /// + /// + /// However, the WindowsIdentity.GetCurrent() call seems to + /// return different objects every time, so the current implementation + /// doesn't do this type of caching. + /// + /// + /// Timing for these operations: + /// + /// + /// + /// Method + /// Results + /// + /// + /// WindowsIdentity.GetCurrent() + /// 10000 loops, 00:00:00.2031250 seconds + /// + /// + /// WindowsIdentity.GetCurrent().Name + /// 10000 loops, 00:00:08.0468750 seconds + /// + /// + /// + /// This means we could speed things up almost 40 times by caching the + /// value of the WindowsIdentity.GetCurrent().Name property, since + /// this takes (8.04-0.20) = 7.84375 seconds. + /// + /// + public string UserName => + m_data.UserName ??= TryGetCurrentUserName() ?? SystemInfo.NotAvailableText; + + private static string TryGetCurrentUserName() + { +#if (NETCF || SSCLI || NETSTANDARD1_3) + // On compact framework there's no notion of current Windows user + return SystemInfo.NotAvailableText; +#else + try + { + var windowsIdentity = WindowsIdentity.GetCurrent(); + return windowsIdentity?.Name ?? ""; + } + catch (PlatformNotSupportedException) + { + return Environment.UserName; + } + catch (SecurityException) + { + // This security exception will occur if the caller does not have + // some undefined set of SecurityPermission flags. + LogLog.Debug( + declaringType, + "Security exception while trying to get current windows identity. Error Ignored." + ); + return Environment.UserName; + } + catch + { + return null; + } +#endif + } + + /// + /// Gets the identity of the current thread principal. + /// + /// + /// The string name of the identity of the current thread principal. + /// + /// + /// + /// Calls System.Threading.Thread.CurrentPrincipal.Identity.Name to get + /// the name of the current thread principal. + /// + /// + public string Identity + { + get + { + if (m_data.Identity == null && this.m_cacheUpdatable) + { +#if (NETCF || SSCLI || NETSTANDARD1_3) + // On compact framework there's no notion of current thread principals + m_data.Identity = SystemInfo.NotAvailableText; +#else + try + { + if (System.Threading.Thread.CurrentPrincipal != null && + System.Threading.Thread.CurrentPrincipal.Identity != null && + System.Threading.Thread.CurrentPrincipal.Identity.Name != null) + { + m_data.Identity = System.Threading.Thread.CurrentPrincipal.Identity.Name; + } + else + { + m_data.Identity = ""; + } + } + catch (ObjectDisposedException) + { + // This exception will occur if System.Threading.Thread.CurrentPrincipal.Identity is not null but + // the getter of the property Name tries to access disposed objects. + // Seen to happen on IIS 7 or greater with windows authentication. + LogLog.Debug(declaringType, + "Object disposed exception while trying to get current thread principal. Error Ignored. Empty identity name."); + + m_data.Identity = ""; + } + catch (System.Security.SecurityException) + { + // This security exception will occur if the caller does not have + // some undefined set of SecurityPermission flags. + LogLog.Debug(declaringType, + "Security exception while trying to get current thread principal. Error Ignored. Empty identity name."); + + m_data.Identity = ""; + } +#endif + } + + return m_data.Identity; + } + } + + /// + /// Gets the AppDomain friendly name. + /// + /// + /// The AppDomain friendly name. + /// + /// + /// + /// Gets the AppDomain friendly name. + /// + /// + public string Domain + { + get + { + if (m_data.Domain == null && this.m_cacheUpdatable) + { + m_data.Domain = SystemInfo.ApplicationFriendlyName; + } + + return m_data.Domain; + } + } + + /// + /// Additional event specific properties. + /// + /// + /// Additional event specific properties. + /// + /// + /// + /// A logger or an appender may attach additional + /// properties to specific events. These properties + /// have a string key and an object value. + /// + /// + /// This property is for events that have been added directly to + /// this event. The aggregate properties (which include these + /// event properties) can be retrieved using + /// and . + /// + /// + /// Once the properties have been fixed this property + /// returns the combined cached properties. This ensures that updates to + /// this property are always reflected in the underlying storage. When + /// returning the combined properties there may be more keys in the + /// Dictionary than expected. + /// + /// + public PropertiesDictionary Properties + { + get + { + // If we have cached properties then return that otherwise changes will be lost + if (m_data.Properties != null) + { + return m_data.Properties; + } + + if (m_eventProperties == null) + { + m_eventProperties = new PropertiesDictionary(); + } + + return m_eventProperties; + } + } + + /// + /// The fixed fields in this event + /// + /// + /// The set of fields that are fixed in this event + /// + /// + /// + /// Fields will not be fixed if they have previously been fixed. + /// It is not possible to 'unfix' a field. + /// + /// + public FixFlags Fix + { + get { return m_fixFlags; } + set { this.FixVolatileData(value); } + } + + #endregion Public Instance Properties + + #region Implementation of ISerializable + +#if !NETCF + + /// + /// Serializes this object into the provided. + /// + /// The to populate with data. + /// The destination for this serialization. + /// + /// + /// The data in this event must be fixed before it can be serialized. + /// + /// + /// The method must be called during the + /// method call if this event + /// is to be used outside that method. + /// + /// +#if NET_4_0 || MONO_4_0 || NETSTANDARD + [System.Security.SecurityCritical] +#endif +#if !NETCF && !NETSTANDARD1_3 + [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, + SerializationFormatter = true)] +#endif + public virtual void GetObjectData(SerializationInfo info, StreamingContext context) + { + // The caller must call FixVolatileData before this object + // can be serialized. + + info.AddValue("LoggerName", m_data.LoggerName); + info.AddValue("Level", m_data.Level); + info.AddValue("Message", m_data.Message); + info.AddValue("ThreadName", m_data.ThreadName); + // TODO: consider serializing UTC rather than local time. Not implemented here because it // would give an unexpected result if client and server have different versions of this class. // info.AddValue("TimeStamp", m_data.TimeStampUtc); #pragma warning disable 618 - info.AddValue("TimeStamp", m_data.TimeStamp); + info.AddValue("TimeStamp", m_data.TimeStamp); #pragma warning restore 618 info.AddValue("LocationInfo", m_data.LocationInfo); - info.AddValue("UserName", m_data.UserName); - info.AddValue("ExceptionString", m_data.ExceptionString); - info.AddValue("Properties", m_data.Properties); - info.AddValue("Domain", m_data.Domain); - info.AddValue("Identity", m_data.Identity); - } + info.AddValue("UserName", m_data.UserName); + info.AddValue("ExceptionString", m_data.ExceptionString); + info.AddValue("Properties", m_data.Properties); + info.AddValue("Domain", m_data.Domain); + info.AddValue("Identity", m_data.Identity); + } #endif - #endregion Implementation of ISerializable - - #region Public Instance Methods - - /// - /// Gets the portable data for this . - /// - /// The for this event. - /// - /// - /// A new can be constructed using a - /// instance. - /// - /// - /// Does a fix of the data - /// in the logging event before returning the event data. - /// - /// - public LoggingEventData GetLoggingEventData() - { - return GetLoggingEventData(FixFlags.Partial); - } - - /// - /// Gets the portable data for this . - /// - /// The set of data to ensure is fixed in the LoggingEventData - /// The for this event. - /// - /// - /// A new can be constructed using a - /// instance. - /// - /// - public LoggingEventData GetLoggingEventData(FixFlags fixFlags) - { - Fix = fixFlags; - return m_data; - } - - /// - /// Returns this event's exception's rendered using the - /// . - /// - /// - /// This event's exception's rendered using the . - /// - /// - /// - /// Obsolete. Use instead. - /// - /// - [Obsolete("Use GetExceptionString instead")] - public string GetExceptionStrRep() - { - return GetExceptionString(); - } - - /// - /// Returns this event's exception's rendered using the - /// . - /// - /// - /// This event's exception's rendered using the . - /// - /// - /// - /// Returns this event's exception's rendered using the - /// . - /// - /// - public string GetExceptionString() - { - if (m_data.ExceptionString == null && this.m_cacheUpdatable) - { - if (m_thrownException != null) - { - if (m_repository != null) - { - // Render exception using the repositories renderer map - m_data.ExceptionString = m_repository.RendererMap.FindAndRender(m_thrownException); - } - else - { - // Very last resort - m_data.ExceptionString = m_thrownException.ToString(); - } - } - else - { - m_data.ExceptionString = ""; - } - } - return m_data.ExceptionString; - } - - /// - /// Fix instance fields that hold volatile data. - /// - /// - /// - /// Some of the values in instances of - /// are considered volatile, that is the values are correct at the - /// time the event is delivered to appenders, but will not be consistent - /// at any time afterwards. If an event is to be stored and then processed - /// at a later time these volatile values must be fixed by calling - /// . There is a performance penalty - /// incurred by calling but it - /// is essential to maintaining data consistency. - /// - /// - /// Calling is equivalent to - /// calling passing the parameter - /// false. - /// - /// - /// See for more - /// information. - /// - /// - [Obsolete("Use Fix property")] - public void FixVolatileData() - { - Fix = FixFlags.All; - } - - /// - /// Fixes instance fields that hold volatile data. - /// - /// Set to true to not fix data that takes a long time to fix. - /// - /// - /// Some of the values in instances of - /// are considered volatile, that is the values are correct at the - /// time the event is delivered to appenders, but will not be consistent - /// at any time afterwards. If an event is to be stored and then processed - /// at a later time these volatile values must be fixed by calling - /// . There is a performance penalty - /// for incurred by calling but it - /// is essential to maintaining data consistency. - /// - /// - /// The param controls the data that - /// is fixed. Some of the data that can be fixed takes a long time to - /// generate, therefore if you do not require those settings to be fixed - /// they can be ignored by setting the param - /// to true. This setting will ignore the - /// and settings. - /// - /// - /// Set to false to ensure that all - /// settings are fixed. - /// - /// - [Obsolete("Use Fix property")] - public void FixVolatileData(bool fastButLoose) - { - if (fastButLoose) - { - Fix = FixFlags.Partial; - } - else - { - Fix = FixFlags.All; - } - } - - /// - /// Fix the fields specified by the parameter - /// - /// the fields to fix - /// - /// - /// Only fields specified in the will be fixed. - /// Fields will not be fixed if they have previously been fixed. - /// It is not possible to 'unfix' a field. - /// - /// - protected void FixVolatileData(FixFlags flags) - { - object forceCreation = null; - - //Unlock the cache so that new values can be stored - //This may not be ideal if we are no longer in the correct context - //and someone calls fix. - m_cacheUpdatable=true; - - // determine the flags that we are actually fixing - FixFlags updateFlags = (FixFlags)((flags ^ m_fixFlags) & flags); - - if (updateFlags > 0) - { - if ((updateFlags & FixFlags.Message) != 0) - { - // Force the message to be rendered - forceCreation = this.RenderedMessage; - - m_fixFlags |= FixFlags.Message; - } - if ((updateFlags & FixFlags.ThreadName) != 0) - { - // Grab the thread name - forceCreation = this.ThreadName; - - m_fixFlags |= FixFlags.ThreadName; - } - - if ((updateFlags & FixFlags.LocationInfo) != 0) - { - // Force the location information to be loaded - forceCreation = this.LocationInformation; - - m_fixFlags |= FixFlags.LocationInfo; - } - if ((updateFlags & FixFlags.UserName) != 0) - { - // Grab the user name - forceCreation = this.UserName; - - m_fixFlags |= FixFlags.UserName; - } - if ((updateFlags & FixFlags.Domain) != 0) - { - // Grab the domain name - forceCreation = this.Domain; - - m_fixFlags |= FixFlags.Domain; - } - if ((updateFlags & FixFlags.Identity) != 0) - { - // Grab the identity - forceCreation = this.Identity; - - m_fixFlags |= FixFlags.Identity; - } - - if ((updateFlags & FixFlags.Exception) != 0) - { - // Force the exception text to be loaded - forceCreation = GetExceptionString(); - - m_fixFlags |= FixFlags.Exception; - } - - if ((updateFlags & FixFlags.Properties) != 0) - { - CacheProperties(); - - m_fixFlags |= FixFlags.Properties; - } - } - - // avoid warning CS0219 - if (forceCreation != null) - { - } - - //Finaly lock everything we've cached. - m_cacheUpdatable=false; - } - - #endregion Public Instance Methods - - #region Protected Instance Methods - - private void CreateCompositeProperties() - { - CompositeProperties compositeProperties = new CompositeProperties(); - - if (m_eventProperties != null) - { - compositeProperties.Add(m_eventProperties); - } + #endregion Implementation of ISerializable + + #region Public Instance Methods + + /// + /// Gets the portable data for this . + /// + /// The for this event. + /// + /// + /// A new can be constructed using a + /// instance. + /// + /// + /// Does a fix of the data + /// in the logging event before returning the event data. + /// + /// + public LoggingEventData GetLoggingEventData() + { + return GetLoggingEventData(FixFlags.Partial); + } + + /// + /// Gets the portable data for this . + /// + /// The set of data to ensure is fixed in the LoggingEventData + /// The for this event. + /// + /// + /// A new can be constructed using a + /// instance. + /// + /// + public LoggingEventData GetLoggingEventData(FixFlags fixFlags) + { + Fix = fixFlags; + return m_data; + } + + /// + /// Returns this event's exception's rendered using the + /// . + /// + /// + /// This event's exception's rendered using the . + /// + /// + /// + /// Obsolete. Use instead. + /// + /// + [Obsolete("Use GetExceptionString instead")] + public string GetExceptionStrRep() + { + return GetExceptionString(); + } + + /// + /// Returns this event's exception's rendered using the + /// . + /// + /// + /// This event's exception's rendered using the . + /// + /// + /// + /// Returns this event's exception's rendered using the + /// . + /// + /// + public string GetExceptionString() + { + if (m_data.ExceptionString == null && this.m_cacheUpdatable) + { + if (m_thrownException != null) + { + if (m_repository != null) + { + // Render exception using the repositories renderer map + m_data.ExceptionString = m_repository.RendererMap.FindAndRender(m_thrownException); + } + else + { + // Very last resort + m_data.ExceptionString = m_thrownException.ToString(); + } + } + else + { + m_data.ExceptionString = ""; + } + } + + return m_data.ExceptionString; + } + + /// + /// Fix instance fields that hold volatile data. + /// + /// + /// + /// Some of the values in instances of + /// are considered volatile, that is the values are correct at the + /// time the event is delivered to appenders, but will not be consistent + /// at any time afterwards. If an event is to be stored and then processed + /// at a later time these volatile values must be fixed by calling + /// . There is a performance penalty + /// incurred by calling but it + /// is essential to maintaining data consistency. + /// + /// + /// Calling is equivalent to + /// calling passing the parameter + /// false. + /// + /// + /// See for more + /// information. + /// + /// + [Obsolete("Use Fix property")] + public void FixVolatileData() + { + Fix = FixFlags.All; + } + + /// + /// Fixes instance fields that hold volatile data. + /// + /// Set to true to not fix data that takes a long time to fix. + /// + /// + /// Some of the values in instances of + /// are considered volatile, that is the values are correct at the + /// time the event is delivered to appenders, but will not be consistent + /// at any time afterwards. If an event is to be stored and then processed + /// at a later time these volatile values must be fixed by calling + /// . There is a performance penalty + /// for incurred by calling but it + /// is essential to maintaining data consistency. + /// + /// + /// The param controls the data that + /// is fixed. Some of the data that can be fixed takes a long time to + /// generate, therefore if you do not require those settings to be fixed + /// they can be ignored by setting the param + /// to true. This setting will ignore the + /// and settings. + /// + /// + /// Set to false to ensure that all + /// settings are fixed. + /// + /// + [Obsolete("Use Fix property")] + public void FixVolatileData(bool fastButLoose) + { + if (fastButLoose) + { + Fix = FixFlags.Partial; + } + else + { + Fix = FixFlags.All; + } + } + + /// + /// Fix the fields specified by the parameter + /// + /// the fields to fix + /// + /// + /// Only fields specified in the will be fixed. + /// Fields will not be fixed if they have previously been fixed. + /// It is not possible to 'unfix' a field. + /// + /// + protected void FixVolatileData(FixFlags flags) + { + object forceCreation = null; + + //Unlock the cache so that new values can be stored + //This may not be ideal if we are no longer in the correct context + //and someone calls fix. + m_cacheUpdatable = true; + + // determine the flags that we are actually fixing + var updateFlags = (FixFlags) ((flags ^ m_fixFlags) & flags); + + if (updateFlags > 0) + { + if ((updateFlags & FixFlags.Message) != 0) + { + // Force the message to be rendered + forceCreation = this.RenderedMessage; + + m_fixFlags |= FixFlags.Message; + } + + if ((updateFlags & FixFlags.ThreadName) != 0) + { + // Grab the thread name + forceCreation = this.ThreadName; + + m_fixFlags |= FixFlags.ThreadName; + } + + if ((updateFlags & FixFlags.LocationInfo) != 0) + { + // Force the location information to be loaded + forceCreation = this.LocationInformation; + + m_fixFlags |= FixFlags.LocationInfo; + } + + if ((updateFlags & FixFlags.UserName) != 0) + { + // Grab the user name + forceCreation = this.UserName; + + m_fixFlags |= FixFlags.UserName; + } + + if ((updateFlags & FixFlags.Domain) != 0) + { + // Grab the domain name + forceCreation = this.Domain; + + m_fixFlags |= FixFlags.Domain; + } + + if ((updateFlags & FixFlags.Identity) != 0) + { + // Grab the identity + forceCreation = this.Identity; + + m_fixFlags |= FixFlags.Identity; + } + + if ((updateFlags & FixFlags.Exception) != 0) + { + // Force the exception text to be loaded + forceCreation = GetExceptionString(); + + m_fixFlags |= FixFlags.Exception; + } + + if ((updateFlags & FixFlags.Properties) != 0) + { + CacheProperties(); + + m_fixFlags |= FixFlags.Properties; + } + } + + // avoid warning CS0219 + if (forceCreation != null) + { + } + + //Finaly lock everything we've cached. + m_cacheUpdatable = false; + } + + #endregion Public Instance Methods + + #region Protected Instance Methods + + private void CreateCompositeProperties() + { + var compositeProperties = new CompositeProperties(); + + if (m_eventProperties != null) + { + compositeProperties.Add(m_eventProperties); + } #if !NETCF - PropertiesDictionary logicalThreadProperties = LogicalThreadContext.Properties.GetProperties(false); - if (logicalThreadProperties != null) - { - compositeProperties.Add(logicalThreadProperties); - } + var logicalThreadProperties = LogicalThreadContext.Properties.GetProperties(false); + if (logicalThreadProperties != null) + { + compositeProperties.Add(logicalThreadProperties); + } #endif - PropertiesDictionary threadProperties = ThreadContext.Properties.GetProperties(false); - if (threadProperties != null) - { - compositeProperties.Add(threadProperties); - } - - // TODO: Add Repository Properties - - // event properties - PropertiesDictionary eventProperties = new PropertiesDictionary(); - eventProperties[UserNameProperty] = UserName; - eventProperties[IdentityProperty] = Identity; - compositeProperties.Add(eventProperties); - - compositeProperties.Add(GlobalContext.Properties.GetReadOnlyProperties()); - m_compositeProperties = compositeProperties; - } - - private void CacheProperties() - { - if (m_data.Properties == null && this.m_cacheUpdatable) - { - if (m_compositeProperties == null) - { - CreateCompositeProperties(); - } - - PropertiesDictionary flattenedProperties = m_compositeProperties.Flatten(); - - PropertiesDictionary fixedProperties = new PropertiesDictionary(); - - // Validate properties - foreach(DictionaryEntry entry in flattenedProperties) - { - string key = entry.Key as string; - - if (key != null) - { - object val = entry.Value; - - // Fix any IFixingRequired objects - IFixingRequired fixingRequired = val as IFixingRequired; - if (fixingRequired != null) - { - val = fixingRequired.GetFixedObject(); - } - - // Strip keys with null values - if (val != null) - { - fixedProperties[key] = val; - } - } - } - - m_data.Properties = fixedProperties; - } - } - - /// - /// Lookup a composite property in this event - /// - /// the key for the property to lookup - /// the value for the property - /// - /// - /// This event has composite properties that combine together properties from - /// several different contexts in the following order: - /// - /// - /// this events properties - /// - /// This event has that can be set. These - /// properties are specific to this event only. - /// - /// - /// - /// the thread properties - /// - /// The that are set on the current - /// thread. These properties are shared by all events logged on this thread. - /// - /// - /// - /// the global properties - /// - /// The that are set globally. These - /// properties are shared by all the threads in the AppDomain. - /// - /// - /// - /// - /// - public object LookupProperty(string key) - { - if (m_data.Properties != null) - { - return m_data.Properties[key]; - } - if (m_compositeProperties == null) - { - CreateCompositeProperties(); - } - return m_compositeProperties[key]; - } - - /// - /// Get all the composite properties in this event - /// - /// the containing all the properties - /// - /// - /// See for details of the composite properties - /// stored by the event. - /// - /// - /// This method returns a single containing all the - /// properties defined for this event. - /// - /// - public PropertiesDictionary GetProperties() - { - if (m_data.Properties != null) - { - return m_data.Properties; - } - if (m_compositeProperties == null) - { - CreateCompositeProperties(); - } - return m_compositeProperties.Flatten(); - } - - #endregion Public Instance Methods - - #region Private Instance Fields - - /// - /// The internal logging event data. - /// - private LoggingEventData m_data; - - /// - /// The internal logging event data. - /// - private CompositeProperties m_compositeProperties; - - /// - /// The internal logging event data. - /// - private PropertiesDictionary m_eventProperties; - - /// - /// The fully qualified Type of the calling - /// logger class in the stack frame (i.e. the declaring type of the method). - /// - private readonly Type m_callerStackBoundaryDeclaringType; - - /// - /// The application supplied message of logging event. - /// - private readonly object m_message; - - /// - /// The exception that was thrown. - /// - /// - /// This is not serialized. The string representation - /// is serialized instead. - /// - private readonly Exception m_thrownException; - - /// - /// The repository that generated the logging event - /// - /// - /// This is not serialized. - /// - private ILoggerRepository m_repository = null; - - /// - /// The fix state for this event - /// - /// - /// These flags indicate which fields have been fixed. - /// Not serialized. - /// - private FixFlags m_fixFlags = FixFlags.None; - - /// - /// Indicated that the internal cache is updateable (ie not fixed) - /// - /// - /// This is a seperate flag to m_fixFlags as it allows incrementel fixing and simpler - /// changes in the caching strategy. - /// - private bool m_cacheUpdatable = true; - - #endregion Private Instance Fields - - #region Constants - - /// - /// The key into the Properties map for the host name value. - /// - public const string HostNameProperty = "log4net:HostName"; - - /// - /// The key into the Properties map for the thread identity value. - /// - public const string IdentityProperty = "log4net:Identity"; - - /// - /// The key into the Properties map for the user name value. - /// - public const string UserNameProperty = "log4net:UserName"; - - #endregion - } -} + var threadProperties = ThreadContext.Properties.GetProperties(false); + if (threadProperties != null) + { + compositeProperties.Add(threadProperties); + } + + // TODO: Add Repository Properties + + // event properties + var eventProperties = new PropertiesDictionary(); + eventProperties[UserNameProperty] = UserName; + eventProperties[IdentityProperty] = Identity; + compositeProperties.Add(eventProperties); + + compositeProperties.Add(GlobalContext.Properties.GetReadOnlyProperties()); + m_compositeProperties = compositeProperties; + } + + private void CacheProperties() + { + if (m_data.Properties == null && this.m_cacheUpdatable) + { + if (m_compositeProperties == null) + { + CreateCompositeProperties(); + } + + var flattenedProperties = m_compositeProperties.Flatten(); + + var fixedProperties = new PropertiesDictionary(); + + // Validate properties + foreach (DictionaryEntry entry in flattenedProperties) + { + var key = entry.Key as string; + + if (key != null) + { + var val = entry.Value; + + // Fix any IFixingRequired objects + var fixingRequired = val as IFixingRequired; + if (fixingRequired != null) + { + val = fixingRequired.GetFixedObject(); + } + + // Strip keys with null values + if (val != null) + { + fixedProperties[key] = val; + } + } + } + + m_data.Properties = fixedProperties; + } + } + + /// + /// Lookup a composite property in this event + /// + /// the key for the property to lookup + /// the value for the property + /// + /// + /// This event has composite properties that combine together properties from + /// several different contexts in the following order: + /// + /// + /// this events properties + /// + /// This event has that can be set. These + /// properties are specific to this event only. + /// + /// + /// + /// the thread properties + /// + /// The that are set on the current + /// thread. These properties are shared by all events logged on this thread. + /// + /// + /// + /// the global properties + /// + /// The that are set globally. These + /// properties are shared by all the threads in the AppDomain. + /// + /// + /// + /// + /// + public object LookupProperty(string key) + { + if (m_data.Properties != null) + { + return m_data.Properties[key]; + } + + if (m_compositeProperties == null) + { + CreateCompositeProperties(); + } + + return m_compositeProperties[key]; + } + + /// + /// Get all the composite properties in this event + /// + /// the containing all the properties + /// + /// + /// See for details of the composite properties + /// stored by the event. + /// + /// + /// This method returns a single containing all the + /// properties defined for this event. + /// + /// + public PropertiesDictionary GetProperties() + { + if (m_data.Properties != null) + { + return m_data.Properties; + } + + if (m_compositeProperties == null) + { + CreateCompositeProperties(); + } + + return m_compositeProperties.Flatten(); + } + + #endregion Public Instance Methods + + #region Private Instance Fields + + /// + /// The internal logging event data. + /// + private LoggingEventData m_data; + + /// + /// The internal logging event data. + /// + private CompositeProperties m_compositeProperties; + + /// + /// The internal logging event data. + /// + private PropertiesDictionary m_eventProperties; + + /// + /// The fully qualified Type of the calling + /// logger class in the stack frame (i.e. the declaring type of the method). + /// + private readonly Type m_callerStackBoundaryDeclaringType; + + /// + /// The application supplied message of logging event. + /// + private readonly object m_message; + + /// + /// The exception that was thrown. + /// + /// + /// This is not serialized. The string representation + /// is serialized instead. + /// + private readonly Exception m_thrownException; + + /// + /// The repository that generated the logging event + /// + /// + /// This is not serialized. + /// + private ILoggerRepository m_repository = null; + + /// + /// The fix state for this event + /// + /// + /// These flags indicate which fields have been fixed. + /// Not serialized. + /// + private FixFlags m_fixFlags = FixFlags.None; + + /// + /// Indicated that the internal cache is updateable (ie not fixed) + /// + /// + /// This is a seperate flag to m_fixFlags as it allows incrementel fixing and simpler + /// changes in the caching strategy. + /// + private bool m_cacheUpdatable = true; + + #endregion Private Instance Fields + + #region Constants + + /// + /// The key into the Properties map for the host name value. + /// + public const string HostNameProperty = "log4net:HostName"; + + /// + /// The key into the Properties map for the thread identity value. + /// + public const string IdentityProperty = "log4net:Identity"; + + /// + /// The key into the Properties map for the user name value. + /// + public const string UserNameProperty = "log4net:UserName"; + + #endregion + } +} \ No newline at end of file diff --git a/src/log4net/Core/MethodItem.cs b/src/log4net/Core/MethodItem.cs index e2ff3c39..6d3ca198 100644 --- a/src/log4net/Core/MethodItem.cs +++ b/src/log4net/Core/MethodItem.cs @@ -156,7 +156,7 @@ public string[] Parameters /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(MethodItem); + private static readonly Type declaringType = typeof(MethodItem); /// /// When location information is not available the constant diff --git a/src/log4net/Core/StackFrameItem.cs b/src/log4net/Core/StackFrameItem.cs index 83f03514..17193260 100644 --- a/src/log4net/Core/StackFrameItem.cs +++ b/src/log4net/Core/StackFrameItem.cs @@ -180,7 +180,7 @@ public string FullInfo /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(StackFrameItem); + private static readonly Type declaringType = typeof(StackFrameItem); /// /// When location information is not available the constant diff --git a/src/log4net/Core/WrapperMap.cs b/src/log4net/Core/WrapperMap.cs index a43a8b8d..d4f5b257 100644 --- a/src/log4net/Core/WrapperMap.cs +++ b/src/log4net/Core/WrapperMap.cs @@ -105,7 +105,7 @@ public WrapperMap(WrapperCreationHandler createWrapperHandler) /// called. /// /// - virtual public ILoggerWrapper GetWrapper(ILogger logger) + public virtual ILoggerWrapper GetWrapper(ILogger logger) { // If the logger is null then the corresponding wrapper is null if (logger == null) @@ -186,7 +186,7 @@ protected Hashtable Repositories /// can be overridden in a subclass. /// /// - virtual protected ILoggerWrapper CreateNewWrapperObject(ILogger logger) + protected virtual ILoggerWrapper CreateNewWrapperObject(ILogger logger) { if (m_createWrapperHandler != null) { @@ -208,7 +208,7 @@ virtual protected ILoggerWrapper CreateNewWrapperObject(ILogger logger) /// and their wrappers generated for this repository. /// /// - virtual protected void RepositoryShutdown(ILoggerRepository repository) + protected virtual void RepositoryShutdown(ILoggerRepository repository) { lock(this) { diff --git a/src/log4net/DateFormatter/AbsoluteTimeDateFormatter.cs b/src/log4net/DateFormatter/AbsoluteTimeDateFormatter.cs index 11741073..c6333038 100644 --- a/src/log4net/DateFormatter/AbsoluteTimeDateFormatter.cs +++ b/src/log4net/DateFormatter/AbsoluteTimeDateFormatter.cs @@ -51,7 +51,7 @@ public class AbsoluteTimeDateFormatter : IDateFormatter /// reused if it is needed again during the same second. /// /// - virtual protected void FormatDateWithoutMillis(DateTime dateToFormat, StringBuilder buffer) + protected virtual void FormatDateWithoutMillis(DateTime dateToFormat, StringBuilder buffer) { int hour = dateToFormat.Hour; if (hour < 10) @@ -99,7 +99,7 @@ virtual protected void FormatDateWithoutMillis(DateTime dateToFormat, StringBuil /// rather than . /// /// - virtual public void FormatDate(DateTime dateToFormat, TextWriter writer) + public virtual void FormatDate(DateTime dateToFormat, TextWriter writer) { lock (s_lastTimeStrings) { diff --git a/src/log4net/DateFormatter/DateTimeDateFormatter.cs b/src/log4net/DateFormatter/DateTimeDateFormatter.cs index 03dcca95..7411206c 100644 --- a/src/log4net/DateFormatter/DateTimeDateFormatter.cs +++ b/src/log4net/DateFormatter/DateTimeDateFormatter.cs @@ -72,7 +72,7 @@ public DateTimeDateFormatter() /// This method will only be called at most once per second. /// /// - override protected void FormatDateWithoutMillis(DateTime dateToFormat, StringBuilder buffer) + protected override void FormatDateWithoutMillis(DateTime dateToFormat, StringBuilder buffer) { int day = dateToFormat.Day; if (day < 10) diff --git a/src/log4net/DateFormatter/Iso8601DateFormatter.cs b/src/log4net/DateFormatter/Iso8601DateFormatter.cs index a7e88d55..524c8a79 100644 --- a/src/log4net/DateFormatter/Iso8601DateFormatter.cs +++ b/src/log4net/DateFormatter/Iso8601DateFormatter.cs @@ -66,7 +66,7 @@ public Iso8601DateFormatter() /// This method will only be called at most once per second. /// /// - override protected void FormatDateWithoutMillis(DateTime dateToFormat, StringBuilder buffer) + protected override void FormatDateWithoutMillis(DateTime dateToFormat, StringBuilder buffer) { buffer.Append(dateToFormat.Year); diff --git a/src/log4net/DateFormatter/SimpleDateFormatter.cs b/src/log4net/DateFormatter/SimpleDateFormatter.cs index c112ca1a..3efb1643 100644 --- a/src/log4net/DateFormatter/SimpleDateFormatter.cs +++ b/src/log4net/DateFormatter/SimpleDateFormatter.cs @@ -70,7 +70,7 @@ public SimpleDateFormatter(string format) /// the method to format the date. /// /// - virtual public void FormatDate(DateTime dateToFormat, TextWriter writer) + public virtual void FormatDate(DateTime dateToFormat, TextWriter writer) { writer.Write(dateToFormat.ToString(m_formatString, System.Globalization.DateTimeFormatInfo.InvariantInfo)); } diff --git a/src/log4net/Filter/DenyAllFilter.cs b/src/log4net/Filter/DenyAllFilter.cs index e17a16ff..ab377f1e 100644 --- a/src/log4net/Filter/DenyAllFilter.cs +++ b/src/log4net/Filter/DenyAllFilter.cs @@ -65,7 +65,7 @@ public DenyAllFilter() /// as any further filters will be ignored! /// /// - override public FilterDecision Decide(LoggingEvent loggingEvent) + public override FilterDecision Decide(LoggingEvent loggingEvent) { return FilterDecision.Deny; } diff --git a/src/log4net/Filter/FilterSkeleton.cs b/src/log4net/Filter/FilterSkeleton.cs index 9cc24d80..293d3ca5 100644 --- a/src/log4net/Filter/FilterSkeleton.cs +++ b/src/log4net/Filter/FilterSkeleton.cs @@ -104,7 +104,7 @@ public abstract class FilterSkeleton : IFilter /// however this method must still be called. /// /// - virtual public void ActivateOptions() + public virtual void ActivateOptions() { } @@ -130,7 +130,7 @@ virtual public void ActivateOptions() /// in a subclass. /// /// - abstract public FilterDecision Decide(LoggingEvent loggingEvent); + public abstract FilterDecision Decide(LoggingEvent loggingEvent); /// /// Property to get and set the next filter diff --git a/src/log4net/Filter/LevelMatchFilter.cs b/src/log4net/Filter/LevelMatchFilter.cs index 2d3465a2..34a21b3f 100644 --- a/src/log4net/Filter/LevelMatchFilter.cs +++ b/src/log4net/Filter/LevelMatchFilter.cs @@ -122,7 +122,7 @@ public Level LevelToMatch /// the result will be . /// /// - override public FilterDecision Decide(LoggingEvent loggingEvent) + public override FilterDecision Decide(LoggingEvent loggingEvent) { if (loggingEvent == null) { diff --git a/src/log4net/Filter/LevelRangeFilter.cs b/src/log4net/Filter/LevelRangeFilter.cs index 9afc03a1..f6e0be00 100644 --- a/src/log4net/Filter/LevelRangeFilter.cs +++ b/src/log4net/Filter/LevelRangeFilter.cs @@ -142,7 +142,7 @@ public Level LevelMax /// is returned. /// /// - override public FilterDecision Decide(LoggingEvent loggingEvent) + public override FilterDecision Decide(LoggingEvent loggingEvent) { if (loggingEvent == null) { diff --git a/src/log4net/Filter/LoggerMatchFilter.cs b/src/log4net/Filter/LoggerMatchFilter.cs index 828a304e..28264ec1 100644 --- a/src/log4net/Filter/LoggerMatchFilter.cs +++ b/src/log4net/Filter/LoggerMatchFilter.cs @@ -129,7 +129,7 @@ public string LoggerToMatch /// is returned. /// /// - override public FilterDecision Decide(LoggingEvent loggingEvent) + public override FilterDecision Decide(LoggingEvent loggingEvent) { if (loggingEvent == null) { diff --git a/src/log4net/Filter/PropertyFilter.cs b/src/log4net/Filter/PropertyFilter.cs index 8c35c7fe..a74a03b0 100644 --- a/src/log4net/Filter/PropertyFilter.cs +++ b/src/log4net/Filter/PropertyFilter.cs @@ -94,7 +94,7 @@ public string Key /// is returned. /// /// - override public FilterDecision Decide(LoggingEvent loggingEvent) + public override FilterDecision Decide(LoggingEvent loggingEvent) { if (loggingEvent == null) { diff --git a/src/log4net/Filter/StringMatchFilter.cs b/src/log4net/Filter/StringMatchFilter.cs index 38fa49d4..840a95d0 100644 --- a/src/log4net/Filter/StringMatchFilter.cs +++ b/src/log4net/Filter/StringMatchFilter.cs @@ -91,7 +91,7 @@ public StringMatchFilter() /// must be called again. /// /// - override public void ActivateOptions() + public override void ActivateOptions() { if (m_stringRegexToMatch != null) { @@ -186,7 +186,7 @@ public string RegexToMatch /// is returned. /// /// - override public FilterDecision Decide(LoggingEvent loggingEvent) + public override FilterDecision Decide(LoggingEvent loggingEvent) { if (loggingEvent == null) { diff --git a/src/log4net/GlobalContext.cs b/src/log4net/GlobalContext.cs index dd02a90c..222b90c8 100644 --- a/src/log4net/GlobalContext.cs +++ b/src/log4net/GlobalContext.cs @@ -95,7 +95,7 @@ public static GlobalContextProperties Properties /// /// The global context properties instance /// - private readonly static GlobalContextProperties s_properties = new GlobalContextProperties(); + private static readonly GlobalContextProperties s_properties = new GlobalContextProperties(); #endregion Private Static Fields } diff --git a/src/log4net/Layout/ExceptionLayout.cs b/src/log4net/Layout/ExceptionLayout.cs index 06c4509b..90217077 100644 --- a/src/log4net/Layout/ExceptionLayout.cs +++ b/src/log4net/Layout/ExceptionLayout.cs @@ -73,7 +73,7 @@ public ExceptionLayout() /// This method does nothing as options become effective immediately. /// /// - override public void ActivateOptions() + public override void ActivateOptions() { // nothing to do. } @@ -93,7 +93,7 @@ override public void ActivateOptions() /// The exception string is retrieved from . /// /// - override public void Format(TextWriter writer, LoggingEvent loggingEvent) + public override void Format(TextWriter writer, LoggingEvent loggingEvent) { if (loggingEvent == null) { diff --git a/src/log4net/Layout/Layout2RawLayoutAdapter.cs b/src/log4net/Layout/Layout2RawLayoutAdapter.cs index 49457841..9b92bf46 100644 --- a/src/log4net/Layout/Layout2RawLayoutAdapter.cs +++ b/src/log4net/Layout/Layout2RawLayoutAdapter.cs @@ -81,7 +81,7 @@ public Layout2RawLayoutAdapter(ILayout layout) /// the constructor to perform the formatting. /// /// - virtual public object Format(LoggingEvent loggingEvent) + public virtual object Format(LoggingEvent loggingEvent) { using StringWriter writer = new StringWriter(System.Globalization.CultureInfo.InvariantCulture); m_layout.Format(writer, loggingEvent); diff --git a/src/log4net/Layout/LayoutSkeleton.cs b/src/log4net/Layout/LayoutSkeleton.cs index afae60e7..1f26c8e6 100644 --- a/src/log4net/Layout/LayoutSkeleton.cs +++ b/src/log4net/Layout/LayoutSkeleton.cs @@ -121,7 +121,7 @@ protected LayoutSkeleton() /// This method must be implemented by the subclass. /// /// - abstract public void ActivateOptions(); + public abstract void ActivateOptions(); #endregion @@ -138,7 +138,7 @@ protected LayoutSkeleton() /// the as text. /// /// - abstract public void Format(TextWriter writer, LoggingEvent loggingEvent); + public abstract void Format(TextWriter writer, LoggingEvent loggingEvent); /// /// Convenience method for easily formatting the logging event into a string variable. @@ -168,7 +168,7 @@ public string Format(LoggingEvent loggingEvent) /// property. /// /// - virtual public string ContentType + public virtual string ContentType { get { return "text/plain"; } } @@ -183,7 +183,7 @@ virtual public string ContentType /// are formatted and appended. /// /// - virtual public string Header + public virtual string Header { get { return m_header; } set { m_header = value; } @@ -199,7 +199,7 @@ virtual public string Header /// have been formatted and appended. /// /// - virtual public string Footer + public virtual string Footer { get { return m_footer; } set { m_footer = value; } @@ -221,7 +221,7 @@ virtual public string Footer /// value is true, this layout does not handle the exception. /// /// - virtual public bool IgnoresException + public virtual bool IgnoresException { get { return m_ignoresException; } set { m_ignoresException = value; } diff --git a/src/log4net/Layout/Pattern/AppDomainPatternConverter.cs b/src/log4net/Layout/Pattern/AppDomainPatternConverter.cs index 37369c4f..30b7f096 100644 --- a/src/log4net/Layout/Pattern/AppDomainPatternConverter.cs +++ b/src/log4net/Layout/Pattern/AppDomainPatternConverter.cs @@ -47,7 +47,7 @@ internal sealed class AppDomainPatternConverter : PatternLayoutConverter /// Writes the to the output . /// /// - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) { writer.Write(loggingEvent.Domain); } diff --git a/src/log4net/Layout/Pattern/DatePatternConverter.cs b/src/log4net/Layout/Pattern/DatePatternConverter.cs index 72d3df1a..c283ba1f 100644 --- a/src/log4net/Layout/Pattern/DatePatternConverter.cs +++ b/src/log4net/Layout/Pattern/DatePatternConverter.cs @@ -161,7 +161,7 @@ public void ActivateOptions() /// The passed is in the local time zone. /// /// - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) { try { @@ -182,7 +182,7 @@ override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(DatePatternConverter); + private static readonly Type declaringType = typeof(DatePatternConverter); #endregion Private Static Fields } diff --git a/src/log4net/Layout/Pattern/ExceptionPatternConverter.cs b/src/log4net/Layout/Pattern/ExceptionPatternConverter.cs index 7ab88d00..00913049 100644 --- a/src/log4net/Layout/Pattern/ExceptionPatternConverter.cs +++ b/src/log4net/Layout/Pattern/ExceptionPatternConverter.cs @@ -90,7 +90,7 @@ public ExceptionPatternConverter() /// /// /// - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) { if (loggingEvent.ExceptionObject != null && Option != null && Option.Length > 0) { diff --git a/src/log4net/Layout/Pattern/FileLocationPatternConverter.cs b/src/log4net/Layout/Pattern/FileLocationPatternConverter.cs index bcec221e..d555c61c 100644 --- a/src/log4net/Layout/Pattern/FileLocationPatternConverter.cs +++ b/src/log4net/Layout/Pattern/FileLocationPatternConverter.cs @@ -48,7 +48,7 @@ internal sealed class FileLocationPatternConverter : PatternLayoutConverter /// the to the output . /// /// - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) { writer.Write(loggingEvent.LocationInformation.FileName); } diff --git a/src/log4net/Layout/Pattern/FullLocationPatternConverter.cs b/src/log4net/Layout/Pattern/FullLocationPatternConverter.cs index 2a3bedab..ac5dab66 100644 --- a/src/log4net/Layout/Pattern/FullLocationPatternConverter.cs +++ b/src/log4net/Layout/Pattern/FullLocationPatternConverter.cs @@ -46,7 +46,7 @@ internal sealed class FullLocationPatternConverter : PatternLayoutConverter /// Writes the to the output writer. /// /// - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) { writer.Write( loggingEvent.LocationInformation.FullInfo ); } diff --git a/src/log4net/Layout/Pattern/IdentityPatternConverter.cs b/src/log4net/Layout/Pattern/IdentityPatternConverter.cs index fd84299e..0ef245c0 100644 --- a/src/log4net/Layout/Pattern/IdentityPatternConverter.cs +++ b/src/log4net/Layout/Pattern/IdentityPatternConverter.cs @@ -50,7 +50,7 @@ internal sealed class IdentityPatternConverter : PatternLayoutConverter /// the output . /// /// - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) { writer.Write(loggingEvent.Identity); } diff --git a/src/log4net/Layout/Pattern/LevelPatternConverter.cs b/src/log4net/Layout/Pattern/LevelPatternConverter.cs index 35227e06..21af92b1 100644 --- a/src/log4net/Layout/Pattern/LevelPatternConverter.cs +++ b/src/log4net/Layout/Pattern/LevelPatternConverter.cs @@ -48,7 +48,7 @@ internal sealed class LevelPatternConverter : PatternLayoutConverter /// to the . /// /// - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) { writer.Write( loggingEvent.Level.DisplayName ); } diff --git a/src/log4net/Layout/Pattern/LineLocationPatternConverter.cs b/src/log4net/Layout/Pattern/LineLocationPatternConverter.cs index 2e54dfae..07c91e8a 100644 --- a/src/log4net/Layout/Pattern/LineLocationPatternConverter.cs +++ b/src/log4net/Layout/Pattern/LineLocationPatternConverter.cs @@ -48,7 +48,7 @@ internal sealed class LineLocationPatternConverter : PatternLayoutConverter /// the to the output . /// /// - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) { writer.Write(loggingEvent.LocationInformation.LineNumber); } diff --git a/src/log4net/Layout/Pattern/LoggerPatternConverter.cs b/src/log4net/Layout/Pattern/LoggerPatternConverter.cs index b56f7c9d..471b4aa2 100644 --- a/src/log4net/Layout/Pattern/LoggerPatternConverter.cs +++ b/src/log4net/Layout/Pattern/LoggerPatternConverter.cs @@ -46,7 +46,7 @@ internal sealed class LoggerPatternConverter : NamedPatternConverter /// Returns the of the . /// /// - override protected string GetFullyQualifiedName(LoggingEvent loggingEvent) + protected override string GetFullyQualifiedName(LoggingEvent loggingEvent) { return loggingEvent.LoggerName; } diff --git a/src/log4net/Layout/Pattern/MessagePatternConverter.cs b/src/log4net/Layout/Pattern/MessagePatternConverter.cs index 43d13fe7..cf0f5afc 100644 --- a/src/log4net/Layout/Pattern/MessagePatternConverter.cs +++ b/src/log4net/Layout/Pattern/MessagePatternConverter.cs @@ -48,7 +48,7 @@ internal sealed class MessagePatternConverter : PatternLayoutConverter /// to write out the event message. /// /// - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) { loggingEvent.WriteRenderedMessage(writer); } diff --git a/src/log4net/Layout/Pattern/MethodLocationPatternConverter.cs b/src/log4net/Layout/Pattern/MethodLocationPatternConverter.cs index a0537adf..90fa7559 100644 --- a/src/log4net/Layout/Pattern/MethodLocationPatternConverter.cs +++ b/src/log4net/Layout/Pattern/MethodLocationPatternConverter.cs @@ -48,7 +48,7 @@ internal sealed class MethodLocationPatternConverter : PatternLayoutConverter /// the output. /// /// - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) { writer.Write(loggingEvent.LocationInformation.MethodName); } diff --git a/src/log4net/Layout/Pattern/NamedPatternConverter.cs b/src/log4net/Layout/Pattern/NamedPatternConverter.cs index 8338706e..d94a9c81 100644 --- a/src/log4net/Layout/Pattern/NamedPatternConverter.cs +++ b/src/log4net/Layout/Pattern/NamedPatternConverter.cs @@ -109,7 +109,7 @@ public void ActivateOptions() /// Return the fully qualified '.' (dot/period) separated string. /// /// - abstract protected string GetFullyQualifiedName(LoggingEvent loggingEvent); + protected abstract string GetFullyQualifiedName(LoggingEvent loggingEvent); /// /// Convert the pattern to the rendered message @@ -120,7 +120,7 @@ public void ActivateOptions() /// Render the to the precision /// specified by the property. /// - sealed override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + protected sealed override void Convert(TextWriter writer, LoggingEvent loggingEvent) { string name = GetFullyQualifiedName(loggingEvent); if (m_precision <= 0 || name == null || name.Length < 2) @@ -163,7 +163,7 @@ sealed override protected void Convert(TextWriter writer, LoggingEvent loggingEv /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(NamedPatternConverter); + private static readonly Type declaringType = typeof(NamedPatternConverter); private const string DOT = "."; #endregion Private Static Fields diff --git a/src/log4net/Layout/Pattern/NdcPatternConverter.cs b/src/log4net/Layout/Pattern/NdcPatternConverter.cs index 947fb129..57216814 100644 --- a/src/log4net/Layout/Pattern/NdcPatternConverter.cs +++ b/src/log4net/Layout/Pattern/NdcPatternConverter.cs @@ -53,7 +53,7 @@ internal sealed class NdcPatternConverter : PatternLayoutConverter /// The should be used instead. /// /// - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) { // Write the value for the specified key WriteObject(writer, loggingEvent.Repository, loggingEvent.LookupProperty("NDC")); diff --git a/src/log4net/Layout/Pattern/PatternLayoutConverter.cs b/src/log4net/Layout/Pattern/PatternLayoutConverter.cs index f0ed36f3..b805b395 100644 --- a/src/log4net/Layout/Pattern/PatternLayoutConverter.cs +++ b/src/log4net/Layout/Pattern/PatternLayoutConverter.cs @@ -69,7 +69,7 @@ protected PatternLayoutConverter() /// value is true, this converter does not handle the exception. /// /// - virtual public bool IgnoresException + public virtual bool IgnoresException { get { return m_ignoresException; } set { m_ignoresException = value; } @@ -85,7 +85,7 @@ virtual public bool IgnoresException /// /// that will receive the formatted result. /// The on which the pattern converter should be executed. - abstract protected void Convert(TextWriter writer, LoggingEvent loggingEvent); + protected abstract void Convert(TextWriter writer, LoggingEvent loggingEvent); #endregion Protected Abstract Methods @@ -97,7 +97,7 @@ virtual public bool IgnoresException /// /// that will receive the formatted result. /// The state object on which the pattern converter should be executed. - override protected void Convert(TextWriter writer, object state) + protected override void Convert(TextWriter writer, object state) { LoggingEvent loggingEvent = state as LoggingEvent; if (loggingEvent != null) diff --git a/src/log4net/Layout/Pattern/PropertyPatternConverter.cs b/src/log4net/Layout/Pattern/PropertyPatternConverter.cs index f2d9e372..44a096b9 100644 --- a/src/log4net/Layout/Pattern/PropertyPatternConverter.cs +++ b/src/log4net/Layout/Pattern/PropertyPatternConverter.cs @@ -60,7 +60,7 @@ internal sealed class PropertyPatternConverter : PatternLayoutConverter /// then all the properties are written as key value pairs. /// /// - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) { if (Option != null) { diff --git a/src/log4net/Layout/Pattern/RelativeTimePatternConverter.cs b/src/log4net/Layout/Pattern/RelativeTimePatternConverter.cs index a5d3495b..01b9ae2b 100644 --- a/src/log4net/Layout/Pattern/RelativeTimePatternConverter.cs +++ b/src/log4net/Layout/Pattern/RelativeTimePatternConverter.cs @@ -48,7 +48,7 @@ internal sealed class RelativeTimePatternConverter : PatternLayoutConverter /// and the . /// /// - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) { writer.Write( TimeDifferenceInMillis(LoggingEvent.StartTimeUtc, loggingEvent.TimeStampUtc).ToString(System.Globalization.NumberFormatInfo.InvariantInfo) ); } diff --git a/src/log4net/Layout/Pattern/StackTraceDetailPatternConverter.cs b/src/log4net/Layout/Pattern/StackTraceDetailPatternConverter.cs index 47be2dcd..9e020cb3 100644 --- a/src/log4net/Layout/Pattern/StackTraceDetailPatternConverter.cs +++ b/src/log4net/Layout/Pattern/StackTraceDetailPatternConverter.cs @@ -82,7 +82,7 @@ internal override string GetMethodInformation(MethodItem method) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(StackTracePatternConverter); + private static readonly Type declaringType = typeof(StackTracePatternConverter); #endregion Private Static Fields } diff --git a/src/log4net/Layout/Pattern/StackTracePatternConverter.cs b/src/log4net/Layout/Pattern/StackTracePatternConverter.cs index de67e63c..7773868d 100644 --- a/src/log4net/Layout/Pattern/StackTracePatternConverter.cs +++ b/src/log4net/Layout/Pattern/StackTracePatternConverter.cs @@ -92,7 +92,7 @@ public void ActivateOptions() /// Writes the to the output writer. /// /// - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) { StackFrameItem[] stackframes = loggingEvent.LocationInformation.StackFrames; if ((stackframes == null) || (stackframes.Length <= 0)) @@ -141,7 +141,7 @@ internal virtual string GetMethodInformation(MethodItem method) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(StackTracePatternConverter); + private static readonly Type declaringType = typeof(StackTracePatternConverter); #endregion Private Static Fields } diff --git a/src/log4net/Layout/Pattern/ThreadPatternConverter.cs b/src/log4net/Layout/Pattern/ThreadPatternConverter.cs index c306a373..122c361e 100644 --- a/src/log4net/Layout/Pattern/ThreadPatternConverter.cs +++ b/src/log4net/Layout/Pattern/ThreadPatternConverter.cs @@ -46,7 +46,7 @@ internal sealed class ThreadPatternConverter : PatternLayoutConverter /// Writes the to the . /// /// - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) { writer.Write(loggingEvent.ThreadName); } diff --git a/src/log4net/Layout/Pattern/TypeNamePatternConverter.cs b/src/log4net/Layout/Pattern/TypeNamePatternConverter.cs index acca1cb3..8b5fce81 100644 --- a/src/log4net/Layout/Pattern/TypeNamePatternConverter.cs +++ b/src/log4net/Layout/Pattern/TypeNamePatternConverter.cs @@ -46,7 +46,7 @@ internal sealed class TypeNamePatternConverter : NamedPatternConverter /// Returns the of the . /// /// - override protected string GetFullyQualifiedName(LoggingEvent loggingEvent) + protected override string GetFullyQualifiedName(LoggingEvent loggingEvent) { if (loggingEvent == null) { diff --git a/src/log4net/Layout/Pattern/UserNamePatternConverter.cs b/src/log4net/Layout/Pattern/UserNamePatternConverter.cs index 8c0518f5..1f64c0cb 100644 --- a/src/log4net/Layout/Pattern/UserNamePatternConverter.cs +++ b/src/log4net/Layout/Pattern/UserNamePatternConverter.cs @@ -37,7 +37,7 @@ internal sealed class UserNamePatternConverter : PatternLayoutConverter /// /// that will receive the formatted result. /// the event being logged - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) { writer.Write( loggingEvent.UserName ); } diff --git a/src/log4net/Layout/Pattern/UtcDatePatternConverter.cs b/src/log4net/Layout/Pattern/UtcDatePatternConverter.cs index 41caf288..95227f75 100644 --- a/src/log4net/Layout/Pattern/UtcDatePatternConverter.cs +++ b/src/log4net/Layout/Pattern/UtcDatePatternConverter.cs @@ -63,7 +63,7 @@ internal class UtcDatePatternConverter : DatePatternConverter /// /// /// - override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) { try { @@ -84,7 +84,7 @@ override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(UtcDatePatternConverter); + private static readonly Type declaringType = typeof(UtcDatePatternConverter); #endregion Private Static Fields } diff --git a/src/log4net/Layout/PatternLayout.cs b/src/log4net/Layout/PatternLayout.cs index 6e49bfdd..49cad595 100644 --- a/src/log4net/Layout/PatternLayout.cs +++ b/src/log4net/Layout/PatternLayout.cs @@ -1019,7 +1019,7 @@ public string ConversionPattern /// global and instance rules on the . /// /// - virtual protected PatternParser CreatePatternParser(string pattern) + protected virtual PatternParser CreatePatternParser(string pattern) { PatternParser patternParser = new PatternParser(pattern); @@ -1058,7 +1058,7 @@ virtual protected PatternParser CreatePatternParser(string pattern) /// must be called again. /// /// - override public void ActivateOptions() + public override void ActivateOptions() { m_head = CreatePatternParser(m_pattern).Parse(); @@ -1095,7 +1095,7 @@ override public void ActivateOptions() /// specified in the property. /// /// - override public void Format(TextWriter writer, LoggingEvent loggingEvent) + public override void Format(TextWriter writer, LoggingEvent loggingEvent) { if (writer == null) { diff --git a/src/log4net/Layout/SimpleLayout.cs b/src/log4net/Layout/SimpleLayout.cs index b330ee7a..5efe0d08 100644 --- a/src/log4net/Layout/SimpleLayout.cs +++ b/src/log4net/Layout/SimpleLayout.cs @@ -72,7 +72,7 @@ public SimpleLayout() /// must be called again. /// /// - override public void ActivateOptions() + public override void ActivateOptions() { // nothing to do. } @@ -93,7 +93,7 @@ override public void ActivateOptions() /// output is terminated by a newline. /// /// - override public void Format(TextWriter writer, LoggingEvent loggingEvent) + public override void Format(TextWriter writer, LoggingEvent loggingEvent) { if (loggingEvent == null) { diff --git a/src/log4net/Layout/XmlLayout.cs b/src/log4net/Layout/XmlLayout.cs index 61e366ed..66b7dcf8 100644 --- a/src/log4net/Layout/XmlLayout.cs +++ b/src/log4net/Layout/XmlLayout.cs @@ -184,7 +184,7 @@ public bool Base64EncodeProperties /// Builds a cache of the element names /// /// - override public void ActivateOptions() + public override void ActivateOptions() { base.ActivateOptions(); @@ -215,7 +215,7 @@ override public void ActivateOptions() /// to write the to the . /// /// - override protected void FormatXml(XmlWriter writer, LoggingEvent loggingEvent) + protected override void FormatXml(XmlWriter writer, LoggingEvent loggingEvent) { writer.WriteStartElement(m_elmEvent); writer.WriteAttributeString(ATTR_LOGGER, loggingEvent.LoggerName); diff --git a/src/log4net/Layout/XmlLayoutBase.cs b/src/log4net/Layout/XmlLayoutBase.cs index c046bc01..2f35f8b7 100644 --- a/src/log4net/Layout/XmlLayoutBase.cs +++ b/src/log4net/Layout/XmlLayoutBase.cs @@ -41,7 +41,7 @@ namespace log4net.Layout /// /// Nicko Cadell /// Gert Driesen - abstract public class XmlLayoutBase : LayoutSkeleton + public abstract class XmlLayoutBase : LayoutSkeleton { #region Protected Instance Constructors @@ -149,7 +149,7 @@ public string InvalidCharReplacement /// must be called again. /// /// - override public void ActivateOptions() + public override void ActivateOptions() { // nothing to do } @@ -169,7 +169,7 @@ override public void ActivateOptions() /// As this is the XML layout, the value is always "text/xml". /// /// - override public string ContentType + public override string ContentType { get { return "text/xml"; } } @@ -190,7 +190,7 @@ override public string ContentType /// method rather than this method. /// /// - override public void Format(TextWriter writer, LoggingEvent loggingEvent) + public override void Format(TextWriter writer, LoggingEvent loggingEvent) { if (loggingEvent == null) { @@ -233,7 +233,7 @@ override public void Format(TextWriter writer, LoggingEvent loggingEvent) /// the as XML. /// /// - abstract protected void FormatXml(XmlWriter writer, LoggingEvent loggingEvent); + protected abstract void FormatXml(XmlWriter writer, LoggingEvent loggingEvent); #endregion Protected Instance Methods diff --git a/src/log4net/Layout/XmlLayoutSchemaLog4j.cs b/src/log4net/Layout/XmlLayoutSchemaLog4j.cs index b4791022..fe66d597 100644 --- a/src/log4net/Layout/XmlLayoutSchemaLog4j.cs +++ b/src/log4net/Layout/XmlLayoutSchemaLog4j.cs @@ -136,7 +136,7 @@ at org.apache.log4j.chainsaw.Generator.run(Generator.java:94) /// Generate XML that is compatible with the log4j schema. /// /// - override protected void FormatXml(XmlWriter writer, LoggingEvent loggingEvent) + protected override void FormatXml(XmlWriter writer, LoggingEvent loggingEvent) { // Translate logging events for log4j diff --git a/src/log4net/LogicalThreadContext.cs b/src/log4net/LogicalThreadContext.cs index da99eb1d..937f952c 100644 --- a/src/log4net/LogicalThreadContext.cs +++ b/src/log4net/LogicalThreadContext.cs @@ -139,12 +139,12 @@ public static LogicalThreadContextStacks Stacks /// /// The thread context properties instance /// - private readonly static LogicalThreadContextProperties s_properties = new LogicalThreadContextProperties(); + private static readonly LogicalThreadContextProperties s_properties = new LogicalThreadContextProperties(); /// /// The thread context stacks instance /// - private readonly static LogicalThreadContextStacks s_stacks = new LogicalThreadContextStacks(s_properties); + private static readonly LogicalThreadContextStacks s_stacks = new LogicalThreadContextStacks(s_properties); #endregion Private Static Fields } diff --git a/src/log4net/ObjectRenderer/RendererMap.cs b/src/log4net/ObjectRenderer/RendererMap.cs index 666dfda4..c785e27e 100644 --- a/src/log4net/ObjectRenderer/RendererMap.cs +++ b/src/log4net/ObjectRenderer/RendererMap.cs @@ -45,7 +45,7 @@ namespace log4net.ObjectRenderer /// Gert Driesen public class RendererMap { - private readonly static Type declaringType = typeof(RendererMap); + private static readonly Type declaringType = typeof(RendererMap); #region Member Variables diff --git a/src/log4net/Plugin/RemoteLoggingServerPlugin.cs b/src/log4net/Plugin/RemoteLoggingServerPlugin.cs index 7305ef5d..ff5824bb 100644 --- a/src/log4net/Plugin/RemoteLoggingServerPlugin.cs +++ b/src/log4net/Plugin/RemoteLoggingServerPlugin.cs @@ -123,7 +123,7 @@ public virtual string SinkUri #if NET_4_0 || MONO_4_0 [System.Security.SecuritySafeCritical] #endif - override public void Attach(ILoggerRepository repository) + public override void Attach(ILoggerRepository repository) { base.Attach(repository); @@ -152,7 +152,7 @@ override public void Attach(ILoggerRepository repository) #if NET_4_0 || MONO_4_0 [System.Security.SecuritySafeCritical] #endif - override public void Shutdown() + public override void Shutdown() { // Stops the sink from receiving messages RemotingServices.Disconnect(m_sink); @@ -179,7 +179,7 @@ override public void Shutdown() /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(RemoteLoggingServerPlugin); + private static readonly Type declaringType = typeof(RemoteLoggingServerPlugin); #endregion Private Static Fields diff --git a/src/log4net/Repository/Hierarchy/Hierarchy.cs b/src/log4net/Repository/Hierarchy/Hierarchy.cs index 0f4138f1..c21d09af 100644 --- a/src/log4net/Repository/Hierarchy/Hierarchy.cs +++ b/src/log4net/Repository/Hierarchy/Hierarchy.cs @@ -290,7 +290,7 @@ public ILoggerFactory LoggerFactory /// its reference, otherwise returns null. /// /// - override public ILogger Exists(string name) + public override ILogger Exists(string name) { if (name == null) { @@ -314,7 +314,7 @@ override public ILogger Exists(string name) /// enumeration. /// /// - override public ILogger[] GetCurrentLoggers() + public override ILogger[] GetCurrentLoggers() { // The accumulation in loggers is necessary because not all elements in // ht are Logger objects as there might be some ProvisionNodes @@ -352,7 +352,7 @@ override public ILogger[] GetCurrentLoggers() /// /// The name of the logger to retrieve /// The logger object with the name specified - override public ILogger GetLogger(string name) + public override ILogger GetLogger(string name) { if (name == null) { @@ -383,7 +383,7 @@ override public ILogger GetLogger(string name) /// and again to a nested appender. /// /// - override public void Shutdown() + public override void Shutdown() { LogLog.Debug(declaringType, "Shutdown called on Hierarchy ["+this.Name+"]"); @@ -431,7 +431,7 @@ override public void Shutdown() /// block all logging until it is completed. /// /// - override public void ResetConfiguration() + public override void ResetConfiguration() { Root.Level = LevelMap.LookupWithDefault(Level.Debug); Threshold = LevelMap.LookupWithDefault(Level.All); @@ -470,7 +470,7 @@ override public void ResetConfiguration() /// that logger is then responsible for logging the event. /// /// - override public void Log(LoggingEvent logEvent) + public override void Log(LoggingEvent logEvent) { if (logEvent == null) { @@ -494,7 +494,7 @@ override public void Log(LoggingEvent logEvent) /// The list returned is unordered but does not contain duplicates. /// /// - override public Appender.IAppender[] GetAppenders() + public override Appender.IAppender[] GetAppenders() { System.Collections.ArrayList appenderList = new System.Collections.ArrayList(); @@ -1079,7 +1079,7 @@ internal void AddProperty(PropertyEntry propertyEntry) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(Hierarchy); + private static readonly Type declaringType = typeof(Hierarchy); #endregion Private Static Fields } diff --git a/src/log4net/Repository/Hierarchy/Logger.cs b/src/log4net/Repository/Hierarchy/Logger.cs index c7a081dc..839e688d 100644 --- a/src/log4net/Repository/Hierarchy/Logger.cs +++ b/src/log4net/Repository/Hierarchy/Logger.cs @@ -96,7 +96,7 @@ protected Logger(string name) /// The hierarchy is parent linked rather than child linked. /// /// - virtual public Logger Parent + public virtual Logger Parent { get { return m_parent; } set { m_parent = value; } @@ -119,7 +119,7 @@ virtual public Logger Parent /// the user manual for more details. /// /// - virtual public bool Additivity + public virtual bool Additivity { get { return m_additive; } set { m_additive = value; } @@ -138,7 +138,7 @@ virtual public bool Additivity /// The Logger class is designed so that this method executes as /// quickly as possible. /// - virtual public Level EffectiveLevel + public virtual Level EffectiveLevel { get { @@ -166,7 +166,7 @@ virtual public Level EffectiveLevel /// This logger must be attached to a single . /// /// - virtual public Hierarchy Hierarchy + public virtual Hierarchy Hierarchy { get { return m_hierarchy; } set { m_hierarchy = value; } @@ -183,7 +183,7 @@ virtual public Hierarchy Hierarchy /// The assigned can be null. /// /// - virtual public Level Level + public virtual Level Level { get { return m_level; } set { m_level = value; } @@ -208,7 +208,7 @@ virtual public Level Level /// appenders, then it won't be added again. /// /// - virtual public void AddAppender(IAppender newAppender) + public virtual void AddAppender(IAppender newAppender) { if (newAppender == null) { @@ -242,7 +242,7 @@ virtual public void AddAppender(IAppender newAppender) /// can be found, then a is returned. /// /// - virtual public AppenderCollection Appenders + public virtual AppenderCollection Appenders { get { @@ -275,7 +275,7 @@ virtual public AppenderCollection Appenders /// Returns the named appender, or null if the appender is not found. /// /// - virtual public IAppender GetAppender(string name) + public virtual IAppender GetAppender(string name) { m_appenderLock.AcquireReaderLock(); try @@ -304,7 +304,7 @@ virtual public IAppender GetAppender(string name) /// This is useful when re-reading configuration information. /// /// - virtual public void RemoveAllAppenders() + public virtual void RemoveAllAppenders() { m_appenderLock.AcquireWriterLock(); try @@ -334,7 +334,7 @@ virtual public void RemoveAllAppenders() /// on the appender removed. /// /// - virtual public IAppender RemoveAppender(IAppender appender) + public virtual IAppender RemoveAppender(IAppender appender) { m_appenderLock.AcquireWriterLock(); try @@ -364,7 +364,7 @@ virtual public IAppender RemoveAppender(IAppender appender) /// on the appender removed. /// /// - virtual public IAppender RemoveAppender(string name) + public virtual IAppender RemoveAppender(string name) { m_appenderLock.AcquireWriterLock(); try @@ -396,7 +396,7 @@ virtual public IAppender RemoveAppender(string name) /// The name of this logger /// /// - virtual public string Name + public virtual string Name { get { return m_name; } } @@ -418,7 +418,7 @@ virtual public string Name /// This method must not throw any exception to the caller. /// /// - virtual public void Log(Type callerStackBoundaryDeclaringType, Level level, object message, Exception exception) + public virtual void Log(Type callerStackBoundaryDeclaringType, Level level, object message, Exception exception) { try { @@ -452,7 +452,7 @@ virtual public void Log(Type callerStackBoundaryDeclaringType, Level level, obje /// This method must not throw any exception to the caller. /// /// - virtual public void Log(LoggingEvent logEvent) + public virtual void Log(LoggingEvent logEvent) { try { @@ -491,7 +491,7 @@ virtual public void Log(LoggingEvent logEvent) /// This method must not throw any exception to the caller. /// /// - virtual public bool IsEnabledFor(Level level) + public virtual bool IsEnabledFor(Level level) { try { @@ -553,7 +553,7 @@ public ILoggerRepository Repository /// to log the particular log request. /// /// - virtual protected void CallAppenders(LoggingEvent loggingEvent) + protected virtual void CallAppenders(LoggingEvent loggingEvent) { if (loggingEvent == null) { @@ -625,7 +625,7 @@ virtual protected void CallAppenders(LoggingEvent loggingEvent) /// Used to ensure that the appenders are correctly shutdown. /// /// - virtual public void CloseNestedAppenders() + public virtual void CloseNestedAppenders() { m_appenderLock.AcquireWriterLock(); try @@ -660,7 +660,7 @@ virtual public void CloseNestedAppenders() /// the . /// /// - virtual public void Log(Level level, object message, Exception exception) + public virtual void Log(Level level, object message, Exception exception) { if (IsEnabledFor(level)) { @@ -682,7 +682,7 @@ virtual public void Log(Level level, object message, Exception exception) /// appenders. /// /// - virtual protected void ForcedLog(Type callerStackBoundaryDeclaringType, Level level, object message, Exception exception) + protected virtual void ForcedLog(Type callerStackBoundaryDeclaringType, Level level, object message, Exception exception) { CallAppenders(new LoggingEvent(callerStackBoundaryDeclaringType, this.Hierarchy, this.Name, level, message, exception)); } @@ -696,7 +696,7 @@ virtual protected void ForcedLog(Type callerStackBoundaryDeclaringType, Level le /// Delivers the logging event to the attached appenders. /// /// - virtual protected void ForcedLog(LoggingEvent logEvent) + protected virtual void ForcedLog(LoggingEvent logEvent) { // The logging event may not have been created by this logger // the Repository may not be correctly set on the event. This @@ -711,7 +711,7 @@ virtual protected void ForcedLog(LoggingEvent logEvent) /// /// The fully qualified type of the Logger class. /// - private readonly static Type declaringType = typeof(Logger); + private static readonly Type declaringType = typeof(Logger); #endregion Private Static Fields diff --git a/src/log4net/Repository/Hierarchy/LoggerKey.cs b/src/log4net/Repository/Hierarchy/LoggerKey.cs index ccc566b1..14854172 100644 --- a/src/log4net/Repository/Hierarchy/LoggerKey.cs +++ b/src/log4net/Repository/Hierarchy/LoggerKey.cs @@ -86,7 +86,7 @@ internal LoggerKey(string name) /// Returns the cached hashcode. /// /// - override public int GetHashCode() + public override int GetHashCode() { return m_hashCache; } @@ -104,7 +104,7 @@ override public int GetHashCode() /// Compares the references of the interned strings. /// /// - override public bool Equals(object obj) + public override bool Equals(object obj) { // Compare reference type of this against argument if (((object)this) == obj) diff --git a/src/log4net/Repository/Hierarchy/RootLogger.cs b/src/log4net/Repository/Hierarchy/RootLogger.cs index e178bb71..8184e3f0 100644 --- a/src/log4net/Repository/Hierarchy/RootLogger.cs +++ b/src/log4net/Repository/Hierarchy/RootLogger.cs @@ -79,7 +79,7 @@ public RootLogger(Level level) : base("root") /// value of . /// /// - override public Level EffectiveLevel + public override Level EffectiveLevel { get { @@ -99,7 +99,7 @@ override public Level EffectiveLevel /// may have catastrophic results. We prevent this here. /// /// - override public Level Level + public override Level Level { get { return base.Level; } set @@ -126,7 +126,7 @@ override public Level Level /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(RootLogger); + private static readonly Type declaringType = typeof(RootLogger); #endregion Private Static Fields } diff --git a/src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs b/src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs index d2e53eee..bc2561d5 100644 --- a/src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs +++ b/src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs @@ -1156,7 +1156,7 @@ private IDictionary CreateCaseInsensitiveWrapper(IDictionary dict) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(XmlHierarchyConfigurator); + private static readonly Type declaringType = typeof(XmlHierarchyConfigurator); #endregion Private Static Fields } diff --git a/src/log4net/Repository/LoggerRepositorySkeleton.cs b/src/log4net/Repository/LoggerRepositorySkeleton.cs index e4f06f85..9a2a69c1 100644 --- a/src/log4net/Repository/LoggerRepositorySkeleton.cs +++ b/src/log4net/Repository/LoggerRepositorySkeleton.cs @@ -114,7 +114,7 @@ protected LoggerRepositorySkeleton(PropertiesDictionary properties) /// stored by the . /// /// - virtual public string Name + public virtual string Name { get { return m_name; } set { m_name = value; } @@ -131,7 +131,7 @@ virtual public string Name /// The threshold for all events in this repository /// /// - virtual public Level Threshold + public virtual Level Threshold { get { return m_threshold; } set @@ -164,7 +164,7 @@ virtual public Level Threshold /// objects. /// /// - virtual public RendererMap RendererMap + public virtual RendererMap RendererMap { get { return m_rendererMap; } } @@ -181,7 +181,7 @@ virtual public RendererMap RendererMap /// that have been attached to this repository. /// /// - virtual public PluginMap PluginMap + public virtual PluginMap PluginMap { get { return m_pluginMap; } } @@ -199,7 +199,7 @@ virtual public PluginMap PluginMap /// this repository. /// /// - virtual public LevelMap LevelMap + public virtual LevelMap LevelMap { get { return m_levelMap; } } @@ -215,7 +215,7 @@ virtual public LevelMap LevelMap /// its reference, otherwise returns null. /// /// - abstract public ILogger Exists(string name); + public abstract ILogger Exists(string name); /// /// Returns all the currently defined loggers in the repository @@ -226,7 +226,7 @@ virtual public LevelMap LevelMap /// Returns all the currently defined loggers in the repository as an Array. /// /// - abstract public ILogger[] GetCurrentLoggers(); + public abstract ILogger[] GetCurrentLoggers(); /// /// Return a new logger instance @@ -243,7 +243,7 @@ virtual public LevelMap LevelMap /// then linked with its existing ancestors as well as children. /// /// - abstract public ILogger GetLogger(string name); + public abstract ILogger GetLogger(string name); /// /// Shutdown the repository @@ -255,7 +255,7 @@ virtual public LevelMap LevelMap /// listeners and all attached plugins of the shutdown event. /// /// - virtual public void Shutdown() + public virtual void Shutdown() { // Shutdown attached plugins foreach(IPlugin plugin in PluginMap.AllPlugins) @@ -283,7 +283,7 @@ virtual public void Shutdown() /// block all logging until it is completed. /// /// - virtual public void ResetConfiguration() + public virtual void ResetConfiguration() { // Clear internal data structures m_rendererMap.Clear(); @@ -315,7 +315,7 @@ virtual public void ResetConfiguration() /// that logger is then responsible for logging the event. /// /// - abstract public void Log(LoggingEvent logEvent); + public abstract void Log(LoggingEvent logEvent); /// /// Flag indicates if this repository has been configured. @@ -328,7 +328,7 @@ virtual public void ResetConfiguration() /// Flag indicates if this repository has been configured. /// /// - virtual public bool Configured + public virtual bool Configured { get { return m_configured; } set { m_configured = value; } @@ -338,7 +338,7 @@ virtual public bool Configured /// Contains a list of internal messages captures during the /// last configuration. /// - virtual public ICollection ConfigurationMessages + public virtual ICollection ConfigurationMessages { get { return m_configurationMessages; } set { m_configurationMessages = value; } @@ -419,7 +419,7 @@ public PropertiesDictionary Properties /// Returns all the Appenders that are configured as an Array. /// /// - abstract public log4net.Appender.IAppender[] GetAppenders(); + public abstract log4net.Appender.IAppender[] GetAppenders(); #endregion @@ -432,7 +432,7 @@ public PropertiesDictionary Properties /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(LoggerRepositorySkeleton); + private static readonly Type declaringType = typeof(LoggerRepositorySkeleton); #endregion Private Static Fields @@ -477,7 +477,7 @@ private void AddBuiltinLevels() /// Adds an object renderer for a specific class. /// /// - virtual public void AddRenderer(Type typeToRender, IObjectRenderer rendererInstance) + public virtual void AddRenderer(Type typeToRender, IObjectRenderer rendererInstance) { if (typeToRender == null) { diff --git a/src/log4net/ThreadContext.cs b/src/log4net/ThreadContext.cs index 9d668f7f..4da972ca 100644 --- a/src/log4net/ThreadContext.cs +++ b/src/log4net/ThreadContext.cs @@ -127,12 +127,12 @@ public static ThreadContextStacks Stacks /// /// The thread context properties instance /// - private readonly static ThreadContextProperties s_properties = new ThreadContextProperties(); + private static readonly ThreadContextProperties s_properties = new ThreadContextProperties(); /// /// The thread context stacks instance /// - private readonly static ThreadContextStacks s_stacks = new ThreadContextStacks(s_properties); + private static readonly ThreadContextStacks s_stacks = new ThreadContextStacks(s_properties); #endregion Private Static Fields } diff --git a/src/log4net/Util/AppenderAttachedImpl.cs b/src/log4net/Util/AppenderAttachedImpl.cs index fafb0b8f..35080487 100644 --- a/src/log4net/Util/AppenderAttachedImpl.cs +++ b/src/log4net/Util/AppenderAttachedImpl.cs @@ -369,7 +369,7 @@ public IAppender RemoveAppender(string name) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(AppenderAttachedImpl); + private static readonly Type declaringType = typeof(AppenderAttachedImpl); #endregion Private Static Fields } diff --git a/src/log4net/Util/CountingQuietTextWriter.cs b/src/log4net/Util/CountingQuietTextWriter.cs index aa2947ab..e0c2925b 100644 --- a/src/log4net/Util/CountingQuietTextWriter.cs +++ b/src/log4net/Util/CountingQuietTextWriter.cs @@ -126,7 +126,7 @@ public override void Write(char[] buffer, int index, int count) /// the number of bytes written. /// /// - override public void Write(string str) + public override void Write(string str) { if (str != null && str.Length > 0) { diff --git a/src/log4net/Util/EmptyCollection.cs b/src/log4net/Util/EmptyCollection.cs index ad5f1d87..12225877 100644 --- a/src/log4net/Util/EmptyCollection.cs +++ b/src/log4net/Util/EmptyCollection.cs @@ -171,7 +171,7 @@ public IEnumerator GetEnumerator() /// /// The singleton instance of the empty collection. /// - private readonly static EmptyCollection s_instance = new EmptyCollection(); + private static readonly EmptyCollection s_instance = new EmptyCollection(); #endregion Private Static Fields } diff --git a/src/log4net/Util/EmptyDictionary.cs b/src/log4net/Util/EmptyDictionary.cs index 2c9192da..792a781c 100644 --- a/src/log4net/Util/EmptyDictionary.cs +++ b/src/log4net/Util/EmptyDictionary.cs @@ -332,7 +332,7 @@ public object this[object key] /// /// The singleton instance of the empty dictionary. /// - private readonly static EmptyDictionary s_instance = new EmptyDictionary(); + private static readonly EmptyDictionary s_instance = new EmptyDictionary(); #endregion Private Static Fields } diff --git a/src/log4net/Util/GlobalContextProperties.cs b/src/log4net/Util/GlobalContextProperties.cs index b6431077..0c199959 100644 --- a/src/log4net/Util/GlobalContextProperties.cs +++ b/src/log4net/Util/GlobalContextProperties.cs @@ -93,7 +93,7 @@ internal GlobalContextProperties() /// the properties is created. /// /// - override public object this[string key] + public override object this[string key] { get { diff --git a/src/log4net/Util/ILogExtensions.cs b/src/log4net/Util/ILogExtensions.cs index 9aa6a612..fa52c28e 100644 --- a/src/log4net/Util/ILogExtensions.cs +++ b/src/log4net/Util/ILogExtensions.cs @@ -53,7 +53,7 @@ public static class ILogExtensions /// /// The fully qualified type of the Logger class. /// - private readonly static Type declaringType = typeof(ILogExtensions); + private static readonly Type declaringType = typeof(ILogExtensions); #endregion //Private Static Fields diff --git a/src/log4net/Util/LevelMappingEntry.cs b/src/log4net/Util/LevelMappingEntry.cs index bfed35b9..1a3975be 100644 --- a/src/log4net/Util/LevelMappingEntry.cs +++ b/src/log4net/Util/LevelMappingEntry.cs @@ -84,7 +84,7 @@ public Level Level /// Should be overridden by any classes that need to initialise based on their options /// /// - virtual public void ActivateOptions() + public virtual void ActivateOptions() { // default implementation is to do nothing } diff --git a/src/log4net/Util/LogicalThreadContextProperties.cs b/src/log4net/Util/LogicalThreadContextProperties.cs index 519efe43..179c22b8 100644 --- a/src/log4net/Util/LogicalThreadContextProperties.cs +++ b/src/log4net/Util/LogicalThreadContextProperties.cs @@ -99,7 +99,7 @@ internal LogicalThreadContextProperties() /// Get or set the property value for the specified. /// /// - override public object this[string key] + public override object this[string key] { get { @@ -273,7 +273,7 @@ private static void SetLogicalProperties(PropertiesDictionary properties) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(LogicalThreadContextProperties); + private static readonly Type declaringType = typeof(LogicalThreadContextProperties); #endregion Private Static Fields } diff --git a/src/log4net/Util/LogicalThreadContextStacks.cs b/src/log4net/Util/LogicalThreadContextStacks.cs index 3eccfca2..7d4a2253 100644 --- a/src/log4net/Util/LogicalThreadContextStacks.cs +++ b/src/log4net/Util/LogicalThreadContextStacks.cs @@ -133,7 +133,7 @@ private void registerNew(string stackName, LogicalThreadContextStack stack) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(LogicalThreadContextStacks); + private static readonly Type declaringType = typeof(LogicalThreadContextStacks); #endregion Private Static Fields } diff --git a/src/log4net/Util/NullDictionaryEnumerator.cs b/src/log4net/Util/NullDictionaryEnumerator.cs index e4564c8a..48af424e 100644 --- a/src/log4net/Util/NullDictionaryEnumerator.cs +++ b/src/log4net/Util/NullDictionaryEnumerator.cs @@ -195,7 +195,7 @@ public DictionaryEntry Entry /// /// The singleton instance of the . /// - private readonly static NullDictionaryEnumerator s_instance = new NullDictionaryEnumerator(); + private static readonly NullDictionaryEnumerator s_instance = new NullDictionaryEnumerator(); #endregion Private Static Fields } diff --git a/src/log4net/Util/NullEnumerator.cs b/src/log4net/Util/NullEnumerator.cs index 614d616b..4cb78060 100644 --- a/src/log4net/Util/NullEnumerator.cs +++ b/src/log4net/Util/NullEnumerator.cs @@ -127,7 +127,7 @@ public void Reset() /// /// The singleton instance of the . /// - private readonly static NullEnumerator s_instance = new NullEnumerator(); + private static readonly NullEnumerator s_instance = new NullEnumerator(); #endregion Private Static Fields } diff --git a/src/log4net/Util/OnlyOnceErrorHandler.cs b/src/log4net/Util/OnlyOnceErrorHandler.cs index 80629629..5f03d929 100644 --- a/src/log4net/Util/OnlyOnceErrorHandler.cs +++ b/src/log4net/Util/OnlyOnceErrorHandler.cs @@ -276,7 +276,7 @@ public ErrorCode ErrorCode /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(OnlyOnceErrorHandler); + private static readonly Type declaringType = typeof(OnlyOnceErrorHandler); #endregion } diff --git a/src/log4net/Util/OptionConverter.cs b/src/log4net/Util/OptionConverter.cs index c304f18e..776bcc25 100644 --- a/src/log4net/Util/OptionConverter.cs +++ b/src/log4net/Util/OptionConverter.cs @@ -659,7 +659,7 @@ private static object ParseEnum(System.Type enumType, string value, bool ignoreC /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(OptionConverter); + private static readonly Type declaringType = typeof(OptionConverter); private const string DELIM_START = "${"; private const char DELIM_STOP = '}'; diff --git a/src/log4net/Util/PatternConverter.cs b/src/log4net/Util/PatternConverter.cs index 7b333957..9f9067b1 100644 --- a/src/log4net/Util/PatternConverter.cs +++ b/src/log4net/Util/PatternConverter.cs @@ -129,7 +129,7 @@ public virtual string Option /// convert conversion specifiers in the appropriate way. /// /// - abstract protected void Convert(TextWriter writer, object state); + protected abstract void Convert(TextWriter writer, object state); #endregion Protected Abstract Methods @@ -165,7 +165,7 @@ public virtual PatternConverter SetNext(PatternConverter patternConverter) /// apply those formattings before writing the output. /// /// - virtual public void Format(TextWriter writer, object state) + public virtual void Format(TextWriter writer, object state) { if (m_min < 0 && m_max == int.MaxValue) { diff --git a/src/log4net/Util/PatternParser.cs b/src/log4net/Util/PatternParser.cs index bfe44526..7dfbb326 100644 --- a/src/log4net/Util/PatternParser.cs +++ b/src/log4net/Util/PatternParser.cs @@ -428,7 +428,7 @@ private void AddConverter(PatternConverter pc) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(PatternParser); + private static readonly Type declaringType = typeof(PatternParser); #endregion Private Static Fields } diff --git a/src/log4net/Util/PatternString.cs b/src/log4net/Util/PatternString.cs index 72d9ba92..c7d924b9 100644 --- a/src/log4net/Util/PatternString.cs +++ b/src/log4net/Util/PatternString.cs @@ -390,7 +390,7 @@ public string ConversionPattern /// must be called again. /// /// - virtual public void ActivateOptions() + public virtual void ActivateOptions() { m_head = CreatePatternParser(m_pattern).Parse(); } diff --git a/src/log4net/Util/PatternStringConverters/AppDomainPatternConverter.cs b/src/log4net/Util/PatternStringConverters/AppDomainPatternConverter.cs index 9b110022..9a20d652 100644 --- a/src/log4net/Util/PatternStringConverters/AppDomainPatternConverter.cs +++ b/src/log4net/Util/PatternStringConverters/AppDomainPatternConverter.cs @@ -46,7 +46,7 @@ internal sealed class AppDomainPatternConverter : PatternConverter /// Writes name of the current AppDomain to the output . /// /// - override protected void Convert(TextWriter writer, object state) + protected override void Convert(TextWriter writer, object state) { writer.Write( SystemInfo.ApplicationFriendlyName ); } diff --git a/src/log4net/Util/PatternStringConverters/AppSettingPatternConverter.cs b/src/log4net/Util/PatternStringConverters/AppSettingPatternConverter.cs index dad04c6e..75d5fb02 100644 --- a/src/log4net/Util/PatternStringConverters/AppSettingPatternConverter.cs +++ b/src/log4net/Util/PatternStringConverters/AppSettingPatternConverter.cs @@ -89,7 +89,7 @@ private static IDictionary AppSettingsDictionary /// then all the properties are written as key value pairs. /// /// - override protected void Convert(TextWriter writer, object state) + protected override void Convert(TextWriter writer, object state) { if (Option != null) diff --git a/src/log4net/Util/PatternStringConverters/DatePatternConverter.cs b/src/log4net/Util/PatternStringConverters/DatePatternConverter.cs index 6def66f2..40ffd779 100644 --- a/src/log4net/Util/PatternStringConverters/DatePatternConverter.cs +++ b/src/log4net/Util/PatternStringConverters/DatePatternConverter.cs @@ -161,7 +161,7 @@ public void ActivateOptions() /// The date and time passed is in the local time zone. /// /// - override protected void Convert(TextWriter writer, object state) + protected override void Convert(TextWriter writer, object state) { try { @@ -182,7 +182,7 @@ override protected void Convert(TextWriter writer, object state) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(DatePatternConverter); + private static readonly Type declaringType = typeof(DatePatternConverter); #endregion Private Static Fields } diff --git a/src/log4net/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs b/src/log4net/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs index 93028a02..bd8d4b59 100644 --- a/src/log4net/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs +++ b/src/log4net/Util/PatternStringConverters/EnvironmentFolderPathPatternConverter.cs @@ -51,7 +51,7 @@ internal sealed class EnvironmentFolderPathPatternConverter : PatternConverter /// property. /// /// - override protected void Convert(TextWriter writer, object state) + protected override void Convert(TextWriter writer, object state) { try { @@ -89,7 +89,7 @@ override protected void Convert(TextWriter writer, object state) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(EnvironmentFolderPathPatternConverter); + private static readonly Type declaringType = typeof(EnvironmentFolderPathPatternConverter); #endregion Private Static Fields } diff --git a/src/log4net/Util/PatternStringConverters/EnvironmentPatternConverter.cs b/src/log4net/Util/PatternStringConverters/EnvironmentPatternConverter.cs index 7361f992..70851298 100644 --- a/src/log4net/Util/PatternStringConverters/EnvironmentPatternConverter.cs +++ b/src/log4net/Util/PatternStringConverters/EnvironmentPatternConverter.cs @@ -51,7 +51,7 @@ internal sealed class EnvironmentPatternConverter : PatternConverter /// property. /// /// - override protected void Convert(TextWriter writer, object state) + protected override void Convert(TextWriter writer, object state) { try { @@ -102,7 +102,7 @@ override protected void Convert(TextWriter writer, object state) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(EnvironmentPatternConverter); + private static readonly Type declaringType = typeof(EnvironmentPatternConverter); #endregion Private Static Fields } diff --git a/src/log4net/Util/PatternStringConverters/IdentityPatternConverter.cs b/src/log4net/Util/PatternStringConverters/IdentityPatternConverter.cs index d92a292b..f3ee8605 100644 --- a/src/log4net/Util/PatternStringConverters/IdentityPatternConverter.cs +++ b/src/log4net/Util/PatternStringConverters/IdentityPatternConverter.cs @@ -46,7 +46,7 @@ internal sealed class IdentityPatternConverter : PatternConverter /// Writes the current thread identity to the output . /// /// - override protected void Convert(TextWriter writer, object state) + protected override void Convert(TextWriter writer, object state) { #if (NETCF || SSCLI || NETSTANDARD1_3) // On compact framework there's no notion of current thread principals @@ -81,7 +81,7 @@ override protected void Convert(TextWriter writer, object state) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(IdentityPatternConverter); + private static readonly Type declaringType = typeof(IdentityPatternConverter); #endregion Private Static Fields } diff --git a/src/log4net/Util/PatternStringConverters/LiteralPatternConverter.cs b/src/log4net/Util/PatternStringConverters/LiteralPatternConverter.cs index b40925a0..3f3e2420 100644 --- a/src/log4net/Util/PatternStringConverters/LiteralPatternConverter.cs +++ b/src/log4net/Util/PatternStringConverters/LiteralPatternConverter.cs @@ -84,7 +84,7 @@ public override PatternConverter SetNext(PatternConverter pc) /// to the output . /// /// - override public void Format(TextWriter writer, object state) + public override void Format(TextWriter writer, object state) { writer.Write(Option); } @@ -99,7 +99,7 @@ override public void Format(TextWriter writer, object state) /// This method is not used. /// /// - override protected void Convert(TextWriter writer, object state) + protected override void Convert(TextWriter writer, object state) { throw new InvalidOperationException("Should never get here because of the overridden Format method"); } diff --git a/src/log4net/Util/PatternStringConverters/ProcessIdPatternConverter.cs b/src/log4net/Util/PatternStringConverters/ProcessIdPatternConverter.cs index 2dfd0cbc..fbb796d8 100644 --- a/src/log4net/Util/PatternStringConverters/ProcessIdPatternConverter.cs +++ b/src/log4net/Util/PatternStringConverters/ProcessIdPatternConverter.cs @@ -46,7 +46,7 @@ internal sealed class ProcessIdPatternConverter : PatternConverter #if NET_4_0 || MONO_4_0 || NETSTANDARD [System.Security.SecuritySafeCritical] #endif - override protected void Convert(TextWriter writer, object state) + protected override void Convert(TextWriter writer, object state) { #if (NETCF || SSCLI) // On compact framework there is no System.Diagnostics.Process class @@ -76,7 +76,7 @@ override protected void Convert(TextWriter writer, object state) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(ProcessIdPatternConverter); + private static readonly Type declaringType = typeof(ProcessIdPatternConverter); #endregion Private Static Fields } diff --git a/src/log4net/Util/PatternStringConverters/PropertyPatternConverter.cs b/src/log4net/Util/PatternStringConverters/PropertyPatternConverter.cs index e78611b0..bf81f2aa 100644 --- a/src/log4net/Util/PatternStringConverters/PropertyPatternConverter.cs +++ b/src/log4net/Util/PatternStringConverters/PropertyPatternConverter.cs @@ -57,7 +57,7 @@ internal sealed class PropertyPatternConverter : PatternConverter /// then all the properties are written as key value pairs. /// /// - override protected void Convert(TextWriter writer, object state) + protected override void Convert(TextWriter writer, object state) { CompositeProperties compositeProperties = new CompositeProperties(); diff --git a/src/log4net/Util/PatternStringConverters/RandomStringPatternConverter.cs b/src/log4net/Util/PatternStringConverters/RandomStringPatternConverter.cs index dc11de95..015cfd7f 100644 --- a/src/log4net/Util/PatternStringConverters/RandomStringPatternConverter.cs +++ b/src/log4net/Util/PatternStringConverters/RandomStringPatternConverter.cs @@ -104,7 +104,7 @@ public void ActivateOptions() /// Write a randoim string to the output . /// /// - override protected void Convert(TextWriter writer, object state) + protected override void Convert(TextWriter writer, object state) { try { @@ -149,7 +149,7 @@ override protected void Convert(TextWriter writer, object state) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(RandomStringPatternConverter); + private static readonly Type declaringType = typeof(RandomStringPatternConverter); #endregion Private Static Fields } diff --git a/src/log4net/Util/PatternStringConverters/UserNamePatternConverter.cs b/src/log4net/Util/PatternStringConverters/UserNamePatternConverter.cs index 68aad1a9..9cc69fd9 100644 --- a/src/log4net/Util/PatternStringConverters/UserNamePatternConverter.cs +++ b/src/log4net/Util/PatternStringConverters/UserNamePatternConverter.cs @@ -43,7 +43,7 @@ internal sealed class UserNamePatternConverter : PatternConverter /// Write the current threads username to the output . /// /// - override protected void Convert(TextWriter writer, object state) + protected override void Convert(TextWriter writer, object state) { #if (NETCF || SSCLI || NETSTANDARD1_3) // On compact framework there's no notion of current Windows user @@ -78,7 +78,7 @@ override protected void Convert(TextWriter writer, object state) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(UserNamePatternConverter); + private static readonly Type declaringType = typeof(UserNamePatternConverter); #endregion Private Static Fields } diff --git a/src/log4net/Util/PatternStringConverters/UtcDatePatternConverter.cs b/src/log4net/Util/PatternStringConverters/UtcDatePatternConverter.cs index a2bf590d..31d5f7f1 100644 --- a/src/log4net/Util/PatternStringConverters/UtcDatePatternConverter.cs +++ b/src/log4net/Util/PatternStringConverters/UtcDatePatternConverter.cs @@ -58,7 +58,7 @@ internal class UtcDatePatternConverter : DatePatternConverter /// /// /// - override protected void Convert(TextWriter writer, object state) + protected override void Convert(TextWriter writer, object state) { try { @@ -79,7 +79,7 @@ override protected void Convert(TextWriter writer, object state) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(UtcDatePatternConverter); + private static readonly Type declaringType = typeof(UtcDatePatternConverter); #endregion Private Static Fields } diff --git a/src/log4net/Util/PropertiesDictionary.cs b/src/log4net/Util/PropertiesDictionary.cs index a4dc6c46..e70fb203 100644 --- a/src/log4net/Util/PropertiesDictionary.cs +++ b/src/log4net/Util/PropertiesDictionary.cs @@ -108,7 +108,7 @@ private PropertiesDictionary(SerializationInfo info, StreamingContext context) : /// a serialization operation is performed. /// /// - override public object this[string key] + public override object this[string key] { get { return InnerHashtable[key]; } set { InnerHashtable[key] = value; } diff --git a/src/log4net/Util/ProtectCloseTextWriter.cs b/src/log4net/Util/ProtectCloseTextWriter.cs index cd610e2e..a90f283f 100644 --- a/src/log4net/Util/ProtectCloseTextWriter.cs +++ b/src/log4net/Util/ProtectCloseTextWriter.cs @@ -83,7 +83,7 @@ public void Attach(TextWriter writer) /// This method does nothing. /// /// - override public void Close() + public override void Close() { // do nothing } diff --git a/src/log4net/Util/QuietTextWriter.cs b/src/log4net/Util/QuietTextWriter.cs index 81629b79..6f3c757b 100644 --- a/src/log4net/Util/QuietTextWriter.cs +++ b/src/log4net/Util/QuietTextWriter.cs @@ -160,7 +160,7 @@ public override void Write(char[] buffer, int index, int count) /// Writes a string to the output. /// /// - override public void Write(string value) + public override void Write(string value) { try { @@ -180,7 +180,7 @@ override public void Write(string value) /// Closes the underlying output writer. /// /// - override public void Close() + public override void Close() { m_closed = true; base.Close(); diff --git a/src/log4net/Util/SystemInfo.cs b/src/log4net/Util/SystemInfo.cs index 051c1b20..92e2c60c 100644 --- a/src/log4net/Util/SystemInfo.cs +++ b/src/log4net/Util/SystemInfo.cs @@ -1176,7 +1176,7 @@ private static extern Int32 GetModuleFileName( /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(SystemInfo); + private static readonly Type declaringType = typeof(SystemInfo); /// /// Cache the host name for the current machine diff --git a/src/log4net/Util/SystemStringFormat.cs b/src/log4net/Util/SystemStringFormat.cs index 21860bda..cd71c03b 100644 --- a/src/log4net/Util/SystemStringFormat.cs +++ b/src/log4net/Util/SystemStringFormat.cs @@ -230,7 +230,7 @@ private static void RenderObject(Object obj, StringBuilder buffer) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(SystemStringFormat); + private static readonly Type declaringType = typeof(SystemStringFormat); #endregion Private Static Fields } diff --git a/src/log4net/Util/TextWriterAdapter.cs b/src/log4net/Util/TextWriterAdapter.cs index e098dad6..851eac48 100644 --- a/src/log4net/Util/TextWriterAdapter.cs +++ b/src/log4net/Util/TextWriterAdapter.cs @@ -100,7 +100,7 @@ protected TextWriter Writer /// The Encoding in which the output is written /// /// - override public Encoding Encoding + public override Encoding Encoding { get { return m_writer.Encoding; } } @@ -116,7 +116,7 @@ override public Encoding Encoding /// Gets an object that controls formatting /// /// - override public IFormatProvider FormatProvider + public override IFormatProvider FormatProvider { get { return m_writer.FormatProvider; } } @@ -132,7 +132,7 @@ override public IFormatProvider FormatProvider /// Gets or sets the line terminator string used by the TextWriter /// /// - override public String NewLine + public override String NewLine { get { return m_writer.NewLine; } set { m_writer.NewLine = value; } @@ -168,7 +168,7 @@ public void Close() /// Dispose this writer /// /// - override protected void Dispose(bool disposing) + protected override void Dispose(bool disposing) { if (disposing) { @@ -185,7 +185,7 @@ override protected void Dispose(bool disposing) /// to the underlying device /// /// - override public void Flush() + public override void Flush() { m_writer.Flush(); } @@ -199,7 +199,7 @@ override public void Flush() /// Writes a character to the wrapped TextWriter /// /// - override public void Write(char value) + public override void Write(char value) { m_writer.Write(value); } @@ -215,7 +215,7 @@ override public void Write(char value) /// Writes a character buffer to the wrapped TextWriter /// /// - override public void Write(char[] buffer, int index, int count) + public override void Write(char[] buffer, int index, int count) { m_writer.Write(buffer, index, count); } @@ -229,7 +229,7 @@ override public void Write(char[] buffer, int index, int count) /// Writes a string to the wrapped TextWriter /// /// - override public void Write(String value) + public override void Write(String value) { m_writer.Write(value); } diff --git a/src/log4net/Util/ThreadContextProperties.cs b/src/log4net/Util/ThreadContextProperties.cs index 17060852..e002c1be 100644 --- a/src/log4net/Util/ThreadContextProperties.cs +++ b/src/log4net/Util/ThreadContextProperties.cs @@ -82,7 +82,7 @@ internal ThreadContextProperties() /// Gets or sets the value of a property /// /// - override public object this[string key] + public override object this[string key] { get { diff --git a/src/log4net/Util/ThreadContextStacks.cs b/src/log4net/Util/ThreadContextStacks.cs index 3fffb05a..0e9c1980 100644 --- a/src/log4net/Util/ThreadContextStacks.cs +++ b/src/log4net/Util/ThreadContextStacks.cs @@ -116,7 +116,7 @@ public ThreadContextStack this[string key] /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(ThreadContextStacks); + private static readonly Type declaringType = typeof(ThreadContextStacks); #endregion Private Static Fields } diff --git a/src/log4net/Util/TypeConverters/ConverterRegistry.cs b/src/log4net/Util/TypeConverters/ConverterRegistry.cs index 597ae9fd..e20bbd52 100644 --- a/src/log4net/Util/TypeConverters/ConverterRegistry.cs +++ b/src/log4net/Util/TypeConverters/ConverterRegistry.cs @@ -292,7 +292,7 @@ private static object CreateConverterInstance(Type converterType) /// Used by the internal logger to record the Type of the /// log message. /// - private readonly static Type declaringType = typeof(ConverterRegistry); + private static readonly Type declaringType = typeof(ConverterRegistry); /// /// Mapping from to type converter. diff --git a/src/log4net/Util/WindowsSecurityContext.cs b/src/log4net/Util/WindowsSecurityContext.cs index de98511e..6fac8ccb 100644 --- a/src/log4net/Util/WindowsSecurityContext.cs +++ b/src/log4net/Util/WindowsSecurityContext.cs @@ -327,10 +327,10 @@ private static WindowsIdentity LogonUser(string userName, string domainName, str private static extern bool LogonUser(String lpszUsername, String lpszDomain, String lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken); [DllImport("kernel32.dll", CharSet=CharSet.Auto)] - private extern static bool CloseHandle(IntPtr handle); + private static extern bool CloseHandle(IntPtr handle); [DllImport("advapi32.dll", CharSet=CharSet.Auto, SetLastError=true)] - private extern static bool DuplicateToken(IntPtr ExistingTokenHandle, int SECURITY_IMPERSONATION_LEVEL, ref IntPtr DuplicateTokenHandle); + private static extern bool DuplicateToken(IntPtr ExistingTokenHandle, int SECURITY_IMPERSONATION_LEVEL, ref IntPtr DuplicateTokenHandle); #endregion diff --git a/src/log4net/log4net.csproj b/src/log4net/log4net.csproj index 5b899916..263ed650 100644 --- a/src/log4net/log4net.csproj +++ b/src/log4net/log4net.csproj @@ -1,7 +1,7 @@  log4net - 2.0.11 + 2.0.12 Codestin Search App Apache log4net @@ -21,10 +21,16 @@ git https://github.com/apache/logging-log4net false + AnyCPU - + net20;net35;net35-client;net40;net40-client;net45;netstandard1.3;netstandard2.0 - Debug;Release + + + net40;net45;netstandard1.3;netstandard2.0 + + + Debug;Release;CrossPlatform latest log4net log4net @@ -184,5 +190,12 @@ package-icon.png + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/src/site/resources/doap_log4net.rdf b/src/site/resources/doap_log4net.rdf index 7f38fdf6..acdb9695 100644 --- a/src/site/resources/doap_log4net.rdf +++ b/src/site/resources/doap_log4net.rdf @@ -110,5 +110,19 @@ 2.0.8 + + + Apache log4net 2.0.9 + 2019-08-25 + 2.0.9 + + + + + Apache log4net 2.0.10 + 2019-09.12 + 2.0.10 + + diff --git a/src/site/xdoc/download_log4net.xml b/src/site/xdoc/download_log4net.xml index 71c6679f..a669bda9 100644 --- a/src/site/xdoc/download_log4net.xml +++ b/src/site/xdoc/download_log4net.xml @@ -36,14 +36,14 @@ limitations under the License. -
+
- - - + + +
apache-log4net-source-2.0.11.zipsha512pgpapache-log4net-source-2.0.12.zipsha512pgp
@@ -52,14 +52,14 @@ limitations under the License.

Binaries are available in a zip file or nupkg, which is also available from nuget.org

- - - + + + - - - + + +
log4net-binaries-2.0.11.zipsha512pgplog4net-binaries-2.0.12.zipsha512pgp
log4net-2.0.11.nupkgsha512pgplog4net-2.0.12.nupkgsha512pgp
diff --git a/src/site/xdoc/release/release-notes.xml b/src/site/xdoc/release/release-notes.xml index fac995ae..f6e28e4d 100644 --- a/src/site/xdoc/release/release-notes.xml +++ b/src/site/xdoc/release/release-notes.xml @@ -27,8 +27,26 @@ limitations under the License.
+
+

+ Apache log4net 2.0.12 is a minor fix release to address reported issues on + non-windows platforms. +

+
+
    +
  • Addresses the issues reported in + [LOG4NET-652] + and [LOG4NET-653] whereby + logging could throw a PlatformNotSupported exception when the username + is required within logs on non-Windows platforms. The implemented + behavior is to fall back, where possible, on Environment.UserName + or provide text that the facility is not supported. +
  • +
+
+
- Apachhe log4net 2.0.11 fixes incorrect version strings within the released + Apache log4net 2.0.11 fixes incorrect version strings within the released binaries and contains some minor fixes to correctly dispose of StreamWriters used during log flushing, thanks to community member @NicholasNoise