From 1acab70f5450f4bbeef144d0a249a230070bbb4a Mon Sep 17 00:00:00 2001
From: Tsar Nikolay
Date: Tue, 8 Sep 2020 13:49:21 +0500
Subject: [PATCH 001/122] Fix net40 client profile
---
src/log4net/AssemblyInfo.cs | 7 +++++--
src/log4net/Core/LoggingEvent.cs | 2 +-
src/log4net/Util/PropertiesDictionary.cs | 7 ++++---
src/log4net/log4net.csproj | 6 +++---
4 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/log4net/AssemblyInfo.cs b/src/log4net/AssemblyInfo.cs
index aa3c3e638..2e33cb7b5 100644
--- a/src/log4net/AssemblyInfo.cs
+++ b/src/log4net/AssemblyInfo.cs
@@ -73,14 +73,17 @@
[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.NET 4.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 4.0")]
#endif // Client Profile
-#elif (NET_2_0)
+#elif (NET_3_5)
#if CLIENT_PROFILE
[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.NET 3.5 CP")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 3.5 Client Profile")]
#else
+[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.NET 3.5")]
+[assembly: AssemblyTitle("Apache log4net for .NET Framework 3.5")]
+#endif // Client Profile
+#elif (NET_2_0)
[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.NET 2.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 2.0")]
-#endif // Client Profile
#elif (NETCF_1_0)
[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.NETCF 1.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Compact Framework 1.0")]
diff --git a/src/log4net/Core/LoggingEvent.cs b/src/log4net/Core/LoggingEvent.cs
index 1765929c3..0c733006c 100644
--- a/src/log4net/Core/LoggingEvent.cs
+++ b/src/log4net/Core/LoggingEvent.cs
@@ -324,7 +324,7 @@ [Flags] public enum FixFlags
[Serializable]
#endif
public class LoggingEvent
-#if !NETCF && NET_2_0
+#if !NETCF
: ISerializable
#endif
{
diff --git a/src/log4net/Util/PropertiesDictionary.cs b/src/log4net/Util/PropertiesDictionary.cs
index 4510eaa07..a4dc6c46c 100644
--- a/src/log4net/Util/PropertiesDictionary.cs
+++ b/src/log4net/Util/PropertiesDictionary.cs
@@ -35,10 +35,11 @@ namespace log4net.Util
///
/// Nicko Cadell
/// Gert Driesen
-#if NETCF || CLIENT_PROFILE
+#if NETCF
public sealed class PropertiesDictionary : ReadOnlyPropertiesDictionary, IDictionary
#else
- [Serializable] public sealed class PropertiesDictionary : ReadOnlyPropertiesDictionary, ISerializable, IDictionary
+ [Serializable]
+ public sealed class PropertiesDictionary : ReadOnlyPropertiesDictionary, ISerializable, IDictionary
#endif
{
#region Public Instance Constructors
@@ -72,7 +73,7 @@ public PropertiesDictionary(ReadOnlyPropertiesDictionary propertiesDictionary) :
#region Private Instance Constructors
-#if !(NETCF || CLIENT_PROFILE)
+#if !NETCF
///
/// Initializes a new instance of the class
/// with serialized data.
diff --git a/src/log4net/log4net.csproj b/src/log4net/log4net.csproj
index 62b17340b..53c9c3e38 100644
--- a/src/log4net/log4net.csproj
+++ b/src/log4net/log4net.csproj
@@ -69,14 +69,14 @@
v3.5Client..\..\build\$(Configuration)\net35-client
- $(DefineConstants);NET_2_0;CLIENT_PROFILE
+ $(DefineConstants);NET_2_0;NET_3_5;CLIENT_PROFILE.NETFramework
- v3.5
+ v4.0Client..\..\build\$(Configuration)\net40-client
- $(DefineConstants);NET_2_0;CLIENT_PROFILE
+ $(DefineConstants);NET_2_0;NET_4_0;CLIENT_PROFILE$(DefineConstants);NETSTANDARD;NETSTANDARD1_3
From c3a6e32872e1eecbaa9af231f21bb20bf37e2413 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Thu, 10 Sep 2020 09:16:00 +0200
Subject: [PATCH 002/122] :wrench: run dotnet core tests as part of regular
test run
---
package.json | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/package.json b/package.json
index ec8b812ec..7b41e90cf 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,8 @@
"version": "2.0.9",
"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\"",
+ "test": "cross-env NUNIT_PROCESS=Single MAX_CONCURRENCY=1 run-s clean-build \"zarro test-dotnet\" run-dotnet-core-tests",
+ "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\"",
"build-release": "cross-env BUILD_CONFIGURATION=Release run-s clean-build \"zarro build\"",
From acda6883586d56d6788c4bd97aa65148d79f16a1 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Thu, 10 Sep 2020 11:23:28 +0200
Subject: [PATCH 003/122] :arrow_up: upgrade zarro, should resolve npm warnings
about old yargs dependencies
---
package-lock.json | 28 ++++++++++++++++++++--------
package.json | 2 +-
2 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 15bcb2130..68573e0c6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1459,9 +1459,9 @@
}
},
"dot-prop": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.2.0.tgz",
- "integrity": "sha512-uEUyaDKoSQ1M4Oq8l45hSE26SnTxL6snNnqvK/VWx5wJhmff5z0FUVJDKDanor/6w3kzE3i7XZOk+7wC0EXr1A==",
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz",
+ "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==",
"dev": true,
"requires": {
"is-obj": "^2.0.0"
@@ -6204,9 +6204,9 @@
}
},
"zarro": {
- "version": "1.77.0",
- "resolved": "https://registry.npmjs.org/zarro/-/zarro-1.77.0.tgz",
- "integrity": "sha512-qTKIHiZU0okuM7k/qRB13gA7j+9FTQq86qY/PulIgnSC8/QntxlIqzGxFjr/AJFT4JNqMS6LLzYyuMZS9knv1Q==",
+ "version": "1.78.0",
+ "resolved": "https://registry.npmjs.org/zarro/-/zarro-1.78.0.tgz",
+ "integrity": "sha512-lDpbakbZYnh9TtunnkQqANSaY0v7anNSb3MJyYSAC4HlR/ZpG8NdxzrVdPkLEproM110EkLAdilip4tgtQ72Ww==",
"dev": true,
"requires": {
"ansi-colors": "^4.1.1",
@@ -6223,7 +6223,7 @@
"gulp-filter": "^6.0.0",
"gulp-msbuild": "^0.8.0",
"mkdirp": "^1.0.4",
- "nodemon": "^2.0.3",
+ "nodemon": "^2.0.4",
"npm-run-all": "^4.1.5",
"plugin-error": "^1.0.1",
"readline": "^1.3.0",
@@ -6235,11 +6235,23 @@
"sax": "^1.2.4",
"simple-git": "^1.132.0",
"temp": "^0.9.1",
- "through2": "^3.0.1",
+ "through2": "^3.0.2",
"undertaker-forward-reference": "^1.0.2",
"vinyl": "^2.2.0",
"which": "^2.0.2",
"xml2js": "^0.4.23"
+ },
+ "dependencies": {
+ "through2": {
+ "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 7b41e90cf..b4999d831 100644
--- a/package.json
+++ b/package.json
@@ -31,6 +31,6 @@
"rimraf": "^3.0.2",
"which": "^2.0.2",
"yafs": "^1.5.0",
- "zarro": "^1.77.0"
+ "zarro": "^1.78.0"
}
}
From 9b0c79d4a1a894e80146f08ac66ba72357576b69 Mon Sep 17 00:00:00 2001
From: Tsar Nikolay
Date: Mon, 14 Sep 2020 12:28:00 +0500
Subject: [PATCH 004/122] Remove unused dependency for netstandard2.0.
---
src/log4net/log4net.csproj | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/log4net/log4net.csproj b/src/log4net/log4net.csproj
index 62b17340b..95bea2c44 100644
--- a/src/log4net/log4net.csproj
+++ b/src/log4net/log4net.csproj
@@ -153,7 +153,6 @@
-
From 3941383c2fd7840726069b8b4e35b5d7a1fc73f5 Mon Sep 17 00:00:00 2001
From: Tsar Nikolay
Date: Tue, 8 Sep 2020 13:58:44 +0500
Subject: [PATCH 005/122] Fix CA2000, CA2237, CA3075
---
src/log4net/Appender/AdoNetAppender.cs | 2 +-
src/log4net/Appender/FileAppender.cs | 25 +-
src/log4net/Appender/SmtpAppender.cs | 260 +++----
src/log4net/Config/XmlConfigurator.cs | 638 +++++++++---------
src/log4net/Layout/Layout2RawLayoutAdapter.cs | 2 +-
src/log4net/Layout/LayoutSkeleton.cs | 182 ++---
src/log4net/ObjectRenderer/RendererMap.cs | 4 +-
src/log4net/Util/PatternString.cs | 2 +-
8 files changed, 575 insertions(+), 540 deletions(-)
diff --git a/src/log4net/Appender/AdoNetAppender.cs b/src/log4net/Appender/AdoNetAppender.cs
index a509cc176..72a5a7620 100644
--- a/src/log4net/Appender/AdoNetAppender.cs
+++ b/src/log4net/Appender/AdoNetAppender.cs
@@ -617,7 +617,7 @@ virtual protected string GetLogStatement(LoggingEvent logEvent)
}
else
{
- StringWriter writer = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
+ using StringWriter writer = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
Layout.Format(writer, logEvent);
return writer.ToString();
}
diff --git a/src/log4net/Appender/FileAppender.cs b/src/log4net/Appender/FileAppender.cs
index e283f49ef..f0c2bc1f8 100644
--- a/src/log4net/Appender/FileAppender.cs
+++ b/src/log4net/Appender/FileAppender.cs
@@ -19,6 +19,9 @@
using System;
using System.IO;
+#if !NETCF && !NETSTANDARD1_3
+using System.Runtime.Serialization;
+#endif
using System.Text;
using System.Threading;
using log4net.Util;
@@ -138,12 +141,29 @@ public class FileAppender : TextWriterAppender
///
private sealed class LockingStream : Stream, IDisposable
{
+#if !NETCR
+ [Serializable]
+#endif
public sealed class LockStateException : LogException
{
public LockStateException(string message)
: base(message)
{
}
+
+ public LockStateException()
+ {
+ }
+
+ public LockStateException(string message, Exception innerException) : base(message, innerException)
+ {
+ }
+
+#if !NETCR && !NETSTANDARD1_3
+ private LockStateException(SerializationInfo info, StreamingContext context) : base(info, context)
+ {
+ }
+#endif
}
private Stream m_realStream = null;
@@ -1409,7 +1429,10 @@ virtual protected void OpenFile(string fileName, bool append)
///
virtual protected void SetQWForFiles(Stream fileStream)
{
- SetQWForFiles(new StreamWriter(fileStream, m_encoding));
+#pragma warning disable CA2000 // Dispose objects before losing scope
+ StreamWriter writer = new StreamWriter(fileStream, m_encoding);
+#pragma warning restore CA2000 // Dispose objects before losing scope
+ SetQWForFiles(writer);
}
///
diff --git a/src/log4net/Appender/SmtpAppender.cs b/src/log4net/Appender/SmtpAppender.cs
index d19ad90a5..bbe8bd51a 100644
--- a/src/log4net/Appender/SmtpAppender.cs
+++ b/src/log4net/Appender/SmtpAppender.cs
@@ -92,20 +92,20 @@ public SmtpAppender()
/// Gets or sets a comma- or semicolon-delimited list of recipient e-mail addresses (use semicolon on .NET 1.1 and comma for later versions).
///
///
- ///
- /// For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses.
- ///
- ///
- /// For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses.
- ///
+ ///
+ /// For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses.
+ ///
+ ///
+ /// For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses.
+ ///
///
///
- ///
- /// For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses.
- ///
- ///
- /// For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses.
- ///
+ ///
+ /// For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses.
+ ///
+ ///
+ /// For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses.
+ ///
///
public string To
{
@@ -113,49 +113,49 @@ public string To
set { m_to = MaybeTrimSeparators(value); }
}
- ///
- /// Gets or sets a comma- or semicolon-delimited list of recipient e-mail addresses
- /// that will be carbon copied (use semicolon on .NET 1.1 and comma for later versions).
- ///
- ///
- ///
- /// For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses.
- ///
- ///
- /// For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses.
- ///
- ///
- ///
- ///
- /// For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses.
- ///
- ///
- /// For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses.
- ///
- ///
- public string Cc
- {
- get { return m_cc; }
- set { m_cc = MaybeTrimSeparators(value); }
- }
-
- ///
- /// Gets or sets a semicolon-delimited list of recipient e-mail addresses
- /// that will be blind carbon copied.
- ///
- ///
- /// A semicolon-delimited list of e-mail addresses.
- ///
- ///
- ///
- /// A semicolon-delimited list of recipient e-mail addresses.
- ///
- ///
- public string Bcc
- {
- get { return m_bcc; }
- set { m_bcc = MaybeTrimSeparators(value); }
- }
+ ///
+ /// Gets or sets a comma- or semicolon-delimited list of recipient e-mail addresses
+ /// that will be carbon copied (use semicolon on .NET 1.1 and comma for later versions).
+ ///
+ ///
+ ///
+ /// For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses.
+ ///
+ ///
+ /// For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses.
+ ///
+ ///
+ ///
+ ///
+ /// For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses.
+ ///
+ ///
+ /// For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses.
+ ///
+ ///
+ public string Cc
+ {
+ get { return m_cc; }
+ set { m_cc = MaybeTrimSeparators(value); }
+ }
+
+ ///
+ /// Gets or sets a semicolon-delimited list of recipient e-mail addresses
+ /// that will be blind carbon copied.
+ ///
+ ///
+ /// A semicolon-delimited list of e-mail addresses.
+ ///
+ ///
+ ///
+ /// A semicolon-delimited list of recipient e-mail addresses.
+ ///
+ ///
+ public string Bcc
+ {
+ get { return m_bcc; }
+ set { m_bcc = MaybeTrimSeparators(value); }
+ }
///
/// Gets or sets the e-mail address of the sender.
@@ -324,29 +324,29 @@ public MailPriority Priority
}
#if NET_2_0 || MONO_2_0 || NETSTANDARD2_0
- ///
- /// Enable or disable use of SSL when sending e-mail message
- ///
- ///
- /// This is available on MS .NET 2.0 runtime and higher
- ///
- public bool EnableSsl
- {
- get { return m_enableSsl; }
- set { m_enableSsl = value; }
- }
-
- ///
- /// Gets or sets the reply-to e-mail address.
- ///
- ///
- /// This is available on MS .NET 2.0 runtime and higher
- ///
- public string ReplyTo
- {
- get { return m_replyTo; }
- set { m_replyTo = value; }
- }
+ ///
+ /// Enable or disable use of SSL when sending e-mail message
+ ///
+ ///
+ /// This is available on MS .NET 2.0 runtime and higher
+ ///
+ public bool EnableSsl
+ {
+ get { return m_enableSsl; }
+ set { m_enableSsl = value; }
+ }
+
+ ///
+ /// Gets or sets the reply-to e-mail address.
+ ///
+ ///
+ /// This is available on MS .NET 2.0 runtime and higher
+ ///
+ public string ReplyTo
+ {
+ get { return m_replyTo; }
+ set { m_replyTo = value; }
+ }
#endif
///
@@ -387,7 +387,7 @@ override protected void SendBuffer(LoggingEvent[] events)
// appender. This frees us from needing to synchronize again.
try
{
- StringWriter writer = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
+ using StringWriter writer = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
string t = Layout.Header;
if (t != null)
@@ -449,14 +449,18 @@ virtual protected void SendEmail(string messageBody)
// The old API is deprecated.
// Create and configure the smtp client
+#if NET_4_0 || MONO_4_0 || NETSTANDARD2_0
+ using SmtpClient smtpClient = new SmtpClient();
+#else
SmtpClient smtpClient = new SmtpClient();
+#endif
if (!String.IsNullOrEmpty(m_smtpHost))
{
smtpClient.Host = m_smtpHost;
}
smtpClient.Port = m_port;
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
- smtpClient.EnableSsl = m_enableSsl;
+ smtpClient.EnableSsl = m_enableSsl;
if (m_authentication == SmtpAuthentication.Basic)
{
@@ -469,38 +473,38 @@ virtual protected void SendEmail(string messageBody)
smtpClient.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
}
- using (MailMessage mailMessage = new MailMessage())
- {
- mailMessage.Body = messageBody;
+ using (MailMessage mailMessage = new MailMessage())
+ {
+ mailMessage.Body = messageBody;
mailMessage.BodyEncoding = m_bodyEncoding;
- mailMessage.From = new MailAddress(m_from);
- mailMessage.To.Add(m_to);
- if (!String.IsNullOrEmpty(m_cc))
- {
- mailMessage.CC.Add(m_cc);
- }
- if (!String.IsNullOrEmpty(m_bcc))
- {
- mailMessage.Bcc.Add(m_bcc);
- }
- if (!String.IsNullOrEmpty(m_replyTo))
- {
- // .NET 4.0 warning CS0618: 'System.Net.Mail.MailMessage.ReplyTo' is obsolete:
- // 'ReplyTo is obsoleted for this type. Please use ReplyToList instead which can accept multiple addresses. http://go.microsoft.com/fwlink/?linkid=14202'
+ mailMessage.From = new MailAddress(m_from);
+ mailMessage.To.Add(m_to);
+ if (!String.IsNullOrEmpty(m_cc))
+ {
+ mailMessage.CC.Add(m_cc);
+ }
+ if (!String.IsNullOrEmpty(m_bcc))
+ {
+ mailMessage.Bcc.Add(m_bcc);
+ }
+ if (!String.IsNullOrEmpty(m_replyTo))
+ {
+ // .NET 4.0 warning CS0618: 'System.Net.Mail.MailMessage.ReplyTo' is obsolete:
+ // 'ReplyTo is obsoleted for this type. Please use ReplyToList instead which can accept multiple addresses. http://go.microsoft.com/fwlink/?linkid=14202'
#if !NET_4_0 && !MONO_4_0 && !NETSTANDARD2_0
- mailMessage.ReplyTo = new MailAddress(m_replyTo);
+ mailMessage.ReplyTo = new MailAddress(m_replyTo);
#else
- mailMessage.ReplyToList.Add(new MailAddress(m_replyTo));
+ mailMessage.ReplyToList.Add(new MailAddress(m_replyTo));
#endif
- }
- mailMessage.Subject = m_subject;
+ }
+ mailMessage.Subject = m_subject;
mailMessage.SubjectEncoding = m_subjectEncoding;
- mailMessage.Priority = m_mailPriority;
+ mailMessage.Priority = m_mailPriority;
- // TODO: Consider using SendAsync to send the message without blocking. This would be a change in
- // behaviour compared to .NET 1.x. We would need a SendCompletedCallback to log errors.
- smtpClient.Send(mailMessage);
- }
+ // TODO: Consider using SendAsync to send the message without blocking. This would be a change in
+ // behaviour compared to .NET 1.x. We would need a SendCompletedCallback to log errors.
+ smtpClient.Send(mailMessage);
+ }
#else
// .NET 1.x uses the System.Web.Mail API for sending Mail
@@ -509,14 +513,14 @@ virtual protected void SendEmail(string messageBody)
mailMessage.BodyEncoding = m_bodyEncoding;
mailMessage.From = m_from;
mailMessage.To = m_to;
- if (m_cc != null && m_cc.Length > 0)
- {
- mailMessage.Cc = m_cc;
- }
- if (m_bcc != null && m_bcc.Length > 0)
- {
- mailMessage.Bcc = m_bcc;
- }
+ if (m_cc != null && m_cc.Length > 0)
+ {
+ mailMessage.Cc = m_cc;
+ }
+ if (m_bcc != null && m_bcc.Length > 0)
+ {
+ mailMessage.Bcc = m_bcc;
+ }
mailMessage.Subject = m_subject;
#if !MONO && !NET_1_0 && !NET_1_1 && !CLI_1_0
mailMessage.SubjectEncoding = m_subjectEncoding;
@@ -585,8 +589,8 @@ virtual protected void SendEmail(string messageBody)
#region Private Instance Fields
private string m_to;
- private string m_cc;
- private string m_bcc;
+ private string m_cc;
+ private string m_bcc;
private string m_from;
private string m_subject;
private string m_smtpHost;
@@ -604,8 +608,8 @@ virtual protected void SendEmail(string messageBody)
private MailPriority m_mailPriority = MailPriority.Normal;
#if NET_2_0 || MONO_2_0 || NETSTANDARD2_0
- private bool m_enableSsl = false;
- private string m_replyTo;
+ private bool m_enableSsl = false;
+ private string m_replyTo;
#endif
#endregion // Private Instance Fields
@@ -646,19 +650,19 @@ public enum SmtpAuthentication
#endregion // SmtpAuthentication Enum
- private static readonly char[] ADDRESS_DELIMITERS = new char[] { ',', ';' };
-
- ///
- /// trims leading and trailing commas or semicolons
- ///
- private static string MaybeTrimSeparators(string s) {
+ private static readonly char[] ADDRESS_DELIMITERS = new char[] { ',', ';' };
+
+ ///
+ /// trims leading and trailing commas or semicolons
+ ///
+ private static string MaybeTrimSeparators(string s) {
#if NET_2_0 || MONO_2_0 || NETSTANDARD2_0
- return string.IsNullOrEmpty(s) ? s : s.Trim(ADDRESS_DELIMITERS);
+ return string.IsNullOrEmpty(s) ? s : s.Trim(ADDRESS_DELIMITERS);
#else
- return s != null && s.Length > 0 ? s : s.Trim(ADDRESS_DELIMITERS);
+ return s != null && s.Length > 0 ? s : s.Trim(ADDRESS_DELIMITERS);
#endif
- }
- }
+ }
+ }
}
#endif // !NETCF && !SSCLI
diff --git a/src/log4net/Config/XmlConfigurator.cs b/src/log4net/Config/XmlConfigurator.cs
index 02795fd15..cd9ebfea9 100644
--- a/src/log4net/Config/XmlConfigurator.cs
+++ b/src/log4net/Config/XmlConfigurator.cs
@@ -49,8 +49,8 @@ public sealed class XmlConfigurator
///
/// Private constructor
///
- private XmlConfigurator()
- {
+ private XmlConfigurator()
+ {
}
#endregion Protected Instance Constructors
@@ -58,26 +58,26 @@ private XmlConfigurator()
#region Configure static methods
#if !NETCF
- ///
- /// Automatically configures the using settings
- /// stored in the application's configuration file.
- ///
- ///
- ///
- /// Each application has a configuration file. This has the
- /// same name as the application with '.config' appended.
- /// This file is XML and calling this function prompts the
- /// configurator to look in that file for a section called
- /// log4net that contains the configuration data.
- ///
- ///
- /// To use this method to configure log4net you must specify
- /// the section
- /// handler for the log4net configuration section. See the
- /// for an example.
- ///
- ///
- /// The repository to configure.
+ ///
+ /// Automatically configures the using settings
+ /// stored in the application's configuration file.
+ ///
+ ///
+ ///
+ /// Each application has a configuration file. This has the
+ /// same name as the application with '.config' appended.
+ /// This file is XML and calling this function prompts the
+ /// configurator to look in that file for a section called
+ /// log4net that contains the configuration data.
+ ///
+ ///
+ /// To use this method to configure log4net you must specify
+ /// the section
+ /// handler for the log4net configuration section. See the
+ /// for an example.
+ ///
+ ///
+ /// The repository to configure.
#else
///
/// Automatically configures the using settings
@@ -94,21 +94,21 @@ private XmlConfigurator()
///
/// The repository to configure.
#endif
- static public ICollection Configure(ILoggerRepository repository)
- {
- ArrayList configurationMessages = new ArrayList();
+ static public ICollection Configure(ILoggerRepository repository)
+ {
+ ArrayList configurationMessages = new ArrayList();
- using (new LogLog.LogReceivedAdapter(configurationMessages))
- {
- InternalConfigure(repository);
- }
+ using (new LogLog.LogReceivedAdapter(configurationMessages))
+ {
+ InternalConfigure(repository);
+ }
- repository.ConfigurationMessages = configurationMessages;
+ repository.ConfigurationMessages = configurationMessages;
- return configurationMessages;
- }
+ return configurationMessages;
+ }
- static private void InternalConfigure(ILoggerRepository repository)
+ static private void InternalConfigure(ILoggerRepository repository)
{
LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using .config file section");
@@ -194,10 +194,10 @@ static private void InternalConfigure(ILoggerRepository repository)
///
///
#endif
- static public ICollection Configure()
- {
- return Configure(LogManager.GetRepository(Assembly.GetCallingAssembly()));
- }
+ static public ICollection Configure()
+ {
+ return Configure(LogManager.GetRepository(Assembly.GetCallingAssembly()));
+ }
///
/// Configures log4net using a log4net element
@@ -209,20 +209,20 @@ static public ICollection Configure()
///
///
/// The element to parse.
- static public ICollection Configure(XmlElement element)
+ static public ICollection Configure(XmlElement element)
{
- ArrayList configurationMessages = new ArrayList();
+ ArrayList configurationMessages = new ArrayList();
- ILoggerRepository repository = LogManager.GetRepository(Assembly.GetCallingAssembly());
+ ILoggerRepository repository = LogManager.GetRepository(Assembly.GetCallingAssembly());
- using (new LogLog.LogReceivedAdapter(configurationMessages))
- {
- InternalConfigureFromXml(repository, element);
- }
+ using (new LogLog.LogReceivedAdapter(configurationMessages))
+ {
+ InternalConfigureFromXml(repository, element);
+ }
- repository.ConfigurationMessages = configurationMessages;
+ repository.ConfigurationMessages = configurationMessages;
- return configurationMessages;
+ return configurationMessages;
}
#if !NETCF
@@ -314,14 +314,14 @@ static public ICollection Configure(XmlElement element)
#endif
static public ICollection Configure(FileInfo configFile)
{
- ArrayList configurationMessages = new ArrayList();
+ ArrayList configurationMessages = new ArrayList();
- using (new LogLog.LogReceivedAdapter(configurationMessages))
- {
- InternalConfigure(LogManager.GetRepository(Assembly.GetCallingAssembly()), configFile);
- }
+ using (new LogLog.LogReceivedAdapter(configurationMessages))
+ {
+ InternalConfigure(LogManager.GetRepository(Assembly.GetCallingAssembly()), configFile);
+ }
- return configurationMessages;
+ return configurationMessages;
}
///
@@ -340,17 +340,17 @@ static public ICollection Configure(FileInfo configFile)
///
static public ICollection Configure(Uri configUri)
{
- ArrayList configurationMessages = new ArrayList();
+ ArrayList configurationMessages = new ArrayList();
- ILoggerRepository repository = LogManager.GetRepository(Assembly.GetCallingAssembly());
- using (new LogLog.LogReceivedAdapter(configurationMessages))
- {
- InternalConfigure(repository, configUri);
- }
+ ILoggerRepository repository = LogManager.GetRepository(Assembly.GetCallingAssembly());
+ using (new LogLog.LogReceivedAdapter(configurationMessages))
+ {
+ InternalConfigure(repository, configUri);
+ }
- repository.ConfigurationMessages = configurationMessages;
+ repository.ConfigurationMessages = configurationMessages;
- return configurationMessages;
+ return configurationMessages;
}
///
@@ -369,99 +369,99 @@ static public ICollection Configure(Uri configUri)
///
static public ICollection Configure(Stream configStream)
{
- ArrayList configurationMessages = new ArrayList();
+ ArrayList configurationMessages = new ArrayList();
- ILoggerRepository repository = LogManager.GetRepository(Assembly.GetCallingAssembly());
- using (new LogLog.LogReceivedAdapter(configurationMessages))
- {
- InternalConfigure(repository, configStream);
- }
+ ILoggerRepository repository = LogManager.GetRepository(Assembly.GetCallingAssembly());
+ using (new LogLog.LogReceivedAdapter(configurationMessages))
+ {
+ InternalConfigure(repository, configStream);
+ }
- repository.ConfigurationMessages = configurationMessages;
+ repository.ConfigurationMessages = configurationMessages;
- return configurationMessages;
+ return configurationMessages;
}
#endif // !NETSTANDARD1_3
- ///
- /// Configures the using the specified XML
- /// element.
- ///
- ///
- /// Loads the log4net configuration from the XML element
- /// supplied as .
- ///
- /// The repository to configure.
- /// The element to parse.
- static public ICollection Configure(ILoggerRepository repository, XmlElement element)
- {
- ArrayList configurationMessages = new ArrayList();
+ ///
+ /// Configures the using the specified XML
+ /// element.
+ ///
+ ///
+ /// Loads the log4net configuration from the XML element
+ /// supplied as .
+ ///
+ /// The repository to configure.
+ /// The element to parse.
+ static public ICollection Configure(ILoggerRepository repository, XmlElement element)
+ {
+ ArrayList configurationMessages = new ArrayList();
- using (new LogLog.LogReceivedAdapter(configurationMessages))
- {
- LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using XML element");
+ using (new LogLog.LogReceivedAdapter(configurationMessages))
+ {
+ LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using XML element");
- InternalConfigureFromXml(repository, element);
- }
+ InternalConfigureFromXml(repository, element);
+ }
- repository.ConfigurationMessages = configurationMessages;
+ repository.ConfigurationMessages = configurationMessages;
- return configurationMessages;
- }
+ return configurationMessages;
+ }
#if !NETCF
- ///
- /// Configures the using the specified configuration
- /// file.
- ///
- /// The repository to configure.
- /// The XML file to load the configuration from.
- ///
- ///
- /// The configuration file must be valid XML. It must contain
- /// at least one element called log4net that holds
- /// the configuration data.
- ///
- ///
- /// The log4net configuration file can possible be specified in the application's
- /// configuration file (either MyAppName.exe.config for a
- /// normal application on Web.config for an ASP.NET application).
- ///
- ///
- /// The first element matching <configuration> will be read as the
- /// configuration. If this file is also a .NET .config file then you must specify
- /// a configuration section for the log4net element otherwise .NET will
- /// complain. Set the type for the section handler to , for example:
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- /// The following example configures log4net using a configuration file, of which the
- /// location is stored in the application's configuration file :
- ///
- ///
- /// using log4net.Config;
- /// using System.IO;
- /// using System.Configuration;
- ///
- /// ...
- ///
- /// XmlConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"]));
- ///
- ///
- /// In the .config file, the path to the log4net can be specified like this :
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
+ ///
+ /// Configures the using the specified configuration
+ /// file.
+ ///
+ /// The repository to configure.
+ /// The XML file to load the configuration from.
+ ///
+ ///
+ /// The configuration file must be valid XML. It must contain
+ /// at least one element called log4net that holds
+ /// the configuration data.
+ ///
+ ///
+ /// The log4net configuration file can possible be specified in the application's
+ /// configuration file (either MyAppName.exe.config for a
+ /// normal application on Web.config for an ASP.NET application).
+ ///
+ ///
+ /// The first element matching <configuration> will be read as the
+ /// configuration. If this file is also a .NET .config file then you must specify
+ /// a configuration section for the log4net element otherwise .NET will
+ /// complain. Set the type for the section handler to , for example:
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The following example configures log4net using a configuration file, of which the
+ /// location is stored in the application's configuration file :
+ ///
+ ///
+ /// using log4net.Config;
+ /// using System.IO;
+ /// using System.Configuration;
+ ///
+ /// ...
+ ///
+ /// XmlConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"]));
+ ///
+ ///
+ /// In the .config file, the path to the log4net can be specified like this :
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
#else
///
/// Configures the using the specified configuration
@@ -500,20 +500,20 @@ static public ICollection Configure(ILoggerRepository repository, XmlElement ele
///
///
#endif
- static public ICollection Configure(ILoggerRepository repository, FileInfo configFile)
- {
- ArrayList configurationMessages = new ArrayList();
+ static public ICollection Configure(ILoggerRepository repository, FileInfo configFile)
+ {
+ ArrayList configurationMessages = new ArrayList();
- using (new LogLog.LogReceivedAdapter(configurationMessages))
- {
- InternalConfigure(repository, configFile);
- }
+ using (new LogLog.LogReceivedAdapter(configurationMessages))
+ {
+ InternalConfigure(repository, configFile);
+ }
- repository.ConfigurationMessages = configurationMessages;
+ repository.ConfigurationMessages = configurationMessages;
+
+ return configurationMessages;
+ }
- return configurationMessages;
- }
-
static private void InternalConfigure(ILoggerRepository repository, FileInfo configFile)
{
LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using file [" + configFile + "]");
@@ -530,7 +530,7 @@ static private void InternalConfigure(ILoggerRepository repository, FileInfo con
{
// Open the file for reading
FileStream fs = null;
-
+
// Try hard to open the file
for(int retry = 5; --retry >= 0; )
{
@@ -573,36 +573,36 @@ static private void InternalConfigure(ILoggerRepository repository, FileInfo con
}
}
- ///
- /// Configures the using the specified configuration
- /// URI.
- ///
- /// The repository to configure.
- /// A URI to load the XML configuration from.
- ///
- ///
- /// The configuration data must be valid XML. It must contain
- /// at least one element called log4net that holds
- /// the configuration data.
- ///
- ///
- /// The must support the URI scheme specified.
- ///
- ///
- static public ICollection Configure(ILoggerRepository repository, Uri configUri)
- {
- ArrayList configurationMessages = new ArrayList();
-
- using (new LogLog.LogReceivedAdapter(configurationMessages))
- {
- InternalConfigure(repository, configUri);
- }
-
- repository.ConfigurationMessages = configurationMessages;
-
- return configurationMessages;
- }
-
+ ///
+ /// Configures the using the specified configuration
+ /// URI.
+ ///
+ /// The repository to configure.
+ /// A URI to load the XML configuration from.
+ ///
+ ///
+ /// The configuration data must be valid XML. It must contain
+ /// at least one element called log4net that holds
+ /// the configuration data.
+ ///
+ ///
+ /// The must support the URI scheme specified.
+ ///
+ ///
+ static public ICollection Configure(ILoggerRepository repository, Uri configUri)
+ {
+ ArrayList configurationMessages = new ArrayList();
+
+ using (new LogLog.LogReceivedAdapter(configurationMessages))
+ {
+ InternalConfigure(repository, configUri);
+ }
+
+ repository.ConfigurationMessages = configurationMessages;
+
+ return configurationMessages;
+ }
+
static private void InternalConfigure(ILoggerRepository repository, Uri configUri)
{
LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using URI ["+configUri+"]");
@@ -667,36 +667,36 @@ static private void InternalConfigure(ILoggerRepository repository, Uri configUr
}
}
- ///
- /// Configures the using the specified configuration
- /// file.
- ///
- /// The repository to configure.
- /// The stream to load the XML configuration from.
- ///
- ///
- /// The configuration data must be valid XML. It must contain
- /// at least one element called log4net that holds
- /// the configuration data.
- ///
- ///
- /// Note that this method will NOT close the stream parameter.
- ///
- ///
- static public ICollection Configure(ILoggerRepository repository, Stream configStream)
- {
- ArrayList configurationMessages = new ArrayList();
-
- using (new LogLog.LogReceivedAdapter(configurationMessages))
- {
- InternalConfigure(repository, configStream);
- }
-
- repository.ConfigurationMessages = configurationMessages;
-
- return configurationMessages;
- }
-
+ ///
+ /// Configures the using the specified configuration
+ /// file.
+ ///
+ /// The repository to configure.
+ /// The stream to load the XML configuration from.
+ ///
+ ///
+ /// The configuration data must be valid XML. It must contain
+ /// at least one element called log4net that holds
+ /// the configuration data.
+ ///
+ ///
+ /// Note that this method will NOT close the stream parameter.
+ ///
+ ///
+ static public ICollection Configure(ILoggerRepository repository, Stream configStream)
+ {
+ ArrayList configurationMessages = new ArrayList();
+
+ using (new LogLog.LogReceivedAdapter(configurationMessages))
+ {
+ InternalConfigure(repository, configStream);
+ }
+
+ repository.ConfigurationMessages = configurationMessages;
+
+ return configurationMessages;
+ }
+
static private void InternalConfigure(ILoggerRepository repository, Stream configStream)
{
LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using stream");
@@ -708,7 +708,11 @@ static private void InternalConfigure(ILoggerRepository repository, Stream confi
else
{
// Load the config file into a document
+#if NETSTANDARD1_3
XmlDocument doc = new XmlDocument();
+#else
+ XmlDocument doc = new XmlDocument { XmlResolver = null };
+#endif
try
{
#if (NETCF)
@@ -717,8 +721,8 @@ static private void InternalConfigure(ILoggerRepository repository, Stream confi
#elif NET_2_0 || NETSTANDARD
// Allow the DTD to specify entity includes
XmlReaderSettings settings = new XmlReaderSettings();
- // .NET 4.0 warning CS0618: 'System.Xml.XmlReaderSettings.ProhibitDtd'
- // is obsolete: 'Use XmlReaderSettings.DtdProcessing property instead.'
+ // .NET 4.0 warning CS0618: 'System.Xml.XmlReaderSettings.ProhibitDtd'
+ // is obsolete: 'Use XmlReaderSettings.DtdProcessing property instead.'
#if NETSTANDARD1_3 // TODO DtdProcessing.Parse not yet available (https://github.com/dotnet/corefx/issues/4376)
settings.DtdProcessing = DtdProcessing.Ignore;
#elif !NET_4_0 && !MONO_4_0 && !NETSTANDARD2_0
@@ -728,17 +732,17 @@ static private void InternalConfigure(ILoggerRepository repository, Stream confi
#endif
// Create a reader over the input stream
- XmlReader xmlReader = XmlReader.Create(configStream, settings);
+ using XmlReader xmlReader = XmlReader.Create(configStream, settings);
#else
// Create a validating reader around a text reader for the file stream
- XmlValidatingReader xmlReader = new XmlValidatingReader(new XmlTextReader(configStream));
+ using XmlValidatingReader xmlReader = new XmlValidatingReader(new XmlTextReader(configStream));
// Specify that the reader should not perform validation, but that it should
// expand entity refs.
xmlReader.ValidationType = ValidationType.None;
xmlReader.EntityHandling = EntityHandling.ExpandEntities;
#endif
-
+
// load the data into the document
doc.Load(xmlReader);
}
@@ -801,58 +805,58 @@ static private void InternalConfigure(ILoggerRepository repository, Stream confi
///
static public ICollection ConfigureAndWatch(FileInfo configFile)
{
- ArrayList configurationMessages = new ArrayList();
+ ArrayList configurationMessages = new ArrayList();
- ILoggerRepository repository = LogManager.GetRepository(Assembly.GetCallingAssembly());
+ ILoggerRepository repository = LogManager.GetRepository(Assembly.GetCallingAssembly());
- using (new LogLog.LogReceivedAdapter(configurationMessages))
- {
- InternalConfigureAndWatch(repository, configFile);
- }
+ using (new LogLog.LogReceivedAdapter(configurationMessages))
+ {
+ InternalConfigureAndWatch(repository, configFile);
+ }
- repository.ConfigurationMessages = configurationMessages;
+ repository.ConfigurationMessages = configurationMessages;
- return configurationMessages;
+ return configurationMessages;
}
#endif // !NETSTANDARD1_3
- ///
- /// Configures the using the file specified,
- /// monitors the file for changes and reloads the configuration if a change
- /// is detected.
- ///
- /// The repository to configure.
- /// The XML file to load the configuration from.
- ///
- ///
- /// The configuration file must be valid XML. It must contain
- /// at least one element called log4net that holds
- /// the configuration data.
- ///
- ///
- /// The configuration file will be monitored using a
- /// and depends on the behavior of that class.
- ///
- ///
- /// For more information on how to configure log4net using
- /// a separate configuration file, see .
- ///
- ///
- ///
- static public ICollection ConfigureAndWatch(ILoggerRepository repository, FileInfo configFile)
- {
- ArrayList configurationMessages = new ArrayList();
-
- using (new LogLog.LogReceivedAdapter(configurationMessages))
- {
- InternalConfigureAndWatch(repository, configFile);
- }
-
- repository.ConfigurationMessages = configurationMessages;
-
- return configurationMessages;
- }
-
+ ///
+ /// Configures the using the file specified,
+ /// monitors the file for changes and reloads the configuration if a change
+ /// is detected.
+ ///
+ /// The repository to configure.
+ /// The XML file to load the configuration from.
+ ///
+ ///
+ /// The configuration file must be valid XML. It must contain
+ /// at least one element called log4net that holds
+ /// the configuration data.
+ ///
+ ///
+ /// The configuration file will be monitored using a
+ /// and depends on the behavior of that class.
+ ///
+ ///
+ /// For more information on how to configure log4net using
+ /// a separate configuration file, see .
+ ///
+ ///
+ ///
+ static public ICollection ConfigureAndWatch(ILoggerRepository repository, FileInfo configFile)
+ {
+ ArrayList configurationMessages = new ArrayList();
+
+ using (new LogLog.LogReceivedAdapter(configurationMessages))
+ {
+ InternalConfigureAndWatch(repository, configFile);
+ }
+
+ repository.ConfigurationMessages = configurationMessages;
+
+ return configurationMessages;
+ }
+
static private void InternalConfigureAndWatch(ILoggerRepository repository, FileInfo configFile)
{
LogLog.Debug(declaringType, "configuring repository [" + repository.Name + "] using file [" + configFile + "] watching for file updates");
@@ -868,23 +872,23 @@ static private void InternalConfigureAndWatch(ILoggerRepository repository, File
try
{
- lock (m_repositoryName2ConfigAndWatchHandler)
- {
- // support multiple repositories each having their own watcher
- ConfigureAndWatchHandler handler =
+ lock (m_repositoryName2ConfigAndWatchHandler)
+ {
+ // support multiple repositories each having their own watcher
+ ConfigureAndWatchHandler handler =
(ConfigureAndWatchHandler)m_repositoryName2ConfigAndWatchHandler[configFile.FullName];
- if (handler != null)
- {
+ if (handler != null)
+ {
m_repositoryName2ConfigAndWatchHandler.Remove(configFile.FullName);
- handler.Dispose();
- }
+ handler.Dispose();
+ }
- // Create and start a watch handler that will reload the
- // configuration whenever the config file is modified.
- handler = new ConfigureAndWatchHandler(repository, configFile);
+ // Create and start a watch handler that will reload the
+ // configuration whenever the config file is modified.
+ handler = new ConfigureAndWatchHandler(repository, configFile);
m_repositoryName2ConfigAndWatchHandler[configFile.FullName] = handler;
- }
+ }
}
catch(Exception ex)
{
@@ -938,15 +942,15 @@ private sealed class ConfigureAndWatchHandler : IDisposable
///
private const int TimeoutMillis = 500;
- ///
- /// Watches file for changes. This object should be disposed when no longer
- /// needed to free system handles on the watched resources.
- ///
- private FileSystemWatcher m_watcher;
+ ///
+ /// Watches file for changes. This object should be disposed when no longer
+ /// needed to free system handles on the watched resources.
+ ///
+ private FileSystemWatcher m_watcher;
///
/// Initializes a new instance of the class to
- /// watch a specified config file used to configure a repository.
+ /// watch a specified config file used to configure a repository.
///
/// The repository to configure.
/// The configuration file to watch.
@@ -956,9 +960,9 @@ private sealed class ConfigureAndWatchHandler : IDisposable
///
///
#if NET_4_0 || MONO_4_0 || NETSTANDARD
- [System.Security.SecuritySafeCritical]
+ [System.Security.SecuritySafeCritical]
#endif
- public ConfigureAndWatchHandler(ILoggerRepository repository, FileInfo configFile)
+ public ConfigureAndWatchHandler(ILoggerRepository repository, FileInfo configFile)
{
m_repository = repository;
m_configFile = configFile;
@@ -982,7 +986,7 @@ public ConfigureAndWatchHandler(ILoggerRepository repository, FileInfo configFil
m_watcher.EnableRaisingEvents = true;
// Create the timer that will be used to deliver events. Set as disabled
- m_timer = new Timer(new TimerCallback(OnWatchedFileChange), null, Timeout.Infinite, Timeout.Infinite);
+ m_timer = new Timer(new TimerCallback(OnWatchedFileChange), null, Timeout.Infinite, Timeout.Infinite);
}
///
@@ -1032,18 +1036,18 @@ private void OnWatchedFileChange(object state)
XmlConfigurator.InternalConfigure(m_repository, m_configFile);
}
- ///
- /// Release the handles held by the watcher and timer.
- ///
+ ///
+ /// Release the handles held by the watcher and timer.
+ ///
#if NET_4_0 || MONO_4_0 || NETSTANDARD
- [System.Security.SecuritySafeCritical]
+ [System.Security.SecuritySafeCritical]
#endif
- public void Dispose()
- {
- m_watcher.EnableRaisingEvents = false;
- m_watcher.Dispose();
- m_timer.Dispose();
- }
+ public void Dispose()
+ {
+ m_watcher.EnableRaisingEvents = false;
+ m_watcher.Dispose();
+ m_timer.Dispose();
+ }
}
#endif
@@ -1066,7 +1070,7 @@ public void Dispose()
/// to load the configuration from an .
///
///
- static private void InternalConfigureFromXml(ILoggerRepository repository, XmlElement element)
+ static private void InternalConfigureFromXml(ILoggerRepository repository, XmlElement element)
{
if (element == null)
{
@@ -1090,36 +1094,40 @@ static private void InternalConfigureFromXml(ILoggerRepository repository, XmlEl
// Copy the xml data into the root of a new document
// this isolates the xml config data from the rest of
// the document
+#if NETSTANDARD1_3
XmlDocument newDoc = new XmlDocument();
+#else
+ XmlDocument newDoc = new XmlDocument { XmlResolver = null };
+#endif
XmlElement newElement = (XmlElement)newDoc.AppendChild(newDoc.ImportNode(element, true));
// Pass the configurator the config element
configurableRepository.Configure(newElement);
- }
+ }
}
}
#endregion Private Static Methods
- #region Private Static Fields
-
- ///
- /// Maps repository names to ConfigAndWatchHandler instances to allow a particular
- /// ConfigAndWatchHandler to dispose of its FileSystemWatcher when a repository is
- /// reconfigured.
- ///
- private readonly static Hashtable m_repositoryName2ConfigAndWatchHandler = new Hashtable();
-
- ///
- /// The fully qualified type of the XmlConfigurator class.
- ///
- ///
- /// Used by the internal logger to record the Type of the
- /// log message.
- ///
- private readonly static Type declaringType = typeof(XmlConfigurator);
-
- #endregion Private Static Fields
+ #region Private Static Fields
+
+ ///
+ /// Maps repository names to ConfigAndWatchHandler instances to allow a particular
+ /// ConfigAndWatchHandler to dispose of its FileSystemWatcher when a repository is
+ /// reconfigured.
+ ///
+ private readonly static Hashtable m_repositoryName2ConfigAndWatchHandler = new Hashtable();
+
+ ///
+ /// The fully qualified type of the XmlConfigurator class.
+ ///
+ ///
+ /// Used by the internal logger to record the Type of the
+ /// log message.
+ ///
+ private readonly static Type declaringType = typeof(XmlConfigurator);
+
+ #endregion Private Static Fields
}
}
diff --git a/src/log4net/Layout/Layout2RawLayoutAdapter.cs b/src/log4net/Layout/Layout2RawLayoutAdapter.cs
index 5b3707c22..494578418 100644
--- a/src/log4net/Layout/Layout2RawLayoutAdapter.cs
+++ b/src/log4net/Layout/Layout2RawLayoutAdapter.cs
@@ -83,7 +83,7 @@ public Layout2RawLayoutAdapter(ILayout layout)
///
virtual public object Format(LoggingEvent loggingEvent)
{
- StringWriter writer = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
+ using StringWriter writer = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
m_layout.Format(writer, loggingEvent);
return writer.ToString();
}
diff --git a/src/log4net/Layout/LayoutSkeleton.cs b/src/log4net/Layout/LayoutSkeleton.cs
index b373ee144..afae60e7b 100644
--- a/src/log4net/Layout/LayoutSkeleton.cs
+++ b/src/log4net/Layout/LayoutSkeleton.cs
@@ -117,9 +117,9 @@ protected LayoutSkeleton()
/// If any of the configuration properties are modified then
/// must be called again.
///
- ///
- /// This method must be implemented by the subclass.
- ///
+ ///
+ /// This method must be implemented by the subclass.
+ ///
///
abstract public void ActivateOptions();
@@ -140,93 +140,93 @@ protected LayoutSkeleton()
///
abstract public void Format(TextWriter writer, LoggingEvent loggingEvent);
- ///
- /// Convenience method for easily formatting the logging event into a string variable.
- ///
- ///
- ///
- /// Creates a new StringWriter instance to store the formatted logging event.
- ///
- public string Format(LoggingEvent loggingEvent)
- {
- StringWriter writer = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
- Format(writer, loggingEvent);
- return writer.ToString();
- }
-
- ///
- /// The content type output by this layout.
- ///
- /// The content type is "text/plain"
- ///
- ///
- /// The content type output by this layout.
- ///
- ///
- /// This base class uses the value "text/plain".
- /// To change this value a subclass must override this
- /// property.
- ///
- ///
- virtual public string ContentType
- {
- get { return "text/plain"; }
- }
-
- ///
- /// The header for the layout format.
- ///
- /// the layout header
- ///
- ///
- /// The Header text will be appended before any logging events
- /// are formatted and appended.
- ///
- ///
- virtual public string Header
- {
- get { return m_header; }
- set { m_header = value; }
- }
-
- ///
- /// The footer for the layout format.
- ///
- /// the layout footer
- ///
- ///
- /// The Footer text will be appended after all the logging events
- /// have been formatted and appended.
- ///
- ///
- virtual public string Footer
- {
- get { return m_footer; }
- set { m_footer = value; }
- }
-
- ///
- /// Flag indicating if this layout handles exceptions
- ///
- /// false if this layout handles exceptions
- ///
- ///
- /// If this layout handles the exception object contained within
- /// , then the layout should return
- /// false. Otherwise, if the layout ignores the exception
- /// object, then the layout should return true.
- ///
- ///
- /// Set this value to override a this default setting. The default
- /// value is true, this layout does not handle the exception.
- ///
- ///
- virtual public bool IgnoresException
- {
- get { return m_ignoresException; }
- set { m_ignoresException = value; }
- }
-
- #endregion
+ ///
+ /// Convenience method for easily formatting the logging event into a string variable.
+ ///
+ ///
+ ///
+ /// Creates a new StringWriter instance to store the formatted logging event.
+ ///
+ public string Format(LoggingEvent loggingEvent)
+ {
+ using StringWriter writer = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
+ Format(writer, loggingEvent);
+ return writer.ToString();
+ }
+
+ ///
+ /// The content type output by this layout.
+ ///
+ /// The content type is "text/plain"
+ ///
+ ///
+ /// The content type output by this layout.
+ ///
+ ///
+ /// This base class uses the value "text/plain".
+ /// To change this value a subclass must override this
+ /// property.
+ ///
+ ///
+ virtual public string ContentType
+ {
+ get { return "text/plain"; }
+ }
+
+ ///
+ /// The header for the layout format.
+ ///
+ /// the layout header
+ ///
+ ///
+ /// The Header text will be appended before any logging events
+ /// are formatted and appended.
+ ///
+ ///
+ virtual public string Header
+ {
+ get { return m_header; }
+ set { m_header = value; }
+ }
+
+ ///
+ /// The footer for the layout format.
+ ///
+ /// the layout footer
+ ///
+ ///
+ /// The Footer text will be appended after all the logging events
+ /// have been formatted and appended.
+ ///
+ ///
+ virtual public string Footer
+ {
+ get { return m_footer; }
+ set { m_footer = value; }
+ }
+
+ ///
+ /// Flag indicating if this layout handles exceptions
+ ///
+ /// false if this layout handles exceptions
+ ///
+ ///
+ /// If this layout handles the exception object contained within
+ /// , then the layout should return
+ /// false. Otherwise, if the layout ignores the exception
+ /// object, then the layout should return true.
+ ///
+ ///
+ /// Set this value to override a this default setting. The default
+ /// value is true, this layout does not handle the exception.
+ ///
+ ///
+ virtual public bool IgnoresException
+ {
+ get { return m_ignoresException; }
+ set { m_ignoresException = value; }
+ }
+
+ #endregion
}
}
diff --git a/src/log4net/ObjectRenderer/RendererMap.cs b/src/log4net/ObjectRenderer/RendererMap.cs
index 7f4db96ce..666dfda46 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 readonly static Type declaringType = typeof(RendererMap);
#region Member Variables
@@ -94,7 +94,7 @@ public string FindAndRender(object obj)
return strData;
}
- StringWriter stringWriter = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
+ using StringWriter stringWriter = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
FindAndRender(obj, stringWriter);
return stringWriter.ToString();
}
diff --git a/src/log4net/Util/PatternString.cs b/src/log4net/Util/PatternString.cs
index 4a840eda8..72d9ba921 100644
--- a/src/log4net/Util/PatternString.cs
+++ b/src/log4net/Util/PatternString.cs
@@ -467,7 +467,7 @@ public void Format(TextWriter writer)
///
public string Format()
{
- StringWriter writer = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
+ using StringWriter writer = new StringWriter(System.Globalization.CultureInfo.InvariantCulture);
Format(writer);
return writer.ToString();
}
From 67fd5a1fab758910e73c648f036708131df44d86 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Fri, 18 Sep 2020 13:34:32 +0200
Subject: [PATCH 006/122] :wrench: add automagic to synchronise assembly
version info with csproj
---
local-tasks/update-version-info.js | 51 +++++++++++++++++++++++++++++
package-lock.json | 34 ++++++++++++++++---
package.json | 6 ++--
src/log4net/AssemblyInfo.cs | 46 +++++++++++++-------------
src/log4net/AssemblyVersionInfo.cpp | 48 ---------------------------
src/log4net/AssemblyVersionInfo.js | 49 ---------------------------
src/log4net/AssemblyVersionInfo.vb | 46 --------------------------
src/log4net/log4net.csproj | 2 +-
8 files changed, 109 insertions(+), 173 deletions(-)
create mode 100644 local-tasks/update-version-info.js
delete mode 100644 src/log4net/AssemblyVersionInfo.cpp
delete mode 100644 src/log4net/AssemblyVersionInfo.js
delete mode 100644 src/log4net/AssemblyVersionInfo.vb
diff --git a/local-tasks/update-version-info.js b/local-tasks/update-version-info.js
new file mode 100644
index 000000000..314bf5cc3
--- /dev/null
+++ b/local-tasks/update-version-info.js
@@ -0,0 +1,51 @@
+const
+ gulp = requireModule("gulp");
+
+gulp.task("update-version-info", async () => {
+ // the version as per the .csproj is the correct version, but there
+ // are other places where the version string is set via [assembly]
+ // attributes, so we need to re-align them all
+ const
+ Git = require("simple-git/promise"),
+ readTextFile = requireModule("read-text-file"),
+ writeTextFile = requireModule("write-text-file"),
+ readCsProjVersion = requireModule("read-csproj-version"),
+ currentVersion = await readCsProjVersion("src/log4net/log4net.csproj"),
+ assemblyInfo = "src/log4net/AssemblyInfo.cs",
+ assemblyVersionInfo = "src/log4net/AssemblyVersionInfo.cs",
+ versionString = sanitiseVersion(currentVersion);
+
+ await updateVersionsIn(assemblyInfo, versionString);
+ await updateVersionsIn(assemblyVersionInfo, versionString);
+
+ const git = new Git(".");
+ await git.add([
+ assemblyInfo,
+ assemblyVersionInfo
+ ]);
+ await git.commit(`:bookmark: update versioning to ${versionString}`);
+
+ async function updateVersionsIn(
+ filePath,
+ newVersion
+ ) {
+ const
+ contents = await readTextFile(filePath),
+ updated = contents
+ // specific matches for "x.x.x.x"
+ .replace(/"\d+\.\d+\.\d+\.\d+"/g, `"${newVersion}"`)
+ // matches for "x.x.x.x- as found in AssemblyVersionInfo.cs
+ .replace(/"\d+\.\d+\.\d+\.\d+-/g, `"${newVersion}-`);
+ await writeTextFile(filePath, updated);
+ }
+
+ function sanitiseVersion(version) {
+ const parts = version.split(".");
+ while (parts.length < 4) {
+ parts.push("0");
+ }
+ return parts.slice(0, 4).join(".");
+ }
+});
+
+
diff --git a/package-lock.json b/package-lock.json
index 68573e0c6..5368c2fd6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4,6 +4,21 @@
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+ "@kwsites/file-exists": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz",
+ "integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==",
+ "dev": true,
+ "requires": {
+ "debug": "^4.1.1"
+ }
+ },
+ "@kwsites/promise-deferred": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz",
+ "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==",
+ "dev": true
+ },
"@nodelib/fs.scandir": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz",
@@ -5010,12 +5025,14 @@
"dev": true
},
"simple-git": {
- "version": "1.132.0",
- "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-1.132.0.tgz",
- "integrity": "sha512-xauHm1YqCTom1sC9eOjfq3/9RKiUA9iPnxBbrY2DdL8l4ADMu0jjM5l5lphQP5YWNqAL2aXC/OeuQ76vHtW5fg==",
+ "version": "2.20.1",
+ "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-2.20.1.tgz",
+ "integrity": "sha512-aa9s2ZLjXlHCVGbDXQLInMLvLkxKEclqMU9X5HMXi3tLWLxbWObz1UgtyZha6ocHarQtFp0OjQW9KHVR1g6wbA==",
"dev": true,
"requires": {
- "debug": "^4.0.1"
+ "@kwsites/file-exists": "^1.1.1",
+ "@kwsites/promise-deferred": "^1.1.1",
+ "debug": "^4.1.1"
}
},
"slash": {
@@ -6242,6 +6259,15 @@
"xml2js": "^0.4.23"
},
"dependencies": {
+ "simple-git": {
+ "version": "1.132.0",
+ "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-1.132.0.tgz",
+ "integrity": "sha512-xauHm1YqCTom1sC9eOjfq3/9RKiUA9iPnxBbrY2DdL8l4ADMu0jjM5l5lphQP5YWNqAL2aXC/OeuQ76vHtW5fg==",
+ "dev": true,
+ "requires": {
+ "debug": "^4.0.1"
+ }
+ },
"through2": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz",
diff --git a/package.json b/package.json
index b4999d831..09ab351c6 100644
--- a/package.json
+++ b/package.json
@@ -11,8 +11,9 @@
"build-site": "run-s \"zarro build-site\"",
"prepare-build-artifacts": "run-s \"zarro prepare-build-artifacts\"",
"dump-env": "node -e \"console.log(process.env);\"",
- "release": "run-s build-release prepare-build-artifacts build-site",
- "zarro": "cross-env BUILD_INCLUDE=src/log4net.sln zarro"
+ "release": "run-s update-version-info build-release prepare-build-artifacts build-site",
+ "zarro": "cross-env BUILD_INCLUDE=src/log4net.sln zarro",
+ "update-version-info": "run-s \"zarro update-version-info\""
},
"repository": {
"type": "git",
@@ -29,6 +30,7 @@
"gulp-zip": "^5.0.1",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
+ "simple-git": "^2.20.1",
"which": "^2.0.2",
"yafs": "^1.5.0",
"zarro": "^1.78.0"
diff --git a/src/log4net/AssemblyInfo.cs b/src/log4net/AssemblyInfo.cs
index 2e33cb7b5..5264ed2a1 100644
--- a/src/log4net/AssemblyInfo.cs
+++ b/src/log4net/AssemblyInfo.cs
@@ -54,77 +54,77 @@
//
#if (CLI_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.CLI 1.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.CLI 1.0")]
[assembly: AssemblyTitle("Apache log4net for CLI 1.0 Compatible Frameworks")]
#elif (NET_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.NET 1.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET 1.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 1.0")]
#elif (NET_1_1)
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.NET 1.1")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET 1.1")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 1.1")]
#elif (NET_4_5)
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.NET 4.5")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET 4.5")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 4.5")]
#elif (NET_4_0)
#if CLIENT_PROFILE
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.NET 4.0 CP")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET 4.0 CP")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 4.0 Client Profile")]
#else
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.NET 4.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.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.9.0-.NET 3.5 CP")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET 3.5 CP")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 3.5 Client Profile")]
#else
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.NET 3.5")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET 3.5")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 3.5")]
#endif // Client Profile
#elif (NET_2_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.NET 2.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET 2.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 2.0")]
#elif (NETCF_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.NETCF 1.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NETCF 1.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Compact Framework 1.0")]
#elif (NETCF_2_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.NETCF 2.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NETCF 2.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Compact Framework 2.0")]
#elif (MONO_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-Mono 1.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-Mono 1.0")]
[assembly: AssemblyTitle("Apache log4net for Mono 1.0")]
#elif (MONO_2_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-Mono 2.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-Mono 2.0")]
[assembly: AssemblyTitle("Apache log4net for Mono 2.0")]
#elif (MONO_3_5)
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-Mono 3.5")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-Mono 3.5")]
[assembly: AssemblyTitle("Apache log4net for Mono 3.5")]
#elif (MONO_4_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-Mono 4.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-Mono 4.0")]
[assembly: AssemblyTitle("Apache log4net for Mono 4.0")]
#elif (SSCLI_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-SSCLI 1.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-SSCLI 1.0")]
[assembly: AssemblyTitle("Apache log4net for Shared Source CLI 1.0")]
#elif (NET)
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.NET")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework")]
#elif (NETSTANDARD1_3)
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.NET Standard 1.3")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET Standard 1.3")]
[assembly: AssemblyTitle("Apache log4net for .NET Standard 1.3")]
#elif (NETSTANDARD2_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.NET Standard 2.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NET Standard 2.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Standard 2.0")]
#elif (NETCF)
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-.NETCF")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-.NETCF")]
[assembly: AssemblyTitle("Apache log4net for .NET Compact Framework")]
#elif (MONO)
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-Mono")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-Mono")]
[assembly: AssemblyTitle("Apache log4net for Mono")]
#elif (SSCLI)
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0-SSCLI")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0-SSCLI")]
[assembly: AssemblyTitle("Apache log4net for Shared Source CLI")]
#else
-[assembly: AssemblyInformationalVersionAttribute("2.0.9.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.11.0")]
[assembly: AssemblyTitle("Apache log4net")]
#endif
diff --git a/src/log4net/AssemblyVersionInfo.cpp b/src/log4net/AssemblyVersionInfo.cpp
deleted file mode 100644
index 8e1dedee9..000000000
--- a/src/log4net/AssemblyVersionInfo.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#using
-
-using namespace System::Reflection;
-using namespace System::Runtime::CompilerServices;
-
-//
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the value or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-
-[assembly: AssemblyVersionAttribute("2.0.9.0")];
-
-#if !NETCF
-#if !SSCLI
-[assembly: AssemblyFileVersionAttribute("2.0.9.0")]
-#endif
-#endif
-
-//
-// Shared assembly settings
-//
-
-[assembly: AssemblyCompany("The Apache Software Foundation")];
-[assembly: AssemblyCopyright("Copyright 2004-2017 The Apache Software Foundation.")];
-[assembly: AssemblyTrademark("Apache and Apache log4net are trademarks of The Apache Software Foundation")];
diff --git a/src/log4net/AssemblyVersionInfo.js b/src/log4net/AssemblyVersionInfo.js
deleted file mode 100644
index ed8178565..000000000
--- a/src/log4net/AssemblyVersionInfo.js
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to you under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-
-//
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-
-// JScript.NET doesn't handle files with only custom attributes very well, adding
-// an import functions as a workaround for this issue.
-import System.Reflection;
-
-[assembly: AssemblyVersion("2.0.9.0")]
-[assembly: AssemblyInformationalVersionAttribute("1.2")]
-
-@if (!@NETCF)
-@if (!@SSCLI)
-[assembly: AssemblyFileVersion("2.0.9.0")]
-@end
-@end
-
-//
-// Shared assembly settings
-//
-
-[assembly: AssemblyCompany("The Apache Software Foundation")]
-[assembly: AssemblyCopyright("Copyright 2004-2017 The Apache Software Foundation.")]
-[assembly: AssemblyTrademark("Apache and Apache log4net are trademarks of The Apache Software Foundation")]
diff --git a/src/log4net/AssemblyVersionInfo.vb b/src/log4net/AssemblyVersionInfo.vb
deleted file mode 100644
index 8e6709ec3..000000000
--- a/src/log4net/AssemblyVersionInfo.vb
+++ /dev/null
@@ -1,46 +0,0 @@
-#Region "Apache License"
-'
-' Licensed to the Apache Software Foundation (ASF) under one or more
-' contributor license agreements. See the NOTICE file distributed with
-' this work for additional information regarding copyright ownership.
-' The ASF licenses this file to you under the Apache License, Version 2.0
-' (the "License"); you may not use this file except in compliance with
-' the License. You may obtain a copy of the License at
-'
-' http://www.apache.org/licenses/LICENSE-2.0
-'
-' Unless required by applicable law or agreed to in writing, software
-' distributed under the License is distributed on an "AS IS" BASIS,
-' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-' See the License for the specific language governing permissions and
-' limitations under the License.
-'
-#End Region
-
-'
-' Version information for an assembly consists of the following four values:
-'
-' Major Version
-' Minor Version
-' Build Number
-' Revision
-'
-' You can specify all the values or you can default the Revision and Build Numbers
-' by using the '*' as shown below:
-
-
-
-
-#If NOT NETCF Then
-#If NOT SSCLI Then
-
-#End If
-#End If
-
-'
-' Shared assembly settings
-'
-
-
-
-
diff --git a/src/log4net/log4net.csproj b/src/log4net/log4net.csproj
index 309039c4d..5b8999169 100644
--- a/src/log4net/log4net.csproj
+++ b/src/log4net/log4net.csproj
@@ -1,7 +1,7 @@
log4net
- 2.0.10
+ 2.0.11Codestin Search AppApache log4net
From d8808ec5acab2cfe294f38b6891d5f6f29bd9095 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Fri, 18 Sep 2020 13:43:40 +0200
Subject: [PATCH 007/122] :bookmark: update versioning to 2.0.11.0
---
src/log4net/AssemblyVersionInfo.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/log4net/AssemblyVersionInfo.cs b/src/log4net/AssemblyVersionInfo.cs
index 668df06b0..0b62aa9cf 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.9.0")]
+[assembly: System.Reflection.AssemblyVersion("2.0.11.0")]
#if !NETCF
#if !SSCLI
-[assembly: System.Reflection.AssemblyFileVersion("2.0.9.0")]
+[assembly: System.Reflection.AssemblyFileVersion("2.0.11.0")]
#endif
#endif
From d5cb2074691c5da552450ba0e83667a054f7fe70 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Fri, 18 Sep 2020 13:47:05 +0200
Subject: [PATCH 008/122] :memo: add documentation about proposed 2.0.11
release
---
src/site/xdoc/download_log4net.xml | 20 ++++++++++----------
src/site/xdoc/release/release-notes.xml | 5 +++++
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/site/xdoc/download_log4net.xml b/src/site/xdoc/download_log4net.xml
index 5aa7ac5fa..71c6679f2 100644
--- a/src/site/xdoc/download_log4net.xml
+++ b/src/site/xdoc/download_log4net.xml
@@ -36,14 +36,14 @@ limitations under the License.
-
+
diff --git a/src/site/xdoc/release/release-notes.xml b/src/site/xdoc/release/release-notes.xml
index 58f3707d8..fac995aee 100644
--- a/src/site/xdoc/release/release-notes.xml
+++ b/src/site/xdoc/release/release-notes.xml
@@ -27,6 +27,11 @@ limitations under the License.
+
+ Apachhe 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
+
///
- 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 44fb69047..44b68c755 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 a8e3f5229..bffa0459e 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 91b49f451..c49d83823 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 17d02b894..20c362411 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 d3949708e..cbcc8757f 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 d5d6a7027..760aace42 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 b4f329579..c1eda997b 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 0784cbff6..0d1f3c89c 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 f0c2bc1f8..dbade37f7 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 681f81253..20a99ccc6 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 13efc54f6..ad31b5dfe 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 9efe65d0b..9edfce509 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 e0ec74132..441569ce2 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 a72076f00..b03d21d66 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 f010fd586..1a13512b0 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 a70bb5648..675d6f970 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 f4fa6f1fd..7c095f89c 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 9da3fb85e..b5bf2532e 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 bbe8bd51a..98b6bb617 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 b9a97ef9d..17a6af4ee 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 b117ca03a..0d61a002c 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 94826073b..6eb943ccd 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 18dd480bf..8e6cb7f3c 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 99a6a8c6b..e2cafe49c 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/Config/BasicConfigurator.cs b/src/log4net/Config/BasicConfigurator.cs
index 4f0ee650e..374cf72bf 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 fd8eeb448..2dd16d84c 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 67bbc08b2..b66297254 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 c6f85572f..7698c1be5 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 cd9ebfea9..ce37d2d39 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 6c3ea3e36..b5cc702fc 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 dd46f6d59..b1b2805d1 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 ce399217b..2cc84d267 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 713918dd0..767d03eee 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 d8ae92bd1..d364f9dc4 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 64c2edf98..f997ac36a 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 52b6c7b29..98a2fe8ea 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 fff496d0b..26f016dfc 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 0c733006c..c09937a31 100644
--- a/src/log4net/Core/LoggingEvent.cs
+++ b/src/log4net/Core/LoggingEvent.cs
@@ -328,7 +328,7 @@ public class LoggingEvent
: ISerializable
#endif
{
- private readonly static Type declaringType = typeof(LoggingEvent);
+ private static readonly Type declaringType = typeof(LoggingEvent);
#region Public Instance Constructors
diff --git a/src/log4net/Core/MethodItem.cs b/src/log4net/Core/MethodItem.cs
index e2ff3c392..6d3ca1984 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 83f035146..17193260d 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 a43a8b8db..d4f5b257f 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 11741073f..c6333038d 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 03dcca954..7411206c4 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 a7e88d551..524c8a796 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 c112ca1ab..3efb1643d 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 e17a16fff..ab377f1eb 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 9cc24d807..293d3ca5d 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 2d3465a2a..34a21b3fb 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 9afc03a15..f6e0be00c 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 828a304e3..28264ec13 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 8c35c7fed..a74a03b0a 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 38fa49d40..840a95d0e 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 dd02a90cf..222b90c8e 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 06c4509bc..90217077f 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 494578418..9b92bf46a 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 afae60e7b..1f26c8e61 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 37369c4f6..30b7f0968 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 72d3df1ab..c283ba1f0 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 7ab88d00e..009130496 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 bcec221e6..d555c61cd 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 2a3bedab7..ac5dab668 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 fd84299e0..0ef245c09 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 35227e061..21af92b1e 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 2e54dfaef..07c91e8a2 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 b56f7c9de..471b4aa25 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 43d13fe75..cf0f5afc7 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 a0537adfe..90fa7559c 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 8338706e1..d94a9c810 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 947fb129e..572168145 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 f0ed36f35..b805b395d 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 f2d9e3724..44a096b92 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 a5d3495b3..01b9ae2b8 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 47be2dcdd..9e020cb38 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 de67e63ca..7773868d2 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 c306a3733..122c361e6 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 acca1cb34..8b5fce81a 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 8c0518f52..1f64c0cbd 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 41caf288b..95227f75d 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 6e49bfddb..49cad595d 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 b330ee7a5..5efe0d08d 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 61e366edf..66b7dcf8f 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 c046bc013..2f35f8b75 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 b47910225..fe66d5974 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 da99eb1dc..937f952c8 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 666dfda46..c785e27ee 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 7305ef5db..ff5824bb2 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 0f4138f15..c21d09af4 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 c7a081dc7..839e688de 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 ccc566b1b..14854172f 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 e178bb718..8184e3f0d 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 d2e53eeeb..bc2561d5c 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 e4f06f85d..9a2a69c1d 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 9d668f7f6..4da972ca5 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 fafb0b8f2..35080487f 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 aa2947ab8..e0c2925ba 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 ad5f1d87f..122258770 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 2c9192da9..792a781c7 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 b6431077c..0c1999599 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 9aa6a612d..fa52c28eb 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 bfed35b93..1a3975bef 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 519efe437..179c22b8d 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 3eccfca27..7d4a22534 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 e4564c8a3..48af424e8 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 614d616be..4cb78060f 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 806296298..5f03d9290 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 c304f18eb..776bcc252 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 7b3339576..9f9067b10 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 bfe44526b..7dfbb326b 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 72d9ba921..c7d924b98 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 9b110022b..9a20d652c 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 dad04c6ed..75d5fb023 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 6def66f29..40ffd779e 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 93028a02e..bd8d4b59f 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 7361f9925..70851298d 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 d92a292b2..f3ee86053 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 b40925a06..3f3e24208 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 2dfd0cbc0..fbb796d86 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 e78611b09..bf81f2aa5 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 dc11de952..015cfd7fc 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 68aad1a9a..9cc69fd93 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 a2bf590d6..31d5f7f1a 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 a4dc6c46c..e70fb2039 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 cd610e2e3..a90f283ff 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 81629b792..6f3c757bf 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 051c1b208..92e2c60cd 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 21860bda7..cd71c03b9 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 e098dad6d..851eac487 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 170608522..e002c1be5 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 3fffb05a5..0e9c19805 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 597ae9fdf..e20bbd528 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 de98511e1..6fac8ccb0 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
From 1a1f9fad9133177aae661e74730e1c602dc0e470 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Wed, 30 Sep 2020 08:50:23 +0200
Subject: [PATCH 010/122] :bug: should not fail when platform does not support
fetching windows user name
---
src/log4net/Core/LoggingEvent.cs | 3040 +++++++++++++++---------------
1 file changed, 1538 insertions(+), 1502 deletions(-)
diff --git a/src/log4net/Core/LoggingEvent.cs b/src/log4net/Core/LoggingEvent.cs
index c09937a31..665700ef5 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 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
+ {
+ 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,1049 @@ 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();
+
+ 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)
+ {
+ // TODO: on a platform which supports it, invoke `whoami`
+ return SystemInfo.NotAvailableText;
+ }
+ 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. Empty user name."
+ );
+
+ return SystemInfo.NotAvailableText;
+ }
+#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
From fa0cd5b7005edde6e6e1932c9d5c3b7955dbd27f Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Wed, 30 Sep 2020 08:50:43 +0200
Subject: [PATCH 011/122] :construction: let's get this building a subset
x-platform so we can test x-platform
---
package.json | 1 +
src/Directory.Build.props | 5 +++++
src/MonoForFramework.targets | 28 ++++++++++++++++++++++++++
src/log4net.Tests/log4net.Tests.csproj | 6 ++++++
src/log4net.sln | 5 +++++
src/log4net/log4net.csproj | 16 +++++++++++++--
6 files changed, 59 insertions(+), 2 deletions(-)
create mode 100644 src/Directory.Build.props
create mode 100644 src/MonoForFramework.targets
diff --git a/package.json b/package.json
index 09ab351c6..2a41426be 100644
--- a/package.json
+++ b/package.json
@@ -4,6 +4,7 @@
"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": "cross-env DOTNET_CORE=1 BUILD_CONFIGURATION=CrossPlatform run-s build run-dotnet-core-tests",
"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\"",
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
new file mode 100644
index 000000000..41fa9c90a
--- /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 000000000..4209d58f0
--- /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/log4net.Tests.csproj b/src/log4net.Tests/log4net.Tests.csproj
index 6af4bf905..a15acca10 100644
--- a/src/log4net.Tests/log4net.Tests.csproj
+++ b/src/log4net.Tests/log4net.Tests.csproj
@@ -27,6 +27,8 @@
true..\..\log4net.snkbin\$(Configuration)
+ Debug;Release;CrossPlatform
+ AnyCPU285212672
@@ -60,6 +62,10 @@
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/src/log4net.sln b/src/log4net.sln
index e6e792800..c08c55c2d 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/log4net.csproj b/src/log4net/log4net.csproj
index 5b8999169..65a98283a 100644
--- a/src/log4net/log4net.csproj
+++ b/src/log4net/log4net.csproj
@@ -21,10 +21,16 @@
githttps://github.com/apache/logging-log4netfalse
+ AnyCPU
-
+ net20;net35;net35-client;net40;net40-client;net45;netstandard1.3;netstandard2.0
- Debug;Release
+
+
+ net20;net35;net40;net45;netstandard1.3;netstandard2.0
+
+
+ Debug;Release;CrossPlatformlatestlog4netlog4net
@@ -184,5 +190,11 @@
package-icon.png
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
From 31c577e0077c29cc7ddeb540d03cfa09bf02b7c5 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Sat, 12 Sep 2020 18:18:27 +0200
Subject: [PATCH 012/122] :ambulance: retroactively fix up site source doap
file
---
src/site/resources/doap_log4net.rdf | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/site/resources/doap_log4net.rdf b/src/site/resources/doap_log4net.rdf
index 7f38fdf6d..acdb96952 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
+
+
From 9e3b1d182a53d8ff6e9f043416dd36119c73d0d2 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Wed, 30 Sep 2020 19:20:37 +0200
Subject: [PATCH 013/122] :memo: add documentation about building with docker
---
BUILDING.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/BUILDING.md b/BUILDING.md
index f8de5e2cf..2330e8cfb 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.
From 141b00bbf32f8e054d804fc5e61657ebef7464b3 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Wed, 30 Sep 2020 19:41:22 +0200
Subject: [PATCH 014/122] :tada: build-xplatform works; now to get tests
running...
---
package.json | 3 ++-
src/log4net.Tests/log4net.Tests.csproj | 3 ++-
src/log4net/log4net.csproj | 3 ++-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/package.json b/package.json
index 2a41426be..0997123df 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,8 @@
"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": "cross-env DOTNET_CORE=1 BUILD_CONFIGURATION=CrossPlatform run-s build 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\"",
diff --git a/src/log4net.Tests/log4net.Tests.csproj b/src/log4net.Tests/log4net.Tests.csproj
index a15acca10..7da2aaf42 100644
--- a/src/log4net.Tests/log4net.Tests.csproj
+++ b/src/log4net.Tests/log4net.Tests.csproj
@@ -88,4 +88,5 @@
-
\ No newline at end of file
+
+
diff --git a/src/log4net/log4net.csproj b/src/log4net/log4net.csproj
index 65a98283a..0063fce52 100644
--- a/src/log4net/log4net.csproj
+++ b/src/log4net/log4net.csproj
@@ -27,7 +27,7 @@
net20;net35;net35-client;net40;net40-client;net45;netstandard1.3;netstandard2.0
- net20;net35;net40;net45;netstandard1.3;netstandard2.0
+ net40;net45;netstandard1.3;netstandard2.0Debug;Release;CrossPlatform
@@ -197,4 +197,5 @@
+
From e137855bdca5ed1a361c361846381607a5568d60 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Sun, 18 Oct 2020 17:19:10 +0200
Subject: [PATCH 015/122] :bug: should fall back on Environment.UserName if
!win32
---
src/log4net/Core/LoggingEvent.cs | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/log4net/Core/LoggingEvent.cs b/src/log4net/Core/LoggingEvent.cs
index 665700ef5..02eed28e9 100644
--- a/src/log4net/Core/LoggingEvent.cs
+++ b/src/log4net/Core/LoggingEvent.cs
@@ -914,7 +914,7 @@ public string ThreadName
///
///
public string UserName =>
- m_data.UserName ??= TryGetCurrentUserName();
+ m_data.UserName ??= TryGetCurrentUserName() ?? SystemInfo.NotAvailableText;
private static string TryGetCurrentUserName()
{
@@ -929,8 +929,7 @@ private static string TryGetCurrentUserName()
}
catch (PlatformNotSupportedException)
{
- // TODO: on a platform which supports it, invoke `whoami`
- return SystemInfo.NotAvailableText;
+ return Environment.UserName;
}
catch (SecurityException)
{
@@ -940,12 +939,15 @@ private static string TryGetCurrentUserName()
declaringType,
"Security exception while trying to get current windows identity. Error Ignored. Empty user name."
);
-
- return SystemInfo.NotAvailableText;
+ return null;
+ }
+ catch
+ {
+ return null;
}
#endif
}
-
+
///
/// Gets the identity of the current thread principal.
///
From bf81ef2a3746585efa30582fe784a513c678e91a Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Sun, 18 Oct 2020 17:21:12 +0200
Subject: [PATCH 016/122] :bookmark: update versioning to 2.0.12.0
---
src/log4net/AssemblyInfo.cs | 46 +++++++++++++++---------------
src/log4net/AssemblyVersionInfo.cs | 4 +--
2 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/src/log4net/AssemblyInfo.cs b/src/log4net/AssemblyInfo.cs
index 5264ed2a1..9539a78e7 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 0b62aa9cf..1bde4670e 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
From 47aaf46d5f031ea29d781bac4617bd1bb9446215 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Sun, 18 Oct 2020 17:23:48 +0200
Subject: [PATCH 017/122] :bookmark: bump version to 2.0.12, fixes
LOG4NET-(652|653)
---
package.json | 2 +-
src/log4net/Core/LoggingEvent.cs | 4 ++--
src/log4net/log4net.csproj | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/package.json b/package.json
index 0997123df..26b60ccda 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"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",
diff --git a/src/log4net/Core/LoggingEvent.cs b/src/log4net/Core/LoggingEvent.cs
index 02eed28e9..878fbf7f7 100644
--- a/src/log4net/Core/LoggingEvent.cs
+++ b/src/log4net/Core/LoggingEvent.cs
@@ -937,9 +937,9 @@ private static string TryGetCurrentUserName()
// some undefined set of SecurityPermission flags.
LogLog.Debug(
declaringType,
- "Security exception while trying to get current windows identity. Error Ignored. Empty user name."
+ "Security exception while trying to get current windows identity. Error Ignored."
);
- return null;
+ return Environment.UserName;
}
catch
{
diff --git a/src/log4net/log4net.csproj b/src/log4net/log4net.csproj
index 0063fce52..263ed6505 100644
--- a/src/log4net/log4net.csproj
+++ b/src/log4net/log4net.csproj
@@ -1,7 +1,7 @@
log4net
- 2.0.11
+ 2.0.12Codestin Search AppApache log4net
From c306c28539e7b05c06d122b4cbea2c4dd385cf8d Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Sun, 18 Oct 2020 17:45:34 +0200
Subject: [PATCH 018/122] :memo: update docs for site
---
src/site/xdoc/download_log4net.xml | 20 ++++++++++----------
src/site/xdoc/release/release-notes.xml | 18 +++++++++++++++++-
2 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/src/site/xdoc/download_log4net.xml b/src/site/xdoc/download_log4net.xml
index 71c6679f2..a669bda90 100644
--- a/src/site/xdoc/download_log4net.xml
+++ b/src/site/xdoc/download_log4net.xml
@@ -36,14 +36,14 @@ limitations under the License.
-
+
diff --git a/src/site/xdoc/release/release-notes.xml b/src/site/xdoc/release/release-notes.xml
index fac995aee..87b199f5c 100644
--- a/src/site/xdoc/release/release-notes.xml
+++ b/src/site/xdoc/release/release-notes.xml
@@ -27,8 +27,24 @@ 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
From ea3535a7fa31181a6d7bd74786ba03d9ac8ec7f8 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Sun, 18 Oct 2020 17:53:48 +0200
Subject: [PATCH 019/122] :memo: update references to jira issues to be links
---
src/site/xdoc/release/release-notes.xml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/site/xdoc/release/release-notes.xml b/src/site/xdoc/release/release-notes.xml
index 87b199f5c..f6e28e4de 100644
--- a/src/site/xdoc/release/release-notes.xml
+++ b/src/site/xdoc/release/release-notes.xml
@@ -34,7 +34,9 @@ limitations under the License.
-
Addresses the issues reported in LOG4NET-652 and LOG4NET-653 whereby
+
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
From dbad144815221ffe4ed85efa73134583253dc75b Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Mon, 19 Oct 2020 08:45:12 +0200
Subject: [PATCH 020/122] :arrow_up: upgrade gulp-zip so that generated zip
artifacts are properly unzippable on !win32
---
package-lock.json | 21 +++++++++++----------
package.json | 2 +-
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 5368c2fd6..e02ddb9ee 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 26b60ccda..b535be677 100644
--- a/package.json
+++ b/package.json
@@ -29,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",
From 634ffca956045cc25a8f072ca0fd05c49228a70a Mon Sep 17 00:00:00 2001
From: Tsar Nikolay
Date: Mon, 7 Dec 2020 19:28:08 +0500
Subject: [PATCH 021/122] Fix AdoNetAppender using npgsql
---
src/log4net/Appender/AdoNetAppender.cs | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/log4net/Appender/AdoNetAppender.cs b/src/log4net/Appender/AdoNetAppender.cs
index dd9939ba9..2f6edfbb0 100644
--- a/src/log4net/Appender/AdoNetAppender.cs
+++ b/src/log4net/Appender/AdoNetAppender.cs
@@ -553,8 +553,17 @@ protected virtual void SendBuffer(IDbTransaction dbTran, LoggingEvent[] events)
{
dbCmd.Transaction = dbTran;
}
- // prepare the command, which is significantly faster
- dbCmd.Prepare();
+
+ try
+ {
+ // prepare the command, which is significantly faster
+ dbCmd.Prepare();
+ }
+ catch (Exception)
+ {
+ // ignore prepare exceptions as they can happen without affecting actual logging, eg on npgsql
+ }
+
// run for all events
foreach (LoggingEvent e in events)
{
From fb7096905b93b83590bac3e88bc0e806af94a093 Mon Sep 17 00:00:00 2001
From: David Schwartz
Date: Wed, 18 Aug 2021 17:44:33 +0300
Subject: [PATCH 022/122] Update AssemblyInfo to allow net472 web projects use
the netstandard2.0 library
---
src/log4net/AssemblyInfo.cs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/log4net/AssemblyInfo.cs b/src/log4net/AssemblyInfo.cs
index 9539a78e7..21b94e5bf 100644
--- a/src/log4net/AssemblyInfo.cs
+++ b/src/log4net/AssemblyInfo.cs
@@ -39,14 +39,13 @@
[assembly: System.Security.AllowPartiallyTrustedCallers]
#endif
-#if (NET_4_0)
+#if (NET_4_0 || NETSTANDARD2_0)
//
// Allows partial trust applications (e.g. ASP.NET shared hosting) on .NET 4.0 to work
// given our implementation of ISerializable.
//
[assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)]
#endif
-
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
From 318448ef199412cb8f4ce6873b1b8e0eb67be490 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Mon, 25 Oct 2021 15:19:30 +0200
Subject: [PATCH 023/122] :zap: don't attempt to read WindowsIdentity after
PlatformNotSupportedException is caught
---
src/log4net/Core/LoggingEvent.cs | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/src/log4net/Core/LoggingEvent.cs b/src/log4net/Core/LoggingEvent.cs
index 878fbf7f7..72d0c3c82 100644
--- a/src/log4net/Core/LoggingEvent.cs
+++ b/src/log4net/Core/LoggingEvent.cs
@@ -497,15 +497,15 @@ protected LoggingEvent(SerializationInfo info, StreamingContext context)
// 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.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.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.Properties = (PropertiesDictionary)info.GetValue("Properties", typeof(PropertiesDictionary));
m_data.Domain = info.GetString("Domain");
m_data.Identity = info.GetString("Identity");
@@ -914,7 +914,7 @@ public string ThreadName
///
///
public string UserName =>
- m_data.UserName ??= TryGetCurrentUserName() ?? SystemInfo.NotAvailableText;
+ m_data.UserName ??= TryGetCurrentUserName() ?? SystemInfo.NotAvailableText;
private static string TryGetCurrentUserName()
{
@@ -922,6 +922,13 @@ private static string TryGetCurrentUserName()
// On compact framework there's no notion of current Windows user
return SystemInfo.NotAvailableText;
#else
+ if (_platformDoesNotSupportWindowsIdentity)
+ {
+ // we've already received one PlatformNotSupportedException
+ // and it's highly unlikely that will change
+ return Environment.UserName;
+ }
+
try
{
var windowsIdentity = WindowsIdentity.GetCurrent();
@@ -929,6 +936,7 @@ private static string TryGetCurrentUserName()
}
catch (PlatformNotSupportedException)
{
+ _platformDoesNotSupportWindowsIdentity = true;
return Environment.UserName;
}
catch (SecurityException)
@@ -947,7 +955,9 @@ private static string TryGetCurrentUserName()
}
#endif
}
-
+
+ private static bool _platformDoesNotSupportWindowsIdentity;
+
///
/// Gets the identity of the current thread principal.
///
@@ -1338,7 +1348,7 @@ protected void FixVolatileData(FixFlags flags)
m_cacheUpdatable = true;
// determine the flags that we are actually fixing
- var updateFlags = (FixFlags) ((flags ^ m_fixFlags) & flags);
+ var updateFlags = (FixFlags)((flags ^ m_fixFlags) & flags);
if (updateFlags > 0)
{
From 63dd5cb9eb2408e21c45ffb91180500e307999be Mon Sep 17 00:00:00 2001
From: Dariel Marlow
Date: Mon, 16 Apr 2018 12:45:04 -0700
Subject: [PATCH 024/122] Update XmlLayoutSchemaLog4j.cs
Use prefix and ns to play nice with XmlWriter
---
src/log4net/Layout/XmlLayoutSchemaLog4j.cs | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/log4net/Layout/XmlLayoutSchemaLog4j.cs b/src/log4net/Layout/XmlLayoutSchemaLog4j.cs
index fe66d5974..19dde79db 100644
--- a/src/log4net/Layout/XmlLayoutSchemaLog4j.cs
+++ b/src/log4net/Layout/XmlLayoutSchemaLog4j.cs
@@ -172,7 +172,7 @@ protected override void FormatXml(XmlWriter writer, LoggingEvent loggingEvent)
}
// Write the start element
- writer.WriteStartElement("log4j:event");
+ writer.WriteStartElement("log4j", "event", "log4net");
writer.WriteAttributeString("logger", loggingEvent.LoggerName);
// Calculate the timestamp as the number of milliseconds since january 1970
@@ -187,7 +187,7 @@ protected override void FormatXml(XmlWriter writer, LoggingEvent loggingEvent)
writer.WriteAttributeString("thread", loggingEvent.ThreadName);
// Append the message text
- writer.WriteStartElement("log4j:message");
+ writer.WriteStartElement("log4j", "message", "log4net");
Transform.WriteEscapedXmlString(writer, loggingEvent.RenderedMessage,this.InvalidCharReplacement);
writer.WriteEndElement();
@@ -199,7 +199,7 @@ protected override void FormatXml(XmlWriter writer, LoggingEvent loggingEvent)
if (valueStr != null && valueStr.Length > 0)
{
// Append the NDC text
- writer.WriteStartElement("log4j:NDC");
+ writer.WriteStartElement("log4j", "NDC", "log4net");
Transform.WriteEscapedXmlString(writer, valueStr,this.InvalidCharReplacement);
writer.WriteEndElement();
}
@@ -209,10 +209,10 @@ protected override void FormatXml(XmlWriter writer, LoggingEvent loggingEvent)
PropertiesDictionary properties = loggingEvent.GetProperties();
if (properties.Count > 0)
{
- writer.WriteStartElement("log4j:properties");
+ writer.WriteStartElement("log4j", "properties", "log4net");
foreach(System.Collections.DictionaryEntry entry in properties)
{
- writer.WriteStartElement("log4j:data");
+ writer.WriteStartElement("log4j", "data", "log4net");
writer.WriteAttributeString("name", (string)entry.Key);
// Use an ObjectRenderer to convert the object to a string
@@ -228,7 +228,7 @@ protected override void FormatXml(XmlWriter writer, LoggingEvent loggingEvent)
if (exceptionStr != null && exceptionStr.Length > 0)
{
// Append the stack trace line
- writer.WriteStartElement("log4j:throwable");
+ writer.WriteStartElement("log4j", "throwable", "log4net");
Transform.WriteEscapedXmlString(writer, exceptionStr,this.InvalidCharReplacement);
writer.WriteEndElement();
}
@@ -237,7 +237,7 @@ protected override void FormatXml(XmlWriter writer, LoggingEvent loggingEvent)
{
LocationInfo locationInfo = loggingEvent.LocationInformation;
- writer.WriteStartElement("log4j:locationInfo");
+ writer.WriteStartElement("log4j", "locationInfo", "log4net");
writer.WriteAttributeString("class", locationInfo.ClassName);
writer.WriteAttributeString("method", locationInfo.MethodName);
writer.WriteAttributeString("file", locationInfo.FileName);
From afaa96819eba0f93038e5397b5a4529d19a7be17 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Mon, 25 Oct 2021 15:52:56 +0200
Subject: [PATCH 025/122] :wrench: provide different name for rolling mutex
from file mutex (LOG4NET-583)
---
src/log4net/Appender/RollingFileAppender.cs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/log4net/Appender/RollingFileAppender.cs b/src/log4net/Appender/RollingFileAppender.cs
index b5bf2532e..f53dd7888 100644
--- a/src/log4net/Appender/RollingFileAppender.cs
+++ b/src/log4net/Appender/RollingFileAppender.cs
@@ -1160,7 +1160,11 @@ public override void ActivateOptions()
#if !NETCF
// initialize the mutex that is used to lock rolling
- m_mutexForRolling = new Mutex(false, m_baseFileName.Replace("\\", "_").Replace(":", "_").Replace("/", "_"));
+ m_mutexForRolling = new Mutex(false, m_baseFileName
+ .Replace("\\", "_")
+ .Replace(":", "_")
+ .Replace("/", "_") + "_rolling"
+ );
#endif
if (m_rollDate && File != null && m_scheduledFilename == null)
From 26841fdd2c550a5202c38fdf02b75c7207401268 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Mon, 25 Oct 2021 16:00:46 +0200
Subject: [PATCH 026/122] :memo: add docs on 2.0.13 release
---
src/site/xdoc/release/release-notes.xml | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/site/xdoc/release/release-notes.xml b/src/site/xdoc/release/release-notes.xml
index f6e28e4de..9b2a57ce5 100644
--- a/src/site/xdoc/release/release-notes.xml
+++ b/src/site/xdoc/release/release-notes.xml
@@ -27,6 +27,20 @@ limitations under the License.
+
+ Apache log4net 2.0.13 is a minor release to address some reported issues
+ and accept some pull requests provided by community members:
+
+
+
Addresses issue [LOG4NET-583] with proposed solution by Emmo Emminghaus,
+ namely to provide an unique mutex identifier for the file rolling logic.
+
Accepts pull request 76 by @dschwartzni
+ to allow the netstandard2.0 library to be used within net472 web services
+
Accepts pull request 18 by @dmarlow
+ to update the xml layout mimicking log4j
+
+
+
Apache log4net 2.0.12 is a minor fix release to address reported issues on
From 92267c9447a3bb6bb749253428294e2d655970ec Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Mon, 25 Oct 2021 16:05:46 +0200
Subject: [PATCH 027/122] :bookmark: update versioning to 2.0.13.0
---
src/log4net/AssemblyInfo.cs | 46 +++++++++++++++---------------
src/log4net/AssemblyVersionInfo.cs | 4 +--
src/log4net/Core/LoggingEvent.cs | 3 ++
src/log4net/log4net.csproj | 2 +-
4 files changed, 29 insertions(+), 26 deletions(-)
diff --git a/src/log4net/AssemblyInfo.cs b/src/log4net/AssemblyInfo.cs
index 21b94e5bf..f7f47aab0 100644
--- a/src/log4net/AssemblyInfo.cs
+++ b/src/log4net/AssemblyInfo.cs
@@ -53,77 +53,77 @@
//
#if (CLI_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.CLI 1.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-.CLI 1.0")]
[assembly: AssemblyTitle("Apache log4net for CLI 1.0 Compatible Frameworks")]
#elif (NET_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET 1.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-.NET 1.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 1.0")]
#elif (NET_1_1)
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET 1.1")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-.NET 1.1")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 1.1")]
#elif (NET_4_5)
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET 4.5")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-.NET 4.5")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 4.5")]
#elif (NET_4_0)
#if CLIENT_PROFILE
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET 4.0 CP")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-.NET 4.0 CP")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 4.0 Client Profile")]
#else
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET 4.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.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.12.0-.NET 3.5 CP")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-.NET 3.5 CP")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 3.5 Client Profile")]
#else
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET 3.5")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-.NET 3.5")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 3.5")]
#endif // Client Profile
#elif (NET_2_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET 2.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-.NET 2.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 2.0")]
#elif (NETCF_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NETCF 1.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-.NETCF 1.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Compact Framework 1.0")]
#elif (NETCF_2_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NETCF 2.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-.NETCF 2.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Compact Framework 2.0")]
#elif (MONO_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-Mono 1.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-Mono 1.0")]
[assembly: AssemblyTitle("Apache log4net for Mono 1.0")]
#elif (MONO_2_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-Mono 2.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-Mono 2.0")]
[assembly: AssemblyTitle("Apache log4net for Mono 2.0")]
#elif (MONO_3_5)
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-Mono 3.5")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-Mono 3.5")]
[assembly: AssemblyTitle("Apache log4net for Mono 3.5")]
#elif (MONO_4_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-Mono 4.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-Mono 4.0")]
[assembly: AssemblyTitle("Apache log4net for Mono 4.0")]
#elif (SSCLI_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-SSCLI 1.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-SSCLI 1.0")]
[assembly: AssemblyTitle("Apache log4net for Shared Source CLI 1.0")]
#elif (NET)
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-.NET")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework")]
#elif (NETSTANDARD1_3)
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET Standard 1.3")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-.NET Standard 1.3")]
[assembly: AssemblyTitle("Apache log4net for .NET Standard 1.3")]
#elif (NETSTANDARD2_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NET Standard 2.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-.NET Standard 2.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Standard 2.0")]
#elif (NETCF)
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-.NETCF")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-.NETCF")]
[assembly: AssemblyTitle("Apache log4net for .NET Compact Framework")]
#elif (MONO)
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-Mono")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-Mono")]
[assembly: AssemblyTitle("Apache log4net for Mono")]
#elif (SSCLI)
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0-SSCLI")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0-SSCLI")]
[assembly: AssemblyTitle("Apache log4net for Shared Source CLI")]
#else
-[assembly: AssemblyInformationalVersionAttribute("2.0.12.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.13.0")]
[assembly: AssemblyTitle("Apache log4net")]
#endif
diff --git a/src/log4net/AssemblyVersionInfo.cs b/src/log4net/AssemblyVersionInfo.cs
index 1bde4670e..c10b79027 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.12.0")]
+[assembly: System.Reflection.AssemblyVersion("2.0.13.0")]
#if !NETCF
#if !SSCLI
-[assembly: System.Reflection.AssemblyFileVersion("2.0.12.0")]
+[assembly: System.Reflection.AssemblyFileVersion("2.0.13.0")]
#endif
#endif
diff --git a/src/log4net/Core/LoggingEvent.cs b/src/log4net/Core/LoggingEvent.cs
index 72d0c3c82..4ad16f147 100644
--- a/src/log4net/Core/LoggingEvent.cs
+++ b/src/log4net/Core/LoggingEvent.cs
@@ -956,7 +956,10 @@ private static string TryGetCurrentUserName()
#endif
}
+#if (NETCF || SSCLI || NETSTANDARD1_3)
+#else
private static bool _platformDoesNotSupportWindowsIdentity;
+#endif
///
/// Gets the identity of the current thread principal.
diff --git a/src/log4net/log4net.csproj b/src/log4net/log4net.csproj
index 263ed6505..04bd9e2bd 100644
--- a/src/log4net/log4net.csproj
+++ b/src/log4net/log4net.csproj
@@ -1,7 +1,7 @@
log4net
- 2.0.12
+ 2.0.13Codestin Search AppApache log4net
From 2323519abdb9aba7f106e4ad11bba34cc6f18805 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Tue, 26 Oct 2021 09:33:20 +0200
Subject: [PATCH 028/122] :memo: update downloads page
---
src/site/xdoc/download_log4net.xml | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/site/xdoc/download_log4net.xml b/src/site/xdoc/download_log4net.xml
index a669bda90..da0b91efe 100644
--- a/src/site/xdoc/download_log4net.xml
+++ b/src/site/xdoc/download_log4net.xml
@@ -36,14 +36,14 @@ limitations under the License.
diff --git a/src/site/xdoc/release/release-notes.xml b/src/site/xdoc/release/release-notes.xml
index 9b2a57ce5..fe410cef2 100644
--- a/src/site/xdoc/release/release-notes.xml
+++ b/src/site/xdoc/release/release-notes.xml
@@ -27,6 +27,20 @@ limitations under the License.
+
+ Apache log4net 2.0.14 is a minor release to address some reported issues
+ and accept a pull request provided by a community member:
+
+
+
Pull request by @NicholasNoise to address issues with logging via ado appender to PostgreSQL
+
Community request to correctly handle null data in ReadOnlyPropertiesDictionary
+
Pull request by @erikma to use the numeric thread id for .net worker pool threads
+ (LOG4NET-680)
+
Pull request by @erikma to dispose of WindowsIdentity retrieved in TryGetCurrentUserName()
+ (LOG4NET-671)
+
+
+
Apache log4net 2.0.13 is a minor release to address some reported issues
and accept some pull requests provided by community members:
From a64d8848005efdff1de9ffaa8f7d0775b4371c1e Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Thu, 16 Dec 2021 10:09:48 +0200
Subject: [PATCH 038/122] :bookmark: update versioning to 2.0.14.0
---
src/log4net/AssemblyVersionInfo.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/log4net/AssemblyVersionInfo.cs b/src/log4net/AssemblyVersionInfo.cs
index c10b79027..fd0b3defd 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.13.0")]
+[assembly: System.Reflection.AssemblyVersion("2.0.14.0")]
#if !NETCF
#if !SSCLI
-[assembly: System.Reflection.AssemblyFileVersion("2.0.13.0")]
+[assembly: System.Reflection.AssemblyFileVersion("2.0.14.0")]
#endif
#endif
From 107fbc0c8edb1d19b82d1cfe9deb37a84481133c Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Thu, 16 Dec 2021 10:23:25 +0200
Subject: [PATCH 039/122] :truck: move legacy release instructions; whilst
perhaps outdated, there could still be usefulness in here
---
ReleaseInstructions.txt => doc/ReleaseInstructions-legacy.txt | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename ReleaseInstructions.txt => doc/ReleaseInstructions-legacy.txt (100%)
diff --git a/ReleaseInstructions.txt b/doc/ReleaseInstructions-legacy.txt
similarity index 100%
rename from ReleaseInstructions.txt
rename to doc/ReleaseInstructions-legacy.txt
From dfe14c7c8dd344dae7e1136494fc51edba123ef2 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Thu, 16 Dec 2021 10:27:42 +0200
Subject: [PATCH 040/122] :wrench: should exclude executables from source zip
---
local-tasks/zip.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/local-tasks/zip.js b/local-tasks/zip.js
index 1225a21c1..3876fb864 100644
--- a/local-tasks/zip.js
+++ b/local-tasks/zip.js
@@ -40,7 +40,8 @@ gulp.task("zip-source", async () => {
"!build",
"!build/**/*",
"!.idea",
- "!.idea/**/*"
+ "!.idea/**/*",
+ "!*.exe"
])
.pipe(rename(path => {
path.dirname = `${baseDir}/${path.dirname}`
From 3862b3fb61514dea00d2bae2aae78d8e82777557 Mon Sep 17 00:00:00 2001
From: Matt Sicker
Date: Sun, 19 Dec 2021 15:40:16 -0600
Subject: [PATCH 041/122] Update copyright year and https url
---
NOTICE | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/NOTICE b/NOTICE
index 86d4dfedd..35c2b634c 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
Apache log4net
- Copyright 2004-2017 The Apache Software Foundation
+ Copyright 2004-2021 The Apache Software Foundation
This product includes software developed at
- The Apache Software Foundation (http://www.apache.org/).
+ The Apache Software Foundation (https://www.apache.org/).
From b154a78d9f977dbc7234e8619cebcef75ba3c443 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Fri, 31 Dec 2021 15:39:54 +0200
Subject: [PATCH 042/122] :memo: update release docs for post-vote process
---
doc/RELEASING.md | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/doc/RELEASING.md b/doc/RELEASING.md
index 584bf5cca..4858d5217 100644
--- a/doc/RELEASING.md
+++ b/doc/RELEASING.md
@@ -55,11 +55,22 @@ release version 2.0.123:
11. create an rc-releasd at GitHub with a tag like `rc/2.0.123-rc1`
- attach all the files from the build/artifacts folder, _including signatures_
12. get the artifacts in build/artifacts up to https://downloads.apache.org/logging/log4net/
- - currently, I have to as another ASF member for help with this
- - I also see release notes there - which are out of date (don't know how to update)
+ - `svn co https://dist.apache.org/repos/dist/dev/logging -N apache-dist-logging-dev`
+ - `cd apache-dist-logging-dev`
+ - `svn up log4net`
+ - copy in source & binary artifacts to respective locations
+ - `svn delete` old items
+ - `svn commit`
13. raise a vote on the log4net mailing list (dev@logging.apache.org)
14. wait
15. when the vote has 3 or more +1's, it's time to go live!
+16. copy the apache artifacts (binary and source) to the release svn repo and commit
+ - `svn co https://dist.apache.org/repos/dist/release/logging -N apache-dist-logging-release`
+ - `cd apache-dist-logging-release`
+ - `svn up log4net`
+ - copy in source & binary artifacts to respective locations
+ - `svn delete` old items
+ - `svn commit`
16. push the .nupkg to nuget.org
17. don't forget to make the docs live: in the logging-log4net-site folder:
- `git checkout asf-site`
From e817e2a06ca8d7f738965b4804e22c2a7f874a31 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Fri, 31 Dec 2021 15:52:52 +0200
Subject: [PATCH 043/122] :bug: :memo: should mention 2.0.14, not 2.0.13
---
src/site/xdoc/download_log4net.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/site/xdoc/download_log4net.xml b/src/site/xdoc/download_log4net.xml
index ccc7f2fcf..0ce385268 100644
--- a/src/site/xdoc/download_log4net.xml
+++ b/src/site/xdoc/download_log4net.xml
@@ -36,7 +36,7 @@ limitations under the License.
-
+
The configuration of the AdoNetAppender depends on the
@@ -476,6 +477,17 @@ CREATE TABLE Log (
+
+
]]>
@@ -572,6 +584,10 @@ CREATE TABLE Log (
For full details see the SDK Reference entry: log4net.Appender.EventLogAppender.
+ Please note that this appender is not natively available in log4net for dotnet standard, as
+ it would bring in windows dependencies for non-windows consumers. Please see
+ https://www.nuget.org/packages/log4net.appenders.netcore
+ for an alternative if you still require EventLog logging for netstandard targets.
The following example shows how to configure the EventLogAppender to log
@@ -805,6 +821,7 @@ CREATE TABLE Log (
The SmtpPickupDirAppender is configured similarly
diff --git a/src/site/xdoc/release/release-notes.xml b/src/site/xdoc/release/release-notes.xml
index fe410cef2..08018c764 100644
--- a/src/site/xdoc/release/release-notes.xml
+++ b/src/site/xdoc/release/release-notes.xml
@@ -27,6 +27,33 @@ limitations under the License.
+
+ Attention: .NET 3.5 Client Profile is no longer supported. I'm really sorry, I've tried
+ to keep as many of the legacy targets available as possible, but after spending another 4 or so
+ hours trying to get net35-client to build on any machine, I've given up - as far as I'm aware,
+ this should only affect Windows XP clients. I'm afraid 2.0.14 was the end of the road for you.
+
+ Apache log4net 2.0.15 addresses reported issues:
+
+
+
Improper usage of xml namespacing for netfx targets after a netstandard update (
+ LOG4NET-685,
+ related LOG4NET-683)
+
Locking hashtables during write in RenderMap calls to make them thread-safe (
+ LOG4NET-646)
+
An issue where RollingFilAppender would sometimes overwrite files instead of rolling them (
+ LOG4NET-672)
Add information about FixFlags and performance to the BufferingAppender (and derivative) documentation
+
+
+
Apache log4net 2.0.14 is a minor release to address some reported issues
and accept a pull request provided by a community member:
From 95e0e30cdb7a8225844308ecdbe1755826b943ab Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Mon, 25 Jul 2022 09:14:57 +0200
Subject: [PATCH 073/122] :memo: add more notes to release docs
---
doc/RELEASING.md | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/doc/RELEASING.md b/doc/RELEASING.md
index 4858d5217..77434e9ef 100644
--- a/doc/RELEASING.md
+++ b/doc/RELEASING.md
@@ -30,6 +30,10 @@ release version 2.0.123:
- currently, this _must_ happen on a windows machine because of older
.net framework requirements which cannot be met on a Linux machine
(or at least, I haven't figured out how - in particular CF)
+ - TODO: the following are still manual and need to be built into the `release` script:
+ - log4net.build: update package.version property
+ - log4net.shfbproj: update HtmlHelpName
+ - pom.xml: update version
4. Sign release artifacts (zips & nupkg) under `build/artifacts`
- eg `gpg --argmor --output log4net-2.0.123.nupkg.asc --detach-sig log4net-2.0.123.nupkg`
- there is an accompanying `sign-log4net-libraries.sh` which you could invoke if you cd
@@ -40,6 +44,7 @@ release version 2.0.123:
- check out the `asf-staging` branch
- create a folder which includes the version, eg `log4net-2.0.123`
6. Copy the contents of `target/site` from this repo into the folder created in (5)
+ - remember to either update or link in sdk docs from a prior release
7. Update the symlinks in the base of the docs repo, ie:
- 2.0.x -> 2.0.123
- 2.x -> 2.0.123
From d29c8f2557a09a1c5a0ae0a066fd9cd88783eec7 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Mon, 25 Jul 2022 09:42:34 +0200
Subject: [PATCH 074/122] :memo: minor update to release docs
---
doc/RELEASING.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/RELEASING.md b/doc/RELEASING.md
index 77434e9ef..1caf52e39 100644
--- a/doc/RELEASING.md
+++ b/doc/RELEASING.md
@@ -64,7 +64,7 @@ release version 2.0.123:
- `cd apache-dist-logging-dev`
- `svn up log4net`
- copy in source & binary artifacts to respective locations
- - `svn delete` old items
+ - `svn delete` old items (or defer this until after the vote completes)
- `svn commit`
13. raise a vote on the log4net mailing list (dev@logging.apache.org)
14. wait
From f1a28ff534cc4d68adac208ca802e04adbe4d939 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Mon, 25 Jul 2022 08:52:30 +0200
Subject: [PATCH 075/122] :package: bump version numbers
---
log4net.build | 2 +-
log4net.shfbproj | 2 +-
pom.xml | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/log4net.build b/log4net.build
index 230d6a80b..0bb50afd0 100644
--- a/log4net.build
+++ b/log4net.build
@@ -20,7 +20,7 @@ limitations under the License.
-
+
diff --git a/log4net.shfbproj b/log4net.shfbproj
index 7f91938ab..d8e22eb66 100644
--- a/log4net.shfbproj
+++ b/log4net.shfbproj
@@ -33,7 +33,7 @@ limitations under the License.
.NET Framework 3.5doc\sdk\net\4.0\
- log4net-sdk-2.0.9
+ log4net-sdk-2.0.15en-USStandardBlank
diff --git a/pom.xml b/pom.xml
index 36c4c2b49..86918c59e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
log4netapache-log4netpom
- 2.0.9-SNAPSHOT
+ 2.0.15Apache log4netLogging framework for Microsoft .NET Framework.http://logging.apache.org/log4net/
From 3495ffbf819d6ec262e54efc23c9a80eda842aab Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Mon, 25 Jul 2022 09:32:56 +0200
Subject: [PATCH 076/122] :memo: update copyright date in NOTICE
---
NOTICE | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/NOTICE b/NOTICE
index 35c2b634c..468a2f549 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
Apache log4net
- Copyright 2004-2021 The Apache Software Foundation
+ Copyright 2004-2022 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (https://www.apache.org/).
From 7a1a5f0e297404105bc9bc7072eebe8b24695e7f Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Mon, 25 Jul 2022 09:38:27 +0200
Subject: [PATCH 077/122] :memo: add apache license headers
---
build-with-docker-for-windows.bat | 17 +++++++++++++++++
install-dotnet-core-sdk-1.1.ps1 | 17 +++++++++++++++++
install-net-framework-sdk-3.5.ps1 | 17 +++++++++++++++++
local-tasks/build-site.js | 17 +++++++++++++++++
local-tasks/hash-build-artifacts.js | 17 +++++++++++++++++
local-tasks/prefix-build-artifacts.js | 19 ++++++++++++++++++-
local-tasks/prepare-build-artifacts.js | 17 +++++++++++++++++
local-tasks/update-version-info.js | 17 +++++++++++++++++
local-tasks/zip.js | 17 +++++++++++++++++
old-log4net.snk.gpg | Bin 2535 -> 0 bytes
10 files changed, 154 insertions(+), 1 deletion(-)
delete mode 100644 old-log4net.snk.gpg
diff --git a/build-with-docker-for-windows.bat b/build-with-docker-for-windows.bat
index a5cdf9c10..9db90c95f 100644
--- a/build-with-docker-for-windows.bat
+++ b/build-with-docker-for-windows.bat
@@ -1 +1,18 @@
+rem Licensed to the Apache Software Foundation (ASF) under one
+rem or more contributor license agreements. See the NOTICE file
+rem distributed with this work for additional information
+rem regarding copyright ownership. The ASF licenses this file
+rem to you under the Apache License, Version 2.0 (the
+rem "License"); you may not use this file except in compliance
+rem with the License. You may obtain a copy of the License at
+rem
+rem http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing,
+rem software distributed under the License is distributed on an
+rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+rem KIND, either express or implied. See the License for the
+rem specific language governing permissions and limitations
+rem under the License.
+
docker run -v %~dp0%:C:\dev -v %USERPROFILE%\.nuget\packages:C:\packages -t davydm/net-build-tools:vs2019 "npm ci && npm run build"
diff --git a/install-dotnet-core-sdk-1.1.ps1 b/install-dotnet-core-sdk-1.1.ps1
index 038d9d629..08282ff90 100644
--- a/install-dotnet-core-sdk-1.1.ps1
+++ b/install-dotnet-core-sdk-1.1.ps1
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
#Enforce TLS 1.2 as Microsoft is deprecating all old TLS versions
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
diff --git a/install-net-framework-sdk-3.5.ps1 b/install-net-framework-sdk-3.5.ps1
index 7858dc987..e49ce0bf7 100644
--- a/install-net-framework-sdk-3.5.ps1
+++ b/install-net-framework-sdk-3.5.ps1
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
#Enforce TLS 1.2 as Microsoft is deprecating all old TLS versions
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
diff --git a/local-tasks/build-site.js b/local-tasks/build-site.js
index 8e27cf03f..d63d91cd2 100644
--- a/local-tasks/build-site.js
+++ b/local-tasks/build-site.js
@@ -1,3 +1,20 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
const
gulp = requireModule("gulp"),
spawn = requireModule("spawn"),
diff --git a/local-tasks/hash-build-artifacts.js b/local-tasks/hash-build-artifacts.js
index 91fea9180..1af07dfa8 100644
--- a/local-tasks/hash-build-artifacts.js
+++ b/local-tasks/hash-build-artifacts.js
@@ -1,3 +1,20 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
const
gulp = requireModule("gulp");
diff --git a/local-tasks/prefix-build-artifacts.js b/local-tasks/prefix-build-artifacts.js
index 4f34ae969..886890b73 100644
--- a/local-tasks/prefix-build-artifacts.js
+++ b/local-tasks/prefix-build-artifacts.js
@@ -1,3 +1,20 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
const { renameSync } = require("fs");
const gulp = requireModule("gulp");
@@ -20,4 +37,4 @@ gulp.task("prefix-build-artifacts", async () => {
);
await rename(item, newName, true);
}
-});
\ No newline at end of file
+});
diff --git a/local-tasks/prepare-build-artifacts.js b/local-tasks/prepare-build-artifacts.js
index 3c22504ec..b658f0886 100644
--- a/local-tasks/prepare-build-artifacts.js
+++ b/local-tasks/prepare-build-artifacts.js
@@ -1,3 +1,20 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
const
gulp = requireModule("gulp");
diff --git a/local-tasks/update-version-info.js b/local-tasks/update-version-info.js
index 314bf5cc3..c1e0353f7 100644
--- a/local-tasks/update-version-info.js
+++ b/local-tasks/update-version-info.js
@@ -1,3 +1,20 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
const
gulp = requireModule("gulp");
diff --git a/local-tasks/zip.js b/local-tasks/zip.js
index 3876fb864..3e2ec0265 100644
--- a/local-tasks/zip.js
+++ b/local-tasks/zip.js
@@ -1,3 +1,20 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
const
gulp = requireModule("gulp"),
promisify = requireModule("promisify-stream"),
diff --git a/old-log4net.snk.gpg b/old-log4net.snk.gpg
deleted file mode 100644
index 57126212f156159fe1855a8c49e6fc742c4dd790..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 2535
zcmVIwKeVLnvAD$At;IZrg&+c%Imyjp)a
z-DJDI+I0AIJuSWd!bOd&b@_CEkj6x;$r_Ft#MvYB=0X|M<_aCkne+z$72^HinO8jc
z_s}rAA13d=Etfj~9&fB55K%JSHGKa6$0Hwxo{p0UEa3_Jot>_qtrmN8pq`3u9-wRY
zROT4Hbb9Q07{j<&1E`V0#oh<~5m)U>MfJa{l7XEHIJ@2}BW!Y6`Y=_FzCU^p@qa)t
z9+;RwaR?eCpS_I8OmknT*je+_|I4xCRp2srCvH)?xN;+l|CrV6K@|87l=9%S^t~b}
zAF2NVcz7xkUeP}Cl;vk{?oQwD4qh8tX5&DN{<%{{iIjsD0=}*cRTMI#LMAQ-O?Lqj
zHK$vp#LPWQC6M5VVDBy)bVUmlN1_pyg&*fyCNlL==lA#MwQbqf+BK{cS^-@{g0g28
z*rN5f^jCt
zqsu}B0H7Dsy;N(4hou@=@F!lpKVsC676d-=IMaHx?B7VnIy&>()whW01dqbE+U!$3dX$|x7k`bm9?&S^GP
z>3{3j908#6+M5UZ_f7xudIO!K9Zrecji%_rTVrnFjxzA+DJ?LjgCY+ZiVIdX1a;*c
z_OOdSH(j%uKZOouJxib~b;{5bLWTFue_p=aAoq<{i9RHla4}c;t-gH7b>6ieM1s*g
zz~SvzjwL;BV_bbAU+(osgRD^wuBv@5E}YtZ?P$p-#bFM!4FW?%d!7}B88B;yOXjP!
zKv_bH2yDg0NBg37j`}}W5pM~0bedWbueBX=^|eYLK?e#kX+kZdqt($eOT@e!>&WL4
zhMtdEE%f2eH~gU_kfHu$wgr{rl~T8hcAh#mNz{v?!CD~QtnuC|2mpW}`R(>5|Dky6
zsYPq=Le&K?^Cz`HoV0VMh5Q81!(bl%r$|c~6qz+oxPQ;5!4!FcQ6fPJUAK#zhNs9)KB+)r!d$nq)lKKT
z$=e!iGHedsk8#Sm5s%YndCDRum-Yc=4NFefv5lX#9!BVcgDn+?3m?CKD7J><5Nz~7
zS(r(Nq8dSdA7!>OVKJk%15cl8=tI8d=u?gQBkmPiQJWP|NXn>+(Lv#19Ya-Ib+}N^
z3r#>~OZ6~|mhM5;g_m3!14*Jej8C5+kRu;bV8i~=8*S-QOM729P8=6IEC*SLtvWXwlr
z7&Hd^fw5Xsq|f98Y6#Qc22;erNX++L2<`nIha`O&gQFQ5fL3Ig_8v(_d
zzs?I9h-#{EmgFJpWlwGoMRUJy*|(Tv9K=K=q#++VxgUD=&gZ{@XF3uTJvPW|6Q3hC
z`gAD5RJA4qSGrjI0-K@7y!(nF=~X2mfm~m$X;80R0wi^SuAv!-nL*%#NXm~V)V`D{
zu6lCKQfFrz~p&@qFhqezCP
z|0XJ273CiRqX4e@lOEP233;4ZVy83`m`Y?}j}yr(I*-#3uWcf{YBW-LrAt}RLQERn
zdgGia^g$!?{oTT%BlzbY_N1TP^Ip}$>J_<2(9f4ve3SME7x1YRFGOh9n@ue0ucrQ;
zv%PS~h%w?`nk~IhtSK8`2P4EN);*EN?D)oJzI`N!ys
zUe!YPinib`tU1o)R4+QBjswvfN2=QaRuBN{J@Q=koI6y&s<|CQ8k7336|OKpzRlu-
zM#|P~1uElByzgGRX@%6Q{{fkFBuUWavpQ_z}W6hOTft
ze=e%|;2q}pX3$GY*jpNKt0%x$HR>L>#Oe0;GRtI2SdjES-7cF7eFT_2sKSfxJ^GNrQ
zJ8hyX2Uuker03ffOi+O!Z^1Ek$-%ai`iPlA3wM4OOk{{Y7p7XG&AjW!-Jt}31taY^
zF4@Tth2Y;6Nj$1Qv4>3wG_s1Y0_$DY~6EG*ZKg9`ZjpI
zczrVR&)%9+NCZ=eKz@_YVo2LVA5m$pe|v5Qc_hlD=H~k;Y;{0@RC`XUr)I<;?7}pf
xwds#Ca;zQ$k_e_xq4$XqMUVSnu%uZzzH~lLasRXy)QS96X^t)z^aZ&a&482OeFe
From e26e1dd8de26daccb4cf34a8698d7965fe52528a Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Wed, 3 Aug 2022 16:31:28 +0200
Subject: [PATCH 078/122] :white_check_mark: ensure that the log4net assembly
is always signed
---
src/log4net.Tests/Signing.cs | 23 +++++++++++++++++++++++
src/log4net/AssemblyInfo.cs | 2 ++
2 files changed, 25 insertions(+)
create mode 100644 src/log4net.Tests/Signing.cs
diff --git a/src/log4net.Tests/Signing.cs b/src/log4net.Tests/Signing.cs
new file mode 100644
index 000000000..865167404
--- /dev/null
+++ b/src/log4net.Tests/Signing.cs
@@ -0,0 +1,23 @@
+using log4net.Repository;
+using NUnit.Framework;
+using NExpect;
+using static NExpect.Expectations;
+
+namespace log4net.Tests
+{
+ [TestFixture]
+ public class Signing
+ {
+ [Test]
+ public void AssemblyShouldBeSigned()
+ {
+ // Arrange
+ var asm = typeof(LoggerRepositorySkeleton).Assembly;
+ // Act
+ var result = asm.GetName().GetPublicKey();
+ // Assert
+ Expect(result)
+ .Not.To.Be.Empty();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/log4net/AssemblyInfo.cs b/src/log4net/AssemblyInfo.cs
index 44905c3ff..a767ff7a2 100644
--- a/src/log4net/AssemblyInfo.cs
+++ b/src/log4net/AssemblyInfo.cs
@@ -20,6 +20,8 @@
using System.Reflection;
using System.Runtime.CompilerServices;
+// [assembly:AssemblyKeyFile("log4net.snk")]
+
#if (!SSCLI)
//
// log4net makes use of static methods which cannot be made com visible
From e14be4395ac93dfa8d36b469541f5d83e8ea46fd Mon Sep 17 00:00:00 2001
From: Jan Friedrich
Date: Mon, 8 Aug 2022 15:30:19 +0200
Subject: [PATCH 079/122] SystemInfo.EntryAssemblyLocation writable to adjust
location for config-files in unit test projects
---
.gitignore | 1 +
src/log4net/Util/SystemInfo.cs | 237 +++++++++++++++++----------------
2 files changed, 122 insertions(+), 116 deletions(-)
diff --git a/.gitignore b/.gitignore
index e260d61e2..ad029ec8f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -243,3 +243,4 @@ buildreports
vs_buildtools.exe
dotnetfx35.exe
*.exe
+/src/Binaries/*
diff --git a/src/log4net/Util/SystemInfo.cs b/src/log4net/Util/SystemInfo.cs
index 92e2c60cd..c63850bab 100644
--- a/src/log4net/Util/SystemInfo.cs
+++ b/src/log4net/Util/SystemInfo.cs
@@ -59,7 +59,7 @@ public sealed class SystemInfo
/// Only static methods are exposed from this type.
///
///
- private SystemInfo()
+ private SystemInfo()
{
}
@@ -142,7 +142,7 @@ public static string NewLine
///
public static string ApplicationBaseDirectory
{
- get
+ get
{
#if NETCF
- return System.IO.Path.GetDirectoryName(SystemInfo.EntryAssemblyLocation) + System.IO.Path.DirectorySeparatorChar;
@@ -170,7 +170,7 @@ public static string ApplicationBaseDirectory
///
public static string ConfigurationFileLocation
{
- get
+ get
{
#if NETCF || NETSTANDARD
return SystemInfo.EntryAssemblyLocation+".config";
@@ -180,6 +180,8 @@ public static string ConfigurationFileLocation
}
}
+ private static string entryAssemblyLocation;
+
///
/// Gets the path to the file that first executed in the current .
///
@@ -191,16 +193,19 @@ public static string ConfigurationFileLocation
///
public static string EntryAssemblyLocation
{
- get
+ get
{
+ if (entryAssemblyLocation != null)
+ return entryAssemblyLocation;
#if NETCF
- return SystemInfo.NativeEntryAssemblyLocation;
+ return entryAssemblyLocation = SystemInfo.NativeEntryAssemblyLocation;
#elif NETSTANDARD1_3 // TODO GetEntryAssembly is available for netstandard1.5
- return AppContext.BaseDirectory;
+ return entryAssemblyLocation = AppContext.BaseDirectory;
#else
- return System.Reflection.Assembly.GetEntryAssembly().Location;
+ return entryAssemblyLocation = System.Reflection.Assembly.GetEntryAssembly().Location;
#endif
}
+ set => entryAssemblyLocation = value;
}
///
@@ -227,7 +232,7 @@ public static string EntryAssemblyLocation
///
public static int CurrentThreadId
{
- get
+ get
{
#if NETCF_1_0
return System.Threading.Thread.CurrentThread.GetHashCode();
@@ -295,10 +300,10 @@ public static string HostName
s_hostName = Environment.MachineName;
#endif
}
- catch(InvalidOperationException)
+ catch (InvalidOperationException)
{
}
- catch(System.Security.SecurityException)
+ catch (System.Security.SecurityException)
{
// We may get a security exception looking up the machine name
// You must have Unrestricted EnvironmentPermission to access resource
@@ -343,7 +348,7 @@ public static string ApplicationFriendlyName
s_appFriendlyName = AppDomain.CurrentDomain.FriendlyName;
#endif
}
- catch(System.Security.SecurityException)
+ catch (System.Security.SecurityException)
{
// This security exception will occur if the caller does not have
// some undefined set of SecurityPermission flags.
@@ -357,7 +362,7 @@ public static string ApplicationFriendlyName
string assemblyLocation = SystemInfo.EntryAssemblyLocation;
s_appFriendlyName = System.IO.Path.GetFileName(assemblyLocation);
}
- catch(System.Security.SecurityException)
+ catch (System.Security.SecurityException)
{
// Caller needs path discovery permission
}
@@ -392,35 +397,35 @@ public static string ApplicationFriendlyName
/// will be set per AppDomain.
///
///
- [Obsolete("Use ProcessStartTimeUtc and convert to local time if needed.")]
+ [Obsolete("Use ProcessStartTimeUtc and convert to local time if needed.")]
public static DateTime ProcessStartTime
{
get { return s_processStartTimeUtc.ToLocalTime(); }
}
- ///
- /// Get the UTC start time for the current process.
- ///
- ///
- ///
- /// This is the UTC time at which the log4net library was loaded into the
- /// AppDomain. Due to reports of a hang in the call to System.Diagnostics.Process.StartTime
- /// this is not the start time for the current process.
- ///
- ///
- /// The log4net library should be loaded by an application early during its
- /// startup, therefore this start time should be a good approximation for
- /// the actual start time.
- ///
- ///
- /// Note that AppDomains may be loaded and unloaded within the
- /// same process without the process terminating, however this start time
- /// will be set per AppDomain.
- ///
- ///
- public static DateTime ProcessStartTimeUtc
- {
- get { return s_processStartTimeUtc; }
+ ///
+ /// Get the UTC start time for the current process.
+ ///
+ ///
+ ///
+ /// This is the UTC time at which the log4net library was loaded into the
+ /// AppDomain. Due to reports of a hang in the call to System.Diagnostics.Process.StartTime
+ /// this is not the start time for the current process.
+ ///
+ ///
+ /// The log4net library should be loaded by an application early during its
+ /// startup, therefore this start time should be a good approximation for
+ /// the actual start time.
+ ///
+ ///
+ /// Note that AppDomains may be loaded and unloaded within the
+ /// same process without the process terminating, however this start time
+ /// will be set per AppDomain.
+ ///
+ ///
+ public static DateTime ProcessStartTimeUtc
+ {
+ get { return s_processStartTimeUtc; }
}
///
@@ -483,7 +488,7 @@ public static string AssemblyLocationInfo(Assembly myAssembly)
#if NETCF
return "Not supported on Microsoft .NET Compact Framework";
#elif NETSTANDARD1_3
- return "Not supported on .NET Core";
+ return "Not supported on .NET Core";
#else
if (myAssembly.GlobalAssemblyCache)
{
@@ -665,7 +670,7 @@ public static Type GetTypeFromString(Type relativeType, string typeName, bool th
return GetTypeFromString(relativeType.Assembly, typeName, throwOnError, ignoreCase);
#endif
}
-
+
#if !NETSTANDARD1_3
///
/// Loads the type specified in the type string.
@@ -715,7 +720,7 @@ public static Type GetTypeFromString(string typeName, bool throwOnError, bool ig
public static Type GetTypeFromString(Assembly relativeAssembly, string typeName, bool throwOnError, bool ignoreCase)
{
// Check if the type name specifies the assembly name
- if(typeName.IndexOf(',') == -1)
+ if (typeName.IndexOf(',') == -1)
{
//LogLog.Debug(declaringType, "SystemInfo: Loading type ["+typeName+"] from assembly ["+relativeAssembly.FullName+"]");
#if NETSTANDARD1_3
@@ -737,7 +742,7 @@ public static Type GetTypeFromString(Assembly relativeAssembly, string typeName,
{
loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
}
- catch(System.Security.SecurityException)
+ catch (System.Security.SecurityException)
{
// Insufficient permissions to get the list of loaded assemblies
}
@@ -746,33 +751,33 @@ public static Type GetTypeFromString(Assembly relativeAssembly, string typeName,
{
Type fallback = null;
// Search the loaded assemblies for the type
- foreach (Assembly assembly in loadedAssemblies)
+ foreach (Assembly assembly in loadedAssemblies)
{
Type t = assembly.GetType(typeName, false, ignoreCase);
if (t != null)
{
// Found type in loaded assembly
- LogLog.Debug(declaringType, "Loaded type ["+typeName+"] from assembly ["+assembly.FullName+"] by searching loaded assemblies.");
- if (assembly.GlobalAssemblyCache)
- {
- fallback = t;
- }
- else
- {
- return t;
- }
+ LogLog.Debug(declaringType, "Loaded type [" + typeName + "] from assembly [" + assembly.FullName + "] by searching loaded assemblies.");
+ if (assembly.GlobalAssemblyCache)
+ {
+ fallback = t;
+ }
+ else
+ {
+ return t;
+ }
}
}
- if (fallback != null)
- {
- return fallback;
- }
+ if (fallback != null)
+ {
+ return fallback;
+ }
}
// Didn't find the type
if (throwOnError)
{
- throw new TypeLoadException("Could not load type ["+typeName+"]. Tried assembly ["+relativeAssembly.FullName+"] and all loaded assemblies");
+ throw new TypeLoadException("Could not load type [" + typeName + "]. Tried assembly [" + relativeAssembly.FullName + "] and all loaded assemblies");
}
return null;
#endif
@@ -938,20 +943,20 @@ public static bool TryParse(string s, out long val)
#endif
}
- ///
- /// Parse a string into an value
- ///
- /// the string to parse
- /// out param where the parsed value is placed
- /// true if the string was able to be parsed into an integer
- ///
- ///
- /// Attempts to parse the string into an integer. If the string cannot
- /// be parsed then this method returns false. The method does not throw an exception.
- ///
- ///
- public static bool TryParse(string s, out short val)
- {
+ ///
+ /// Parse a string into an value
+ ///
+ /// the string to parse
+ /// out param where the parsed value is placed
+ /// true if the string was able to be parsed into an integer
+ ///
+ ///
+ /// Attempts to parse the string into an integer. If the string cannot
+ /// be parsed then this method returns false. The method does not throw an exception.
+ ///
+ ///
+ public static bool TryParse(string s, out short val)
+ {
#if NETCF
val = 0;
try
@@ -965,28 +970,28 @@ public static bool TryParse(string s, out short val)
return false;
#else
- // Initialise out param
- val = 0;
-
- try
- {
- double doubleVal;
- if (Double.TryParse(s, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture, out doubleVal))
- {
- val = Convert.ToInt16(doubleVal);
- return true;
- }
- }
- catch
- {
- // Ignore exception, just return false
- }
-
- return false;
+ // Initialise out param
+ val = 0;
+
+ try
+ {
+ double doubleVal;
+ if (Double.TryParse(s, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture, out doubleVal))
+ {
+ val = Convert.ToInt16(doubleVal);
+ return true;
+ }
+ }
+ catch
+ {
+ // Ignore exception, just return false
+ }
+
+ return false;
#endif
- }
+ }
- ///
+ ///
/// Lookup an application setting
///
/// the application settings key to lookup
@@ -1008,7 +1013,7 @@ public static string GetAppSetting(string key)
return ConfigurationSettings.AppSettings[key];
#endif
}
- catch(Exception ex)
+ catch (Exception ex)
{
// If an exception is thrown here then it looks like the config file does not parse correctly.
LogLog.Error(declaringType, "Exception while reading ConfigurationSettings. Check your .config file is well formed XML.", ex);
@@ -1086,28 +1091,28 @@ public static Hashtable CreateCaseInsensitiveHashtable()
#endif
}
- ///
- /// Tests two strings for equality, the ignoring case.
- ///
- ///
- /// If the platform permits, culture information is ignored completely (ordinal comparison).
- /// The aim of this method is to provide a fast comparison that deals with null and ignores different casing.
- /// It is not supposed to deal with various, culture-specific habits.
- /// Use it to compare against pure ASCII constants, like keywords etc.
- ///
- /// The one string.
- /// The other string.
- /// true if the strings are equal, false otherwise.
- public static Boolean EqualsIgnoringCase(String a, String b)
- {
+ ///
+ /// Tests two strings for equality, the ignoring case.
+ ///
+ ///
+ /// If the platform permits, culture information is ignored completely (ordinal comparison).
+ /// The aim of this method is to provide a fast comparison that deals with null and ignores different casing.
+ /// It is not supposed to deal with various, culture-specific habits.
+ /// Use it to compare against pure ASCII constants, like keywords etc.
+ ///
+ /// The one string.
+ /// The other string.
+ /// true if the strings are equal, false otherwise.
+ public static Boolean EqualsIgnoringCase(String a, String b)
+ {
#if NET_1_0 || NET_1_1 || NETCF_1_0
- return string.Compare(a, b, true, System.Globalization.CultureInfo.InvariantCulture) == 0
+ return string.Compare(a, b, true, System.Globalization.CultureInfo.InvariantCulture) == 0
#elif NETSTANDARD1_3
- return CultureInfo.InvariantCulture.CompareInfo.Compare(a, b, CompareOptions.IgnoreCase) == 0;
+ return CultureInfo.InvariantCulture.CompareInfo.Compare(a, b, CompareOptions.IgnoreCase) == 0;
#else // >= .NET-2.0
- return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);
+ return String.Equals(a, b, StringComparison.OrdinalIgnoreCase);
#endif
- }
+ }
#endregion Public Static Methods
@@ -1169,14 +1174,14 @@ private static extern Int32 GetModuleFileName(
#region Private Static Fields
- ///
- /// The fully qualified type of the SystemInfo class.
- ///
- ///
- /// Used by the internal logger to record the Type of the
- /// log message.
- ///
- private static readonly Type declaringType = typeof(SystemInfo);
+ ///
+ /// The fully qualified type of the SystemInfo class.
+ ///
+ ///
+ /// Used by the internal logger to record the Type of the
+ /// log message.
+ ///
+ private static readonly Type declaringType = typeof(SystemInfo);
///
/// Cache the host name for the current machine
From 4b027beb384b6c933e18670972c2a5d365f394a2 Mon Sep 17 00:00:00 2001
From: Jan Friedrich
Date: Mon, 8 Aug 2022 15:46:10 +0200
Subject: [PATCH 080/122] New locking model for single log file in native
applications with managed parts
---
src/log4net/Appender/FileAppender.cs | 117 ++++++++++++++++++++++++++-
1 file changed, 115 insertions(+), 2 deletions(-)
diff --git a/src/log4net/Appender/FileAppender.cs b/src/log4net/Appender/FileAppender.cs
index dbade37f7..8853a8cca 100644
--- a/src/log4net/Appender/FileAppender.cs
+++ b/src/log4net/Appender/FileAppender.cs
@@ -160,7 +160,7 @@ public LockStateException(string message, Exception innerException) : base(messa
}
#if !NETCR && !NETSTANDARD1_3
- private LockStateException(SerializationInfo info, StreamingContext context) : base(info, context)
+ private LockStateException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
#endif
@@ -494,6 +494,7 @@ public FileAppender CurrentAppender
///
protected Stream CreateStream(string filename, bool append, FileShare fileShare)
{
+ filename = Environment.ExpandEnvironmentVariables(filename);
using (CurrentAppender.SecurityContext.Impersonate(this))
{
// Ensure that the directory structure exists
@@ -896,6 +897,118 @@ public override void OnClose()
}
#endif
+ ///
+ /// Hold no lock on the output file
+ ///
+ ///
+ ///
+ /// Open the file once and hold it open until is called.
+ /// Maintains no lock on the file during this time.
+ ///
+ ///
+ public class NoLock : LockingModelBase
+ {
+ private Stream m_stream = null;
+
+ ///
+ /// Open the file specified and prepare for logging.
+ ///
+ /// The filename to use
+ /// Whether to append to the file, or overwrite
+ /// The encoding to use
+ ///
+ ///
+ /// Open the file specified and prepare for logging.
+ /// No writes will be made until is called.
+ /// Must be called before any calls to ,
+ /// and .
+ ///
+ ///
+ public override void OpenFile(string filename, bool append, Encoding encoding)
+ {
+ try
+ {
+ // no lock
+ m_stream = CreateStream(filename, append, FileShare.ReadWrite);
+ }
+ catch (Exception e1)
+ {
+ CurrentAppender.ErrorHandler.Error("Unable to acquire lock on file " + filename + ". " + e1.Message);
+ }
+ }
+
+ ///
+ /// Close the file
+ ///
+ ///
+ ///
+ /// Close the file. No further writes will be made.
+ ///
+ ///
+ public override void CloseFile()
+ {
+ CloseStream(m_stream);
+ m_stream = null;
+ }
+
+ ///
+ /// Acquire the lock on the file
+ ///
+ /// A stream that is ready to be written to.
+ ///
+ ///
+ /// Does nothing. The lock is already taken
+ ///
+ ///
+ public override Stream AcquireLock()
+ {
+ return m_stream;
+ }
+
+ ///
+ /// Release the lock on the file
+ ///
+ ///
+ ///
+ /// Does nothing. The lock will be released when the file is closed.
+ ///
+ ///
+ public override void ReleaseLock()
+ {
+ // NOP
+ }
+
+ ///
+ /// Initializes all resources used by this locking model.
+ ///
+ public override void ActivateOptions()
+ {
+ // NOP
+ }
+
+ ///
+ /// Disposes all resources that were initialized by this locking model.
+ ///
+ public override void OnClose()
+ {
+ // NOP
+ }
+ }
+
+ ///
+ /// Default locking model (when no locking model was configured)
+ ///
+ private static Type defaultLockingModelType = typeof(ExclusiveLock);
+
+ ///
+ /// Specify default locking model
+ ///
+ /// Type of LockingModel
+ public static void SetDefaultLockingModelType() where TLockingModel : LockingModelBase
+ {
+ defaultLockingModelType = typeof(TLockingModel);
+ }
+
#endregion Locking Models
#region Public Instance Constructors
@@ -1112,7 +1225,7 @@ public override void ActivateOptions()
if (m_lockingModel == null)
{
- m_lockingModel = new FileAppender.ExclusiveLock();
+ m_lockingModel = (LockingModelBase)Activator.CreateInstance(defaultLockingModelType);
}
m_lockingModel.CurrentAppender = this;
From 091b652f913c2fa4ce942374f932c0879d6acbb1 Mon Sep 17 00:00:00 2001
From: Jan Friedrich
Date: Mon, 8 Aug 2022 16:04:32 +0200
Subject: [PATCH 081/122] Extension point for handling new lines in
RemoteSysLogAppender added
---
src/log4net/Appender/RemoteSyslogAppender.cs | 166 ++++++++++---------
1 file changed, 88 insertions(+), 78 deletions(-)
diff --git a/src/log4net/Appender/RemoteSyslogAppender.cs b/src/log4net/Appender/RemoteSyslogAppender.cs
index 675d6f970..b67abd328 100644
--- a/src/log4net/Appender/RemoteSyslogAppender.cs
+++ b/src/log4net/Appender/RemoteSyslogAppender.cs
@@ -344,88 +344,98 @@ public void AddMapping(LevelSeverity mapping)
///
protected override void Append(LoggingEvent loggingEvent)
{
- try
- {
- // Priority
- int priority = GeneratePriority(m_facility, GetSeverity(loggingEvent.Level));
-
- // Identity
- string identity;
-
- if (m_identity != null)
- {
- identity = m_identity.Format(loggingEvent);
- }
- else
- {
- identity = loggingEvent.Domain;
- }
-
- // Message. The message goes after the tag/identity
- string message = RenderLoggingEvent(loggingEvent);
-
- Byte[] buffer;
- int i = 0;
- char c;
-
- StringBuilder builder = new StringBuilder();
-
- while (i < message.Length)
- {
- // Clear StringBuilder
- builder.Length = 0;
-
- // Write priority
- builder.Append('<');
- builder.Append(priority);
- builder.Append('>');
-
- // Write identity
- builder.Append(identity);
- builder.Append(": ");
-
- for (; i < message.Length; i++)
- {
- c = message[i];
-
- // Accept only visible ASCII characters and space. See RFC 3164 section 4.1.3
- if (((int)c >= 32) && ((int)c <= 126))
- {
- builder.Append(c);
- }
- // If character is newline, break and send the current line
- else if ((c == '\r') || (c == '\n'))
- {
- // Check the next character to handle \r\n or \n\r
- if ((message.Length > i + 1) && ((message[i + 1] == '\r') || (message[i + 1] == '\n')))
- {
- i++;
- }
- i++;
- break;
- }
- }
-
- // Grab as a byte array
- buffer = this.Encoding.GetBytes(builder.ToString());
+ try
+ {
+ // Priority
+ int priority = GeneratePriority(m_facility, GetSeverity(loggingEvent.Level));
+
+ // Identity
+ string identity;
+
+ if (m_identity != null)
+ {
+ identity = m_identity.Format(loggingEvent);
+ }
+ else
+ {
+ identity = loggingEvent.Domain;
+ }
+
+ // Message. The message goes after the tag/identity
+ string message = RenderLoggingEvent(loggingEvent);
+
+ byte[] buffer;
+ int i = 0;
+
+ StringBuilder builder = new StringBuilder();
+
+ while (i < message.Length)
+ {
+ // Clear StringBuilder
+ builder.Length = 0;
+
+ // Write priority
+ builder.Append('<');
+ builder.Append(priority);
+ builder.Append('>');
+
+ // Write identity
+ builder.Append(identity);
+ builder.Append(": ");
+
+ AppendMessage(message, ref i, builder);
+
+ // Grab as a byte array
+ buffer = this.Encoding.GetBytes(builder.ToString());
#if NET_4_5 || NETSTANDARD
- Client.SendAsync(buffer, buffer.Length, RemoteEndPoint).Wait();
+ Client.SendAsync(buffer, buffer.Length, RemoteEndPoint).Wait();
#else
- this.Client.Send(buffer, buffer.Length, this.RemoteEndPoint);
+ this.Client.Send(buffer, buffer.Length, this.RemoteEndPoint);
#endif
- }
- }
- catch (Exception e)
- {
- ErrorHandler.Error(
- "Unable to send logging event to remote syslog " +
- this.RemoteAddress.ToString() +
- " on port " +
- this.RemotePort + ".",
- e,
- ErrorCode.WriteFailure);
- }
+ }
+ }
+ catch (Exception e)
+ {
+ ErrorHandler.Error(
+ "Unable to send logging event to remote syslog " +
+ this.RemoteAddress.ToString() +
+ " on port " +
+ this.RemotePort + ".",
+ e,
+ ErrorCode.WriteFailure);
+ }
+ }
+
+ ///
+ /// Appends the rendered message to the buffer
+ ///
+ /// rendered message
+ /// index of the current character in the message
+ /// buffer
+ protected virtual void AppendMessage(string message, ref int characterIndex, StringBuilder builder)
+ {
+ for (; characterIndex < message.Length; characterIndex++)
+ {
+ char c = message[characterIndex];
+
+ // Accept only visible ASCII characters and space. See RFC 3164 section 4.1.3
+ if (((int)c >= 32) && ((int)c <= 126))
+ {
+ builder.Append(c);
+ }
+ // If character is newline, break and send the current line
+ else if ((c == '\r') || (c == '\n'))
+ {
+ // Check the next character to handle \r\n or \n\r
+ if ((message.Length > characterIndex + 1) && ((message[characterIndex + 1] == '\r') || (message[characterIndex + 1] == '\n')))
+ {
+ characterIndex++;
+ }
+ characterIndex++;
+ break;
+ }
+ }
}
///
From 9ba9452b1721d488c51071bea99745b0ddb7c350 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Sun, 21 Aug 2022 16:05:38 +0200
Subject: [PATCH 082/122] :bug: Assembly.GetEntryAssembly() can return null -
instead of failing with a null-deref, rather fail explicitly with an hint on
how to work around the problem
---
src/log4net/Util/SystemInfo.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/log4net/Util/SystemInfo.cs b/src/log4net/Util/SystemInfo.cs
index c63850bab..821a23073 100644
--- a/src/log4net/Util/SystemInfo.cs
+++ b/src/log4net/Util/SystemInfo.cs
@@ -202,7 +202,8 @@ public static string EntryAssemblyLocation
#elif NETSTANDARD1_3 // TODO GetEntryAssembly is available for netstandard1.5
return entryAssemblyLocation = AppContext.BaseDirectory;
#else
- return entryAssemblyLocation = System.Reflection.Assembly.GetEntryAssembly().Location;
+ return entryAssemblyLocation = Assembly.GetEntryAssembly()?.Location
+ ?? throw new InvalidOperationException($"Unable to determine EntryAssembly location: EntryAssembly is null. Try explicitly setting {nameof(SystemInfo)}.{nameof(EntryAssemblyLocation)}");
#endif
}
set => entryAssemblyLocation = value;
From 963c29eb3b020668f048e156947b7584f2fe8213 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Sun, 21 Aug 2022 16:14:38 +0200
Subject: [PATCH 083/122] :recycle: prefer string interpolation over
concatenation
---
src/log4net/Appender/FileAppender.cs | 2993 +++++++++++++-------------
1 file changed, 1516 insertions(+), 1477 deletions(-)
diff --git a/src/log4net/Appender/FileAppender.cs b/src/log4net/Appender/FileAppender.cs
index 8853a8cca..bf782713e 100644
--- a/src/log4net/Appender/FileAppender.cs
+++ b/src/log4net/Appender/FileAppender.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,6 +16,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
+
#endregion
using System;
@@ -34,54 +36,54 @@
namespace log4net.Appender
{
#if !NETCF
- ///
- /// Appends logging events to a file.
- ///
- ///
- ///
- /// Logging events are sent to the file specified by
- /// the property.
- ///
- ///
- /// The file can be opened in either append or overwrite mode
- /// by specifying the property.
- /// If the file path is relative it is taken as relative from
- /// the application base directory. The file encoding can be
- /// specified by setting the property.
- ///
- ///
- /// The layout's and
- /// values will be written each time the file is opened and closed
- /// respectively. If the property is
- /// then the file may contain multiple copies of the header and footer.
- ///
- ///
- /// This appender will first try to open the file for writing when
- /// is called. This will typically be during configuration.
- /// If the file cannot be opened for writing the appender will attempt
- /// to open the file again each time a message is logged to the appender.
- /// If the file cannot be opened for writing when a message is logged then
- /// the message will be discarded by this appender.
- ///
- ///
- /// The supports pluggable file locking models via
- /// the property.
- /// The default behavior, implemented by
- /// is to obtain an exclusive write lock on the file until this appender is closed.
- /// The alternative models only hold a
- /// write lock while the appender is writing a logging event ()
- /// or synchronize by using a named system wide Mutex ().
- ///
- ///
- /// All locking strategies have issues and you should seriously consider using a different strategy that
- /// avoids having multiple processes logging to the same file.
- ///
- ///
- /// Nicko Cadell
- /// Gert Driesen
- /// Rodrigo B. de Oliveira
- /// Douglas de la Torre
- /// Niall Daley
+ ///
+ /// Appends logging events to a file.
+ ///
+ ///
+ ///
+ /// Logging events are sent to the file specified by
+ /// the property.
+ ///
+ ///
+ /// The file can be opened in either append or overwrite mode
+ /// by specifying the property.
+ /// If the file path is relative it is taken as relative from
+ /// the application base directory. The file encoding can be
+ /// specified by setting the property.
+ ///
+ ///
+ /// The layout's and
+ /// values will be written each time the file is opened and closed
+ /// respectively. If the property is
+ /// then the file may contain multiple copies of the header and footer.
+ ///
+ ///
+ /// This appender will first try to open the file for writing when
+ /// is called. This will typically be during configuration.
+ /// If the file cannot be opened for writing the appender will attempt
+ /// to open the file again each time a message is logged to the appender.
+ /// If the file cannot be opened for writing when a message is logged then
+ /// the message will be discarded by this appender.
+ ///
+ ///
+ /// The supports pluggable file locking models via
+ /// the property.
+ /// The default behavior, implemented by
+ /// is to obtain an exclusive write lock on the file until this appender is closed.
+ /// The alternative models only hold a
+ /// write lock while the appender is writing a logging event ()
+ /// or synchronize by using a named system wide Mutex ().
+ ///
+ ///
+ /// All locking strategies have issues and you should seriously consider using a different strategy that
+ /// avoids having multiple processes logging to the same file.
+ ///
+ ///
+ /// Nicko Cadell
+ /// Gert Driesen
+ /// Rodrigo B. de Oliveira
+ /// Douglas de la Torre
+ /// Niall Daley
#else
///
/// Appends logging events to a file.
@@ -131,56 +133,57 @@ namespace log4net.Appender
/// Douglas de la Torre
/// Niall Daley
#endif
- public class FileAppender : TextWriterAppender
- {
- #region LockingStream Inner Class
-
- ///
- /// Write only that uses the
- /// to manage access to an underlying resource.
- ///
- private sealed class LockingStream : Stream, IDisposable
- {
+ public class FileAppender : TextWriterAppender
+ {
+ #region LockingStream Inner Class
+
+ ///
+ /// Write only that uses the
+ /// to manage access to an underlying resource.
+ ///
+ private sealed class LockingStream : Stream, IDisposable
+ {
#if !NETCR
- [Serializable]
+ [Serializable]
#endif
- public sealed class LockStateException : LogException
- {
- public LockStateException(string message)
- : base(message)
- {
- }
+ public sealed class LockStateException : LogException
+ {
+ public LockStateException(string message)
+ : base(message)
+ {
+ }
- public LockStateException()
- {
- }
+ public LockStateException()
+ {
+ }
- public LockStateException(string message, Exception innerException) : base(message, innerException)
- {
- }
+ public LockStateException(string message, Exception innerException) : base(message, innerException)
+ {
+ }
#if !NETCR && !NETSTANDARD1_3
- private LockStateException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
+ private LockStateException(SerializationInfo info, StreamingContext context) : base(info, context)
+ {
+ }
#endif
- }
+ }
- private Stream m_realStream = null;
- private LockingModelBase m_lockingModel = null;
- private int m_lockLevel = 0;
+ private Stream m_realStream = null;
+ private LockingModelBase m_lockingModel = null;
+ private int m_lockLevel = 0;
- public LockingStream(LockingModelBase locking)
- : base()
- {
- if (locking == null)
- {
- throw new ArgumentException("Locking model may not be null", "locking");
- }
- m_lockingModel = locking;
- }
+ public LockingStream(LockingModelBase locking)
+ : base()
+ {
+ if (locking == null)
+ {
+ throw new ArgumentException("Locking model may not be null", "locking");
+ }
+
+ m_lockingModel = locking;
+ }
- #region Override Implementation of Stream
+ #region Override Implementation of Stream
#if NETSTANDARD
protected override void Dispose(bool disposing)
@@ -190,42 +193,51 @@ protected override void Dispose(bool disposing)
}
#else
- private int m_readTotal = -1;
-
- // Methods
- public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
- {
- AssertLocked();
- IAsyncResult ret = m_realStream.BeginRead(buffer, offset, count, callback, state);
- m_readTotal = EndRead(ret);
- return ret;
- }
-
- ///
- /// True asynchronous writes are not supported, the implementation forces a synchronous write.
- ///
- public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
- {
- AssertLocked();
- IAsyncResult ret = m_realStream.BeginWrite(buffer, offset, count, callback, state);
- EndWrite(ret);
- return ret;
- }
-
- public override void Close()
- {
- m_lockingModel.CloseFile();
- }
-
- public override int EndRead(IAsyncResult asyncResult)
- {
- AssertLocked();
- return m_readTotal;
- }
- public override void EndWrite(IAsyncResult asyncResult)
- {
- //No-op, it has already been handled
- }
+ private int m_readTotal = -1;
+
+ // Methods
+ public override IAsyncResult BeginRead(byte[] buffer,
+ int offset,
+ int count,
+ AsyncCallback callback,
+ object state)
+ {
+ AssertLocked();
+ IAsyncResult ret = m_realStream.BeginRead(buffer, offset, count, callback, state);
+ m_readTotal = EndRead(ret);
+ return ret;
+ }
+
+ ///
+ /// True asynchronous writes are not supported, the implementation forces a synchronous write.
+ ///
+ public override IAsyncResult BeginWrite(byte[] buffer,
+ int offset,
+ int count,
+ AsyncCallback callback,
+ object state)
+ {
+ AssertLocked();
+ IAsyncResult ret = m_realStream.BeginWrite(buffer, offset, count, callback, state);
+ EndWrite(ret);
+ return ret;
+ }
+
+ public override void Close()
+ {
+ m_lockingModel.CloseFile();
+ }
+
+ public override int EndRead(IAsyncResult asyncResult)
+ {
+ AssertLocked();
+ return m_readTotal;
+ }
+
+ public override void EndWrite(IAsyncResult asyncResult)
+ {
+ //No-op, it has already been handled
+ }
#endif
#if NET_4_5 || NETSTANDARD
@@ -242,905 +254,928 @@ public override Task WriteAsync(byte[] buffer, int offset, int count, Cancellati
}
#endif
- public override void Flush()
- {
- AssertLocked();
- m_realStream.Flush();
- }
- public override int Read(byte[] buffer, int offset, int count)
- {
- return m_realStream.Read(buffer, offset, count);
- }
- public override int ReadByte()
- {
- return m_realStream.ReadByte();
- }
- public override long Seek(long offset, SeekOrigin origin)
- {
- AssertLocked();
- return m_realStream.Seek(offset, origin);
- }
- public override void SetLength(long value)
- {
- AssertLocked();
- m_realStream.SetLength(value);
- }
- void IDisposable.Dispose()
- {
+ public override void Flush()
+ {
+ AssertLocked();
+ m_realStream.Flush();
+ }
+
+ public override int Read(byte[] buffer, int offset, int count)
+ {
+ return m_realStream.Read(buffer, offset, count);
+ }
+
+ public override int ReadByte()
+ {
+ return m_realStream.ReadByte();
+ }
+
+ public override long Seek(long offset, SeekOrigin origin)
+ {
+ AssertLocked();
+ return m_realStream.Seek(offset, origin);
+ }
+
+ public override void SetLength(long value)
+ {
+ AssertLocked();
+ m_realStream.SetLength(value);
+ }
+
+ void IDisposable.Dispose()
+ {
#if NETSTANDARD
Dispose(true);
#else
- Close();
+ Close();
#endif
- }
- public override void Write(byte[] buffer, int offset, int count)
- {
- AssertLocked();
- m_realStream.Write(buffer, offset, count);
- }
- public override void WriteByte(byte value)
- {
- AssertLocked();
- m_realStream.WriteByte(value);
- }
-
- // Properties
- public override bool CanRead
- {
- get { return false; }
- }
- public override bool CanSeek
- {
- get
- {
- AssertLocked();
- return m_realStream.CanSeek;
- }
- }
- public override bool CanWrite
- {
- get
- {
- AssertLocked();
- return m_realStream.CanWrite;
- }
- }
- public override long Length
- {
- get
- {
- AssertLocked();
- return m_realStream.Length;
- }
- }
- public override long Position
- {
- get
- {
- AssertLocked();
- return m_realStream.Position;
- }
- set
- {
- AssertLocked();
- m_realStream.Position = value;
- }
- }
-
- #endregion Override Implementation of Stream
-
- #region Locking Methods
-
- private void AssertLocked()
- {
- if (m_realStream == null)
- {
- throw new LockStateException("The file is not currently locked");
- }
- }
-
- public bool AcquireLock()
- {
- bool ret = false;
- lock (this)
- {
- if (m_lockLevel == 0)
- {
- // If lock is already acquired, nop
- m_realStream = m_lockingModel.AcquireLock();
- }
- if (m_realStream != null)
- {
- m_lockLevel++;
- ret = true;
- }
- }
- return ret;
- }
-
- public void ReleaseLock()
- {
- lock (this)
- {
- m_lockLevel--;
- if (m_lockLevel == 0)
- {
- // If already unlocked, nop
- m_lockingModel.ReleaseLock();
- m_realStream = null;
- }
- }
- }
-
- #endregion Locking Methods
- }
-
- #endregion LockingStream Inner Class
-
- #region Locking Models
-
- ///
- /// Locking model base class
- ///
- ///
- ///
- /// Base class for the locking models available to the derived loggers.
- ///
- ///
- public abstract class LockingModelBase
- {
- private FileAppender m_appender = null;
-
- ///
- /// Open the output file
- ///
- /// The filename to use
- /// Whether to append to the file, or overwrite
- /// The encoding to use
- ///
- ///
- /// Open the file specified and prepare for logging.
- /// No writes will be made until is called.
- /// Must be called before any calls to ,
- /// and .
- ///
- ///
- public abstract void OpenFile(string filename, bool append, Encoding encoding);
-
- ///
- /// Close the file
- ///
- ///
- ///
- /// Close the file. No further writes will be made.
- ///
- ///
- public abstract void CloseFile();
-
- ///
- /// Initializes all resources used by this locking model.
- ///
- public abstract void ActivateOptions();
-
- ///
- /// Disposes all resources that were initialized by this locking model.
- ///
- public abstract void OnClose();
-
- ///
- /// Acquire the lock on the file
- ///
- /// A stream that is ready to be written to.
- ///
- ///
- /// Acquire the lock on the file in preparation for writing to it.
- /// Return a stream pointing to the file.
- /// must be called to release the lock on the output file.
- ///
- ///
- public abstract Stream AcquireLock();
-
- ///
- /// Release the lock on the file
- ///
- ///
- ///
- /// Release the lock on the file. No further writes will be made to the
- /// stream until is called again.
- ///
- ///
- public abstract void ReleaseLock();
-
- ///
- /// Gets or sets the for this LockingModel
- ///
- ///
- /// The for this LockingModel
- ///
- ///
- ///
- /// The file appender this locking model is attached to and working on
- /// behalf of.
- ///
- ///
- /// The file appender is used to locate the security context and the error handler to use.
- ///
- ///
- /// The value of this property will be set before is
- /// called.
- ///
- ///
- public FileAppender CurrentAppender
- {
- get { return m_appender; }
- set { m_appender = value; }
- }
-
- ///
- /// Helper method that creates a FileStream under CurrentAppender's SecurityContext.
- ///
- ///
- ///
- /// Typically called during OpenFile or AcquireLock.
- ///
- ///
- /// If the directory portion of the does not exist, it is created
- /// via Directory.CreateDirecctory.
- ///
- ///
- ///
- ///
- ///
- ///
- protected Stream CreateStream(string filename, bool append, FileShare fileShare)
- {
- filename = Environment.ExpandEnvironmentVariables(filename);
- using (CurrentAppender.SecurityContext.Impersonate(this))
- {
- // Ensure that the directory structure exists
- string directoryFullName = Path.GetDirectoryName(filename);
-
- // Only create the directory if it does not exist
- // doing this check here resolves some permissions failures
- if (!Directory.Exists(directoryFullName))
- {
- Directory.CreateDirectory(directoryFullName);
- }
-
- FileMode fileOpenMode = append ? FileMode.Append : FileMode.Create;
- return new FileStream(filename, fileOpenMode, FileAccess.Write, fileShare);
- }
- }
-
- ///
- /// Helper method to close under CurrentAppender's SecurityContext.
- ///
- ///
- /// Does not set to null.
- ///
- ///
- protected void CloseStream(Stream stream)
- {
- using (CurrentAppender.SecurityContext.Impersonate(this))
- {
- stream.Dispose();
- }
- }
- }
-
- ///
- /// Hold an exclusive lock on the output file
- ///
- ///
- ///
- /// Open the file once for writing and hold it open until is called.
- /// Maintains an exclusive lock on the file during this time.
- ///
- ///
- public class ExclusiveLock : LockingModelBase
- {
- private Stream m_stream = null;
-
- ///
- /// Open the file specified and prepare for logging.
- ///
- /// The filename to use
- /// Whether to append to the file, or overwrite
- /// The encoding to use
- ///
- ///
- /// Open the file specified and prepare for logging.
- /// No writes will be made until is called.
- /// Must be called before any calls to ,
- /// and .
- ///
- ///
- public override void OpenFile(string filename, bool append, Encoding encoding)
- {
- try
- {
- m_stream = CreateStream(filename, append, FileShare.Read);
- }
- catch (Exception e1)
- {
- CurrentAppender.ErrorHandler.Error("Unable to acquire lock on file " + filename + ". " + e1.Message);
- }
- }
-
- ///
- /// Close the file
- ///
- ///
- ///
- /// Close the file. No further writes will be made.
- ///
- ///
- public override void CloseFile()
- {
- CloseStream(m_stream);
- m_stream = null;
- }
-
- ///
- /// Acquire the lock on the file
- ///
- /// A stream that is ready to be written to.
- ///
- ///
- /// Does nothing. The lock is already taken
- ///
- ///
- public override Stream AcquireLock()
- {
- return m_stream;
- }
-
- ///
- /// Release the lock on the file
- ///
- ///
- ///
- /// Does nothing. The lock will be released when the file is closed.
- ///
- ///
- public override void ReleaseLock()
- {
- //NOP
- }
-
- ///
- /// Initializes all resources used by this locking model.
- ///
- public override void ActivateOptions()
- {
- //NOP
- }
-
- ///
- /// Disposes all resources that were initialized by this locking model.
- ///
- public override void OnClose()
- {
- //NOP
- }
- }
-
- ///
- /// Acquires the file lock for each write
- ///
- ///
- ///
- /// Opens the file once for each / cycle,
- /// thus holding the lock for the minimal amount of time. This method of locking
- /// is considerably slower than but allows
- /// other processes to move/delete the log file whilst logging continues.
- ///
- ///
- public class MinimalLock : LockingModelBase
- {
- private string m_filename;
- private bool m_append;
- private Stream m_stream = null;
-
- ///
- /// Prepares to open the file when the first message is logged.
- ///
- /// The filename to use
- /// Whether to append to the file, or overwrite
- /// The encoding to use
- ///
- ///
- /// Open the file specified and prepare for logging.
- /// No writes will be made until is called.
- /// Must be called before any calls to ,
- /// and .
- ///
- ///
- public override void OpenFile(string filename, bool append, Encoding encoding)
- {
- m_filename = filename;
- m_append = append;
- }
-
- ///
- /// Close the file
- ///
- ///
- ///
- /// Close the file. No further writes will be made.
- ///
- ///
- public override void CloseFile()
- {
- // NOP
- }
-
- ///
- /// Acquire the lock on the file
- ///
- /// A stream that is ready to be written to.
- ///
- ///
- /// Acquire the lock on the file in preparation for writing to it.
- /// Return a stream pointing to the file.
- /// must be called to release the lock on the output file.
- ///
- ///
- public override Stream AcquireLock()
- {
- if (m_stream == null)
- {
- try
- {
- m_stream = CreateStream(m_filename, m_append, FileShare.Read);
- m_append = true;
- }
- catch (Exception e1)
- {
- CurrentAppender.ErrorHandler.Error("Unable to acquire lock on file " + m_filename + ". " + e1.Message);
- }
- }
- return m_stream;
- }
-
- ///
- /// Release the lock on the file
- ///
- ///
- ///
- /// Release the lock on the file. No further writes will be made to the
- /// stream until is called again.
- ///
- ///
- public override void ReleaseLock()
- {
- CloseStream(m_stream);
- m_stream = null;
- }
-
- ///
- /// Initializes all resources used by this locking model.
- ///
- public override void ActivateOptions()
- {
- //NOP
- }
-
- ///
- /// Disposes all resources that were initialized by this locking model.
- ///
- public override void OnClose()
- {
- //NOP
- }
- }
+ }
+
+ public override void Write(byte[] buffer, int offset, int count)
+ {
+ AssertLocked();
+ m_realStream.Write(buffer, offset, count);
+ }
+
+ public override void WriteByte(byte value)
+ {
+ AssertLocked();
+ m_realStream.WriteByte(value);
+ }
+
+ // Properties
+ public override bool CanRead
+ {
+ get { return false; }
+ }
+
+ public override bool CanSeek
+ {
+ get
+ {
+ AssertLocked();
+ return m_realStream.CanSeek;
+ }
+ }
+
+ public override bool CanWrite
+ {
+ get
+ {
+ AssertLocked();
+ return m_realStream.CanWrite;
+ }
+ }
+
+ public override long Length
+ {
+ get
+ {
+ AssertLocked();
+ return m_realStream.Length;
+ }
+ }
+
+ public override long Position
+ {
+ get
+ {
+ AssertLocked();
+ return m_realStream.Position;
+ }
+ set
+ {
+ AssertLocked();
+ m_realStream.Position = value;
+ }
+ }
+
+ #endregion Override Implementation of Stream
+
+ #region Locking Methods
+
+ private void AssertLocked()
+ {
+ if (m_realStream == null)
+ {
+ throw new LockStateException("The file is not currently locked");
+ }
+ }
+
+ public bool AcquireLock()
+ {
+ bool ret = false;
+ lock (this)
+ {
+ if (m_lockLevel == 0)
+ {
+ // If lock is already acquired, nop
+ m_realStream = m_lockingModel.AcquireLock();
+ }
+
+ if (m_realStream != null)
+ {
+ m_lockLevel++;
+ ret = true;
+ }
+ }
+
+ return ret;
+ }
+
+ public void ReleaseLock()
+ {
+ lock (this)
+ {
+ m_lockLevel--;
+ if (m_lockLevel == 0)
+ {
+ // If already unlocked, nop
+ m_lockingModel.ReleaseLock();
+ m_realStream = null;
+ }
+ }
+ }
+
+ #endregion Locking Methods
+ }
+
+ #endregion LockingStream Inner Class
+
+ #region Locking Models
+
+ ///
+ /// Locking model base class
+ ///
+ ///
+ ///
+ /// Base class for the locking models available to the derived loggers.
+ ///
+ ///
+ public abstract class LockingModelBase
+ {
+ private FileAppender m_appender = null;
+
+ ///
+ /// Open the output file
+ ///
+ /// The filename to use
+ /// Whether to append to the file, or overwrite
+ /// The encoding to use
+ ///
+ ///
+ /// Open the file specified and prepare for logging.
+ /// No writes will be made until is called.
+ /// Must be called before any calls to ,
+ /// and .
+ ///
+ ///
+ public abstract void OpenFile(string filename, bool append, Encoding encoding);
+
+ ///
+ /// Close the file
+ ///
+ ///
+ ///
+ /// Close the file. No further writes will be made.
+ ///
+ ///
+ public abstract void CloseFile();
+
+ ///
+ /// Initializes all resources used by this locking model.
+ ///
+ public abstract void ActivateOptions();
+
+ ///
+ /// Disposes all resources that were initialized by this locking model.
+ ///
+ public abstract void OnClose();
+
+ ///
+ /// Acquire the lock on the file
+ ///
+ /// A stream that is ready to be written to.
+ ///
+ ///
+ /// Acquire the lock on the file in preparation for writing to it.
+ /// Return a stream pointing to the file.
+ /// must be called to release the lock on the output file.
+ ///
+ ///
+ public abstract Stream AcquireLock();
+
+ ///
+ /// Release the lock on the file
+ ///
+ ///
+ ///
+ /// Release the lock on the file. No further writes will be made to the
+ /// stream until is called again.
+ ///
+ ///
+ public abstract void ReleaseLock();
+
+ ///
+ /// Gets or sets the for this LockingModel
+ ///
+ ///
+ /// The for this LockingModel
+ ///
+ ///
+ ///
+ /// The file appender this locking model is attached to and working on
+ /// behalf of.
+ ///
+ ///
+ /// The file appender is used to locate the security context and the error handler to use.
+ ///
+ ///
+ /// The value of this property will be set before is
+ /// called.
+ ///
+ ///
+ public FileAppender CurrentAppender
+ {
+ get { return m_appender; }
+ set { m_appender = value; }
+ }
+
+ ///
+ /// Helper method that creates a FileStream under CurrentAppender's SecurityContext.
+ ///
+ ///
+ ///
+ /// Typically called during OpenFile or AcquireLock.
+ ///
+ ///
+ /// If the directory portion of the does not exist, it is created
+ /// via Directory.CreateDirecctory.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ protected Stream CreateStream(string filename, bool append, FileShare fileShare)
+ {
+ filename = Environment.ExpandEnvironmentVariables(filename);
+ using (CurrentAppender.SecurityContext.Impersonate(this))
+ {
+ // Ensure that the directory structure exists
+ string directoryFullName = Path.GetDirectoryName(filename);
+
+ // Only create the directory if it does not exist
+ // doing this check here resolves some permissions failures
+ if (!Directory.Exists(directoryFullName))
+ {
+ Directory.CreateDirectory(directoryFullName);
+ }
+
+ FileMode fileOpenMode = append
+ ? FileMode.Append
+ : FileMode.Create;
+ return new FileStream(filename, fileOpenMode, FileAccess.Write, fileShare);
+ }
+ }
+
+ ///
+ /// Helper method to close under CurrentAppender's SecurityContext.
+ ///
+ ///
+ /// Does not set to null.
+ ///
+ ///
+ protected void CloseStream(Stream stream)
+ {
+ using (CurrentAppender.SecurityContext.Impersonate(this))
+ {
+ stream.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Hold an exclusive lock on the output file
+ ///
+ ///
+ ///
+ /// Open the file once for writing and hold it open until is called.
+ /// Maintains an exclusive lock on the file during this time.
+ ///
+ ///
+ public class ExclusiveLock : LockingModelBase
+ {
+ private Stream m_stream = null;
+
+ ///
+ /// Open the file specified and prepare for logging.
+ ///
+ /// The filename to use
+ /// Whether to append to the file, or overwrite
+ /// The encoding to use
+ ///
+ ///
+ /// Open the file specified and prepare for logging.
+ /// No writes will be made until is called.
+ /// Must be called before any calls to ,
+ /// and .
+ ///
+ ///
+ public override void OpenFile(string filename, bool append, Encoding encoding)
+ {
+ try
+ {
+ m_stream = CreateStream(filename, append, FileShare.Read);
+ }
+ catch (Exception e1)
+ {
+ CurrentAppender.ErrorHandler.Error("Unable to acquire lock on file " + filename + ". " +
+ e1.Message);
+ }
+ }
+
+ ///
+ /// Close the file
+ ///
+ ///
+ ///
+ /// Close the file. No further writes will be made.
+ ///
+ ///
+ public override void CloseFile()
+ {
+ CloseStream(m_stream);
+ m_stream = null;
+ }
+
+ ///
+ /// Acquire the lock on the file
+ ///
+ /// A stream that is ready to be written to.
+ ///
+ ///
+ /// Does nothing. The lock is already taken
+ ///
+ ///
+ public override Stream AcquireLock()
+ {
+ return m_stream;
+ }
+
+ ///
+ /// Release the lock on the file
+ ///
+ ///
+ ///
+ /// Does nothing. The lock will be released when the file is closed.
+ ///
+ ///
+ public override void ReleaseLock()
+ {
+ //NOP
+ }
+
+ ///
+ /// Initializes all resources used by this locking model.
+ ///
+ public override void ActivateOptions()
+ {
+ //NOP
+ }
+
+ ///
+ /// Disposes all resources that were initialized by this locking model.
+ ///
+ public override void OnClose()
+ {
+ //NOP
+ }
+ }
+
+ ///
+ /// Acquires the file lock for each write
+ ///
+ ///
+ ///
+ /// Opens the file once for each / cycle,
+ /// thus holding the lock for the minimal amount of time. This method of locking
+ /// is considerably slower than but allows
+ /// other processes to move/delete the log file whilst logging continues.
+ ///
+ ///
+ public class MinimalLock : LockingModelBase
+ {
+ private string m_filename;
+ private bool m_append;
+ private Stream m_stream = null;
+
+ ///
+ /// Prepares to open the file when the first message is logged.
+ ///
+ /// The filename to use
+ /// Whether to append to the file, or overwrite
+ /// The encoding to use
+ ///
+ ///
+ /// Open the file specified and prepare for logging.
+ /// No writes will be made until is called.
+ /// Must be called before any calls to ,
+ /// and .
+ ///
+ ///
+ public override void OpenFile(string filename, bool append, Encoding encoding)
+ {
+ m_filename = filename;
+ m_append = append;
+ }
+
+ ///
+ /// Close the file
+ ///
+ ///
+ ///
+ /// Close the file. No further writes will be made.
+ ///
+ ///
+ public override void CloseFile()
+ {
+ // NOP
+ }
+
+ ///
+ /// Acquire the lock on the file
+ ///
+ /// A stream that is ready to be written to.
+ ///
+ ///
+ /// Acquire the lock on the file in preparation for writing to it.
+ /// Return a stream pointing to the file.
+ /// must be called to release the lock on the output file.
+ ///
+ ///
+ public override Stream AcquireLock()
+ {
+ if (m_stream == null)
+ {
+ try
+ {
+ m_stream = CreateStream(m_filename, m_append, FileShare.Read);
+ m_append = true;
+ }
+ catch (Exception e1)
+ {
+ CurrentAppender.ErrorHandler.Error("Unable to acquire lock on file " + m_filename + ". " +
+ e1.Message);
+ }
+ }
+
+ return m_stream;
+ }
+
+ ///
+ /// Release the lock on the file
+ ///
+ ///
+ ///
+ /// Release the lock on the file. No further writes will be made to the
+ /// stream until is called again.
+ ///
+ ///
+ public override void ReleaseLock()
+ {
+ CloseStream(m_stream);
+ m_stream = null;
+ }
+
+ ///
+ /// Initializes all resources used by this locking model.
+ ///
+ public override void ActivateOptions()
+ {
+ //NOP
+ }
+
+ ///
+ /// Disposes all resources that were initialized by this locking model.
+ ///
+ public override void OnClose()
+ {
+ //NOP
+ }
+ }
#if !NETCF
- ///
- /// Provides cross-process file locking.
- ///
- /// Ron Grabowski
- /// Steve Wranovsky
- public class InterProcessLock : LockingModelBase
- {
- private Mutex m_mutex = null;
- private Stream m_stream = null;
- private int m_recursiveWatch = 0;
-
- ///
- /// Open the file specified and prepare for logging.
- ///
- /// The filename to use
- /// Whether to append to the file, or overwrite
- /// The encoding to use
- ///
- ///
- /// Open the file specified and prepare for logging.
- /// No writes will be made until is called.
- /// Must be called before any calls to ,
- /// - and .
- ///
- ///
+ ///
+ /// Provides cross-process file locking.
+ ///
+ /// Ron Grabowski
+ /// Steve Wranovsky
+ public class InterProcessLock : LockingModelBase
+ {
+ private Mutex m_mutex = null;
+ private Stream m_stream = null;
+ private int m_recursiveWatch = 0;
+
+ ///
+ /// Open the file specified and prepare for logging.
+ ///
+ /// The filename to use
+ /// Whether to append to the file, or overwrite
+ /// The encoding to use
+ ///
+ ///
+ /// Open the file specified and prepare for logging.
+ /// No writes will be made until is called.
+ /// Must be called before any calls to ,
+ /// - and .
+ ///
+ ///
#if NET_4_0 || MONO_4_0 || NETSTANDARD
[System.Security.SecuritySafeCritical]
#endif
- public override void OpenFile(string filename, bool append, Encoding encoding)
- {
- try
- {
- m_stream = CreateStream(filename, append, FileShare.ReadWrite);
- }
- catch (Exception e1)
- {
- CurrentAppender.ErrorHandler.Error("Unable to acquire lock on file " + filename + ". " + e1.Message);
- }
- }
-
- ///
- /// Close the file
- ///
- ///
- ///
- /// Close the file. No further writes will be made.
- ///
- ///
- public override void CloseFile()
- {
- try
- {
- CloseStream(m_stream);
- m_stream = null;
- }
- finally
- {
- ReleaseLock();
- }
- }
-
- ///
- /// Acquire the lock on the file
- ///
- /// A stream that is ready to be written to.
- ///
- ///
- /// Does nothing. The lock is already taken
- ///
- ///
- public override Stream AcquireLock()
- {
- if (m_mutex != null)
- {
- // TODO: add timeout?
- m_mutex.WaitOne();
-
- // increment recursive watch
- m_recursiveWatch++;
-
- // should always be true (and fast) for FileStream
- if (m_stream != null)
- {
- if (m_stream.CanSeek)
- {
- m_stream.Seek(0, SeekOrigin.End);
- }
- }
- else
- {
- // this can happen when the file appender cannot open a file for writing
- }
- }
- else
- {
- CurrentAppender.ErrorHandler.Error("Programming error, no mutex available to acquire lock! From here on things will be dangerous!");
- }
- return m_stream;
- }
-
- ///
- /// Releases the lock and allows others to acquire a lock.
- ///
- public override void ReleaseLock()
- {
- if (m_mutex != null)
- {
- if (m_recursiveWatch > 0)
- {
- m_recursiveWatch--;
- m_mutex.ReleaseMutex();
- }
- }
- else
- {
- CurrentAppender.ErrorHandler.Error("Programming error, no mutex available to release the lock!");
- }
- }
-
- ///
- /// Initializes all resources used by this locking model.
- ///
- public override void ActivateOptions()
- {
- if (m_mutex == null)
- {
- string mutexFriendlyFilename = CurrentAppender.File
- .Replace("\\", "_")
- .Replace(":", "_")
- .Replace("/", "_");
-
- m_mutex = new Mutex(false, mutexFriendlyFilename);
- }
- else
- {
- CurrentAppender.ErrorHandler.Error("Programming error, mutex already initialized!");
- }
- }
-
- ///
- /// Disposes all resources that were initialized by this locking model.
- ///
- public override void OnClose()
- {
- if (m_mutex != null)
- {
+ public override void OpenFile(string filename, bool append, Encoding encoding)
+ {
+ try
+ {
+ m_stream = CreateStream(filename, append, FileShare.ReadWrite);
+ }
+ catch (Exception e1)
+ {
+ CurrentAppender.ErrorHandler.Error("Unable to acquire lock on file " + filename + ". " +
+ e1.Message);
+ }
+ }
+
+ ///
+ /// Close the file
+ ///
+ ///
+ ///
+ /// Close the file. No further writes will be made.
+ ///
+ ///
+ public override void CloseFile()
+ {
+ try
+ {
+ CloseStream(m_stream);
+ m_stream = null;
+ }
+ finally
+ {
+ ReleaseLock();
+ }
+ }
+
+ ///
+ /// Acquire the lock on the file
+ ///
+ /// A stream that is ready to be written to.
+ ///
+ ///
+ /// Does nothing. The lock is already taken
+ ///
+ ///
+ public override Stream AcquireLock()
+ {
+ if (m_mutex != null)
+ {
+ // TODO: add timeout?
+ m_mutex.WaitOne();
+
+ // increment recursive watch
+ m_recursiveWatch++;
+
+ // should always be true (and fast) for FileStream
+ if (m_stream != null)
+ {
+ if (m_stream.CanSeek)
+ {
+ m_stream.Seek(0, SeekOrigin.End);
+ }
+ }
+ else
+ {
+ // this can happen when the file appender cannot open a file for writing
+ }
+ }
+ else
+ {
+ CurrentAppender.ErrorHandler.Error(
+ "Programming error, no mutex available to acquire lock! From here on things will be dangerous!");
+ }
+
+ return m_stream;
+ }
+
+ ///
+ /// Releases the lock and allows others to acquire a lock.
+ ///
+ public override void ReleaseLock()
+ {
+ if (m_mutex != null)
+ {
+ if (m_recursiveWatch > 0)
+ {
+ m_recursiveWatch--;
+ m_mutex.ReleaseMutex();
+ }
+ }
+ else
+ {
+ CurrentAppender.ErrorHandler.Error("Programming error, no mutex available to release the lock!");
+ }
+ }
+
+ ///
+ /// Initializes all resources used by this locking model.
+ ///
+ public override void ActivateOptions()
+ {
+ if (m_mutex == null)
+ {
+ string mutexFriendlyFilename = CurrentAppender.File
+ .Replace("\\", "_")
+ .Replace(":", "_")
+ .Replace("/", "_");
+
+ m_mutex = new Mutex(false, mutexFriendlyFilename);
+ }
+ else
+ {
+ CurrentAppender.ErrorHandler.Error("Programming error, mutex already initialized!");
+ }
+ }
+
+ ///
+ /// Disposes all resources that were initialized by this locking model.
+ ///
+ public override void OnClose()
+ {
+ if (m_mutex != null)
+ {
#if NET_4_0 || MONO_4_0 || NETSTANDARD
m_mutex.Dispose();
#else
- m_mutex.Close();
+ m_mutex.Close();
#endif
- m_mutex = null;
- }
- else
- {
- CurrentAppender.ErrorHandler.Error("Programming error, mutex not initialized!");
- }
- }
- }
+ m_mutex = null;
+ }
+ else
+ {
+ CurrentAppender.ErrorHandler.Error("Programming error, mutex not initialized!");
+ }
+ }
+ }
#endif
- ///
- /// Hold no lock on the output file
- ///
- ///
- ///
- /// Open the file once and hold it open until is called.
- /// Maintains no lock on the file during this time.
- ///
- ///
- public class NoLock : LockingModelBase
- {
- private Stream m_stream = null;
-
- ///
- /// Open the file specified and prepare for logging.
- ///
- /// The filename to use
- /// Whether to append to the file, or overwrite
- /// The encoding to use
- ///
- ///
- /// Open the file specified and prepare for logging.
- /// No writes will be made until is called.
- /// Must be called before any calls to ,
- /// and .
- ///
- ///
- public override void OpenFile(string filename, bool append, Encoding encoding)
- {
- try
- {
- // no lock
- m_stream = CreateStream(filename, append, FileShare.ReadWrite);
- }
- catch (Exception e1)
- {
- CurrentAppender.ErrorHandler.Error("Unable to acquire lock on file " + filename + ". " + e1.Message);
- }
- }
-
- ///
- /// Close the file
- ///
- ///
- ///
- /// Close the file. No further writes will be made.
- ///
- ///
- public override void CloseFile()
- {
- CloseStream(m_stream);
- m_stream = null;
- }
-
- ///
- /// Acquire the lock on the file
- ///
- /// A stream that is ready to be written to.
- ///
- ///
- /// Does nothing. The lock is already taken
- ///
- ///
- public override Stream AcquireLock()
- {
- return m_stream;
- }
-
- ///
- /// Release the lock on the file
- ///
- ///
- ///
- /// Does nothing. The lock will be released when the file is closed.
- ///
- ///
- public override void ReleaseLock()
- {
- // NOP
- }
-
- ///
- /// Initializes all resources used by this locking model.
- ///
- public override void ActivateOptions()
- {
- // NOP
- }
-
- ///
- /// Disposes all resources that were initialized by this locking model.
- ///
- public override void OnClose()
- {
- // NOP
- }
- }
-
- ///
- /// Default locking model (when no locking model was configured)
- ///
- private static Type defaultLockingModelType = typeof(ExclusiveLock);
-
- ///
- /// Specify default locking model
- ///
- /// Type of LockingModel
- public static void SetDefaultLockingModelType() where TLockingModel : LockingModelBase
- {
- defaultLockingModelType = typeof(TLockingModel);
- }
-
- #endregion Locking Models
-
- #region Public Instance Constructors
-
- ///
- /// Default constructor
- ///
- ///
- ///
- /// Default constructor
- ///
- ///
- public FileAppender()
- {
- }
-
- ///
- /// Construct a new appender using the layout, file and append mode.
- ///
- /// the layout to use with this appender
- /// the full path to the file to write to
- /// flag to indicate if the file should be appended to
- ///
- ///
- /// Obsolete constructor.
- ///
- ///
- [Obsolete("Instead use the default constructor and set the Layout, File & AppendToFile properties")]
- public FileAppender(ILayout layout, string filename, bool append)
- {
- Layout = layout;
- File = filename;
- AppendToFile = append;
- ActivateOptions();
- }
-
- ///
- /// Construct a new appender using the layout and file specified.
- /// The file will be appended to.
- ///
- /// the layout to use with this appender
- /// the full path to the file to write to
- ///
- ///
- /// Obsolete constructor.
- ///
- ///
- [Obsolete("Instead use the default constructor and set the Layout & File properties")]
- public FileAppender(ILayout layout, string filename)
- : this(layout, filename, true)
- {
- }
-
- #endregion Public Instance Constructors
-
- #region Public Instance Properties
-
- ///
- /// Gets or sets the path to the file that logging will be written to.
- ///
- ///
- /// The path to the file that logging will be written to.
- ///
- ///
- ///
- /// If the path is relative it is taken as relative from
- /// the application base directory.
- ///
- ///
- public virtual string File
- {
- get { return m_fileName; }
- set { m_fileName = value; }
- }
-
- ///
- /// Gets or sets a flag that indicates whether the file should be
- /// appended to or overwritten.
- ///
- ///
- /// Indicates whether the file should be appended to or overwritten.
- ///
- ///
- ///
- /// If the value is set to false then the file will be overwritten, if
- /// it is set to true then the file will be appended to.
- ///
- /// The default value is true.
- ///
- public bool AppendToFile
- {
- get { return m_appendToFile; }
- set { m_appendToFile = value; }
- }
-
- ///
- /// Gets or sets used to write to the file.
- ///
- ///
- /// The used to write to the file.
- ///
- ///
- ///
- /// The default encoding set is
- /// which is the encoding for the system's current ANSI code page.
- ///
- ///
- public Encoding Encoding
- {
- get { return m_encoding; }
- set { m_encoding = value; }
- }
-
- ///
- /// Gets or sets the used to write to the file.
- ///
- ///
- /// The used to write to the file.
- ///
- ///
- ///
- /// Unless a specified here for this appender
- /// the is queried for the
- /// security context to use. The default behavior is to use the security context
- /// of the current thread.
- ///
- ///
- public SecurityContext SecurityContext
- {
- get { return m_securityContext; }
- set { m_securityContext = value; }
- }
+ ///
+ /// Hold no lock on the output file
+ ///
+ ///
+ ///
+ /// Open the file once and hold it open until is called.
+ /// Maintains no lock on the file during this time.
+ ///
+ ///
+ public class NoLock : LockingModelBase
+ {
+ private Stream m_stream = null;
+
+ ///
+ /// Open the file specified and prepare for logging.
+ ///
+ /// The filename to use
+ /// Whether to append to the file, or overwrite
+ /// The encoding to use
+ ///
+ ///
+ /// Open the file specified and prepare for logging.
+ /// No writes will be made until is called.
+ /// Must be called before any calls to ,
+ /// and .
+ ///
+ ///
+ public override void OpenFile(string filename, bool append, Encoding encoding)
+ {
+ try
+ {
+ // no lock
+ m_stream = CreateStream(filename, append, FileShare.ReadWrite);
+ }
+ catch (Exception e1)
+ {
+ CurrentAppender.ErrorHandler.Error(
+ $"Unable to acquire lock on file {filename}. {e1.Message}"
+ );
+ }
+ }
+
+ ///
+ /// Close the file
+ ///
+ ///
+ ///
+ /// Close the file. No further writes will be made.
+ ///
+ ///
+ public override void CloseFile()
+ {
+ CloseStream(m_stream);
+ m_stream = null;
+ }
+
+ ///
+ /// Acquire the lock on the file
+ ///
+ /// A stream that is ready to be written to.
+ ///
+ ///
+ /// Does nothing. The lock is already taken
+ ///
+ ///
+ public override Stream AcquireLock()
+ {
+ return m_stream;
+ }
+
+ ///
+ /// Release the lock on the file
+ ///
+ ///
+ ///
+ /// Does nothing. The lock will be released when the file is closed.
+ ///
+ ///
+ public override void ReleaseLock()
+ {
+ // NOP
+ }
+
+ ///
+ /// Initializes all resources used by this locking model.
+ ///
+ public override void ActivateOptions()
+ {
+ // NOP
+ }
+
+ ///
+ /// Disposes all resources that were initialized by this locking model.
+ ///
+ public override void OnClose()
+ {
+ // NOP
+ }
+ }
+
+ ///
+ /// Default locking model (when no locking model was configured)
+ ///
+ private static Type defaultLockingModelType = typeof(ExclusiveLock);
+
+ ///
+ /// Specify default locking model
+ ///
+ /// Type of LockingModel
+ public static void SetDefaultLockingModelType() where TLockingModel : LockingModelBase
+ {
+ defaultLockingModelType = typeof(TLockingModel);
+ }
+
+ #endregion Locking Models
+
+ #region Public Instance Constructors
+
+ ///
+ /// Default constructor
+ ///
+ ///
+ ///
+ /// Default constructor
+ ///
+ ///
+ public FileAppender()
+ {
+ }
+
+ ///
+ /// Construct a new appender using the layout, file and append mode.
+ ///
+ /// the layout to use with this appender
+ /// the full path to the file to write to
+ /// flag to indicate if the file should be appended to
+ ///
+ ///
+ /// Obsolete constructor.
+ ///
+ ///
+ [Obsolete("Instead use the default constructor and set the Layout, File & AppendToFile properties")]
+ public FileAppender(ILayout layout, string filename, bool append)
+ {
+ Layout = layout;
+ File = filename;
+ AppendToFile = append;
+ ActivateOptions();
+ }
+
+ ///
+ /// Construct a new appender using the layout and file specified.
+ /// The file will be appended to.
+ ///
+ /// the layout to use with this appender
+ /// the full path to the file to write to
+ ///
+ ///
+ /// Obsolete constructor.
+ ///
+ ///
+ [Obsolete("Instead use the default constructor and set the Layout & File properties")]
+ public FileAppender(ILayout layout, string filename)
+ : this(layout, filename, true)
+ {
+ }
+
+ #endregion Public Instance Constructors
+
+ #region Public Instance Properties
+
+ ///
+ /// Gets or sets the path to the file that logging will be written to.
+ ///
+ ///
+ /// The path to the file that logging will be written to.
+ ///
+ ///
+ ///
+ /// If the path is relative it is taken as relative from
+ /// the application base directory.
+ ///
+ ///
+ public virtual string File
+ {
+ get { return m_fileName; }
+ set { m_fileName = value; }
+ }
+
+ ///
+ /// Gets or sets a flag that indicates whether the file should be
+ /// appended to or overwritten.
+ ///
+ ///
+ /// Indicates whether the file should be appended to or overwritten.
+ ///
+ ///
+ ///
+ /// If the value is set to false then the file will be overwritten, if
+ /// it is set to true then the file will be appended to.
+ ///
+ /// The default value is true.
+ ///
+ public bool AppendToFile
+ {
+ get { return m_appendToFile; }
+ set { m_appendToFile = value; }
+ }
+
+ ///
+ /// Gets or sets used to write to the file.
+ ///
+ ///
+ /// The used to write to the file.
+ ///
+ ///
+ ///
+ /// The default encoding set is
+ /// which is the encoding for the system's current ANSI code page.
+ ///
+ ///
+ public Encoding Encoding
+ {
+ get { return m_encoding; }
+ set { m_encoding = value; }
+ }
+
+ ///
+ /// Gets or sets the used to write to the file.
+ ///
+ ///
+ /// The used to write to the file.
+ ///
+ ///
+ ///
+ /// Unless a specified here for this appender
+ /// the is queried for the
+ /// security context to use. The default behavior is to use the security context
+ /// of the current thread.
+ ///
+ ///
+ public SecurityContext SecurityContext
+ {
+ get { return m_securityContext; }
+ set { m_securityContext = value; }
+ }
#if NETCF
///
@@ -1164,475 +1199,479 @@ public SecurityContext SecurityContext
///
///
#else
- ///
- /// Gets or sets the used to handle locking of the file.
- ///
- ///
- /// The used to lock the file.
- ///
- ///
- ///
- /// Gets or sets the used to handle locking of the file.
- ///
- ///
- /// There are three built in locking models, , and .
- /// The first locks the file from the start of logging to the end, the
- /// second locks only for the minimal amount of time when logging each message
- /// and the last synchronizes processes using a named system wide Mutex.
- ///
- ///
- /// The default locking model is the .
- ///
- ///
+ ///
+ /// Gets or sets the used to handle locking of the file.
+ ///
+ ///
+ /// The used to lock the file.
+ ///
+ ///
+ ///
+ /// Gets or sets the used to handle locking of the file.
+ ///
+ ///
+ /// There are three built in locking models, , and .
+ /// The first locks the file from the start of logging to the end, the
+ /// second locks only for the minimal amount of time when logging each message
+ /// and the last synchronizes processes using a named system wide Mutex.
+ ///
+ ///
+ /// The default locking model is the .
+ ///
+ ///
#endif
- public FileAppender.LockingModelBase LockingModel
- {
- get { return m_lockingModel; }
- set { m_lockingModel = value; }
- }
-
- #endregion Public Instance Properties
-
- #region Override implementation of AppenderSkeleton
-
- ///
- /// Activate the options on the file appender.
- ///
- ///
- ///
- /// This is part of the delayed object
- /// activation scheme. The method must
- /// be called on this object after the configuration properties have
- /// been set. Until is called this
- /// object is in an undefined state and must not be used.
- ///
- ///
- /// If any of the configuration properties are modified then
- /// must be called again.
- ///
- ///
- /// This will cause the file to be opened.
- ///
- ///
- public override void ActivateOptions()
- {
- base.ActivateOptions();
-
- if (m_securityContext == null)
- {
- m_securityContext = SecurityContextProvider.DefaultProvider.CreateSecurityContext(this);
- }
-
- if (m_lockingModel == null)
- {
- m_lockingModel = (LockingModelBase)Activator.CreateInstance(defaultLockingModelType);
- }
-
- m_lockingModel.CurrentAppender = this;
- m_lockingModel.ActivateOptions();
-
- if (m_fileName != null)
- {
- using (SecurityContext.Impersonate(this))
- {
- m_fileName = ConvertToFullPath(m_fileName.Trim());
- }
- SafeOpenFile(m_fileName, m_appendToFile);
- }
- else
- {
- LogLog.Warn(declaringType, "FileAppender: File option not set for appender [" + Name + "].");
- LogLog.Warn(declaringType, "FileAppender: Are you using FileAppender instead of ConsoleAppender?");
- }
- }
-
- #endregion Override implementation of AppenderSkeleton
-
- #region Override implementation of TextWriterAppender
-
- ///
- /// Closes any previously opened file and calls the parent's .
- ///
- ///
- ///
- /// Resets the filename and the file stream.
- ///
- ///
- protected override void Reset()
- {
- base.Reset();
- m_fileName = null;
- }
-
- ///
- /// Close this appender instance. The underlying stream or writer is also closed.
- ///
- protected override void OnClose()
- {
- base.OnClose();
- m_lockingModel.OnClose();
- }
-
- ///
- /// Called to initialize the file writer
- ///
- ///
- ///
- /// Will be called for each logged message until the file is
- /// successfully opened.
- ///
- ///
- protected override void PrepareWriter()
- {
- SafeOpenFile(m_fileName, m_appendToFile);
- }
-
- ///
- /// This method is called by the
- /// method.
- ///
- /// The event to log.
- ///
- ///
- /// Writes a log statement to the output stream if the output stream exists
- /// and is writable.
- ///
- ///
- /// The format of the output will depend on the appender's layout.
- ///
- ///
- protected override void Append(LoggingEvent loggingEvent)
- {
- if (m_stream.AcquireLock())
- {
- try
- {
- base.Append(loggingEvent);
- }
- finally
- {
- m_stream.ReleaseLock();
- }
- }
- }
-
- ///
- /// This method is called by the
- /// method.
- ///
- /// The array of events to log.
- ///
- ///
- /// Acquires the output file locks once before writing all the events to
- /// the stream.
- ///
- ///
- protected override void Append(LoggingEvent[] loggingEvents)
- {
- if (m_stream.AcquireLock())
- {
- try
- {
- base.Append(loggingEvents);
- }
- finally
- {
- m_stream.ReleaseLock();
- }
- }
- }
-
- ///
- /// Writes a footer as produced by the embedded layout's property.
- ///
- ///
- ///
- /// Writes a footer as produced by the embedded layout's property.
- ///
- ///
- protected override void WriteFooter()
- {
- if (m_stream != null)
- {
- //WriteFooter can be called even before a file is opened
- m_stream.AcquireLock();
- try
- {
- base.WriteFooter();
- }
- finally
- {
- m_stream.ReleaseLock();
- }
- }
- }
-
- ///
- /// Writes a header produced by the embedded layout's property.
- ///
- ///
- ///
- /// Writes a header produced by the embedded layout's property.
- ///
- ///
- protected override void WriteHeader()
- {
- if (m_stream != null)
- {
- if (m_stream.AcquireLock())
- {
- try
- {
- base.WriteHeader();
- }
- finally
- {
- m_stream.ReleaseLock();
- }
- }
- }
- }
-
- ///
- /// Closes the underlying .
- ///
- ///
- ///
- /// Closes the underlying .
- ///
- ///
- protected override void CloseWriter()
- {
- if (m_stream != null)
- {
- m_stream.AcquireLock();
- try
- {
- base.CloseWriter();
- }
- finally
- {
- m_stream.ReleaseLock();
- }
- }
- }
-
- #endregion Override implementation of TextWriterAppender
-
- #region Public Instance Methods
-
- ///
- /// Closes the previously opened file.
- ///
- ///
- ///
- /// Writes the to the file and then
- /// closes the file.
- ///
- ///
- protected void CloseFile()
- {
- WriteFooterAndCloseWriter();
- }
-
- #endregion Public Instance Methods
-
- #region Protected Instance Methods
-
- ///
- /// Sets and opens the file where the log output will go. The specified file must be writable.
- ///
- /// The path to the log file. Must be a fully qualified path.
- /// If true will append to fileName. Otherwise will truncate fileName
- ///
- ///
- /// Calls but guarantees not to throw an exception.
- /// Errors are passed to the .
- ///
- ///
- protected virtual void SafeOpenFile(string fileName, bool append)
- {
- try
- {
- OpenFile(fileName, append);
- }
- catch (Exception e)
- {
- ErrorHandler.Error("OpenFile(" + fileName + "," + append + ") call failed.", e, ErrorCode.FileOpenFailure);
- }
- }
-
- ///
- /// Sets and opens the file where the log output will go. The specified file must be writable.
- ///
- /// The path to the log file. Must be a fully qualified path.
- /// If true will append to fileName. Otherwise will truncate fileName
- ///
- ///
- /// If there was already an opened file, then the previous file
- /// is closed first.
- ///
- ///
- /// This method will ensure that the directory structure
- /// for the specified exists.
- ///
- ///
- protected virtual void OpenFile(string fileName, bool append)
- {
- if (LogLog.IsErrorEnabled)
- {
- // Internal check that the fileName passed in is a rooted path
- bool isPathRooted = false;
- using (SecurityContext.Impersonate(this))
- {
- isPathRooted = Path.IsPathRooted(fileName);
- }
- if (!isPathRooted)
- {
- LogLog.Error(declaringType, "INTERNAL ERROR. OpenFile(" + fileName + "): File name is not fully qualified.");
- }
- }
-
- lock (this)
- {
- Reset();
-
- LogLog.Debug(declaringType, "Opening file for writing [" + fileName + "] append [" + append + "]");
-
- // Save these for later, allowing retries if file open fails
- m_fileName = fileName;
- m_appendToFile = append;
-
- LockingModel.CurrentAppender = this;
- LockingModel.OpenFile(fileName, append, m_encoding);
- m_stream = new LockingStream(LockingModel);
-
- if (m_stream != null)
- {
- m_stream.AcquireLock();
- try
- {
- SetQWForFiles(m_stream);
- }
- finally
- {
- m_stream.ReleaseLock();
- }
- }
-
- WriteHeader();
- }
- }
-
- ///
- /// Sets the quiet writer used for file output
- ///
- /// the file stream that has been opened for writing
- ///
- ///
- /// This implementation of creates a
- /// over the and passes it to the
- /// method.
- ///
- ///
- /// This method can be overridden by sub classes that want to wrap the
- /// in some way, for example to encrypt the output
- /// data using a System.Security.Cryptography.CryptoStream.
- ///
- ///
- protected virtual void SetQWForFiles(Stream fileStream)
- {
+ public FileAppender.LockingModelBase LockingModel
+ {
+ get { return m_lockingModel; }
+ set { m_lockingModel = value; }
+ }
+
+ #endregion Public Instance Properties
+
+ #region Override implementation of AppenderSkeleton
+
+ ///
+ /// Activate the options on the file appender.
+ ///
+ ///
+ ///
+ /// This is part of the delayed object
+ /// activation scheme. The method must
+ /// be called on this object after the configuration properties have
+ /// been set. Until is called this
+ /// object is in an undefined state and must not be used.
+ ///
+ ///
+ /// If any of the configuration properties are modified then
+ /// must be called again.
+ ///
+ ///
+ /// This will cause the file to be opened.
+ ///
+ ///
+ public override void ActivateOptions()
+ {
+ base.ActivateOptions();
+
+ if (m_securityContext == null)
+ {
+ m_securityContext = SecurityContextProvider.DefaultProvider.CreateSecurityContext(this);
+ }
+
+ if (m_lockingModel == null)
+ {
+ m_lockingModel = (LockingModelBase) Activator.CreateInstance(defaultLockingModelType);
+ }
+
+ m_lockingModel.CurrentAppender = this;
+ m_lockingModel.ActivateOptions();
+
+ if (m_fileName != null)
+ {
+ using (SecurityContext.Impersonate(this))
+ {
+ m_fileName = ConvertToFullPath(m_fileName.Trim());
+ }
+
+ SafeOpenFile(m_fileName, m_appendToFile);
+ }
+ else
+ {
+ LogLog.Warn(declaringType, "FileAppender: File option not set for appender [" + Name + "].");
+ LogLog.Warn(declaringType, "FileAppender: Are you using FileAppender instead of ConsoleAppender?");
+ }
+ }
+
+ #endregion Override implementation of AppenderSkeleton
+
+ #region Override implementation of TextWriterAppender
+
+ ///
+ /// Closes any previously opened file and calls the parent's .
+ ///
+ ///
+ ///
+ /// Resets the filename and the file stream.
+ ///
+ ///
+ protected override void Reset()
+ {
+ base.Reset();
+ m_fileName = null;
+ }
+
+ ///
+ /// Close this appender instance. The underlying stream or writer is also closed.
+ ///
+ protected override void OnClose()
+ {
+ base.OnClose();
+ m_lockingModel.OnClose();
+ }
+
+ ///
+ /// Called to initialize the file writer
+ ///
+ ///
+ ///
+ /// Will be called for each logged message until the file is
+ /// successfully opened.
+ ///
+ ///
+ protected override void PrepareWriter()
+ {
+ SafeOpenFile(m_fileName, m_appendToFile);
+ }
+
+ ///
+ /// This method is called by the
+ /// method.
+ ///
+ /// The event to log.
+ ///
+ ///
+ /// Writes a log statement to the output stream if the output stream exists
+ /// and is writable.
+ ///
+ ///
+ /// The format of the output will depend on the appender's layout.
+ ///
+ ///
+ protected override void Append(LoggingEvent loggingEvent)
+ {
+ if (m_stream.AcquireLock())
+ {
+ try
+ {
+ base.Append(loggingEvent);
+ }
+ finally
+ {
+ m_stream.ReleaseLock();
+ }
+ }
+ }
+
+ ///
+ /// This method is called by the
+ /// method.
+ ///
+ /// The array of events to log.
+ ///
+ ///
+ /// Acquires the output file locks once before writing all the events to
+ /// the stream.
+ ///
+ ///
+ protected override void Append(LoggingEvent[] loggingEvents)
+ {
+ if (m_stream.AcquireLock())
+ {
+ try
+ {
+ base.Append(loggingEvents);
+ }
+ finally
+ {
+ m_stream.ReleaseLock();
+ }
+ }
+ }
+
+ ///
+ /// Writes a footer as produced by the embedded layout's property.
+ ///
+ ///
+ ///
+ /// Writes a footer as produced by the embedded layout's property.
+ ///
+ ///
+ protected override void WriteFooter()
+ {
+ if (m_stream != null)
+ {
+ //WriteFooter can be called even before a file is opened
+ m_stream.AcquireLock();
+ try
+ {
+ base.WriteFooter();
+ }
+ finally
+ {
+ m_stream.ReleaseLock();
+ }
+ }
+ }
+
+ ///
+ /// Writes a header produced by the embedded layout's property.
+ ///
+ ///
+ ///
+ /// Writes a header produced by the embedded layout's property.
+ ///
+ ///
+ protected override void WriteHeader()
+ {
+ if (m_stream != null)
+ {
+ if (m_stream.AcquireLock())
+ {
+ try
+ {
+ base.WriteHeader();
+ }
+ finally
+ {
+ m_stream.ReleaseLock();
+ }
+ }
+ }
+ }
+
+ ///
+ /// Closes the underlying .
+ ///
+ ///
+ ///
+ /// Closes the underlying .
+ ///
+ ///
+ protected override void CloseWriter()
+ {
+ if (m_stream != null)
+ {
+ m_stream.AcquireLock();
+ try
+ {
+ base.CloseWriter();
+ }
+ finally
+ {
+ m_stream.ReleaseLock();
+ }
+ }
+ }
+
+ #endregion Override implementation of TextWriterAppender
+
+ #region Public Instance Methods
+
+ ///
+ /// Closes the previously opened file.
+ ///
+ ///
+ ///
+ /// Writes the to the file and then
+ /// closes the file.
+ ///
+ ///
+ protected void CloseFile()
+ {
+ WriteFooterAndCloseWriter();
+ }
+
+ #endregion Public Instance Methods
+
+ #region Protected Instance Methods
+
+ ///
+ /// Sets and opens the file where the log output will go. The specified file must be writable.
+ ///
+ /// The path to the log file. Must be a fully qualified path.
+ /// If true will append to fileName. Otherwise will truncate fileName
+ ///
+ ///
+ /// Calls but guarantees not to throw an exception.
+ /// Errors are passed to the .
+ ///
+ ///
+ protected virtual void SafeOpenFile(string fileName, bool append)
+ {
+ try
+ {
+ OpenFile(fileName, append);
+ }
+ catch (Exception e)
+ {
+ ErrorHandler.Error("OpenFile(" + fileName + "," + append + ") call failed.", e,
+ ErrorCode.FileOpenFailure);
+ }
+ }
+
+ ///
+ /// Sets and opens the file where the log output will go. The specified file must be writable.
+ ///
+ /// The path to the log file. Must be a fully qualified path.
+ /// If true will append to fileName. Otherwise will truncate fileName
+ ///
+ ///
+ /// If there was already an opened file, then the previous file
+ /// is closed first.
+ ///
+ ///
+ /// This method will ensure that the directory structure
+ /// for the specified exists.
+ ///
+ ///
+ protected virtual void OpenFile(string fileName, bool append)
+ {
+ if (LogLog.IsErrorEnabled)
+ {
+ // Internal check that the fileName passed in is a rooted path
+ bool isPathRooted = false;
+ using (SecurityContext.Impersonate(this))
+ {
+ isPathRooted = Path.IsPathRooted(fileName);
+ }
+
+ if (!isPathRooted)
+ {
+ LogLog.Error(declaringType,
+ "INTERNAL ERROR. OpenFile(" + fileName + "): File name is not fully qualified.");
+ }
+ }
+
+ lock (this)
+ {
+ Reset();
+
+ LogLog.Debug(declaringType, "Opening file for writing [" + fileName + "] append [" + append + "]");
+
+ // Save these for later, allowing retries if file open fails
+ m_fileName = fileName;
+ m_appendToFile = append;
+
+ LockingModel.CurrentAppender = this;
+ LockingModel.OpenFile(fileName, append, m_encoding);
+ m_stream = new LockingStream(LockingModel);
+
+ if (m_stream != null)
+ {
+ m_stream.AcquireLock();
+ try
+ {
+ SetQWForFiles(m_stream);
+ }
+ finally
+ {
+ m_stream.ReleaseLock();
+ }
+ }
+
+ WriteHeader();
+ }
+ }
+
+ ///
+ /// Sets the quiet writer used for file output
+ ///
+ /// the file stream that has been opened for writing
+ ///
+ ///
+ /// This implementation of creates a
+ /// over the and passes it to the
+ /// method.
+ ///
+ ///
+ /// This method can be overridden by sub classes that want to wrap the
+ /// in some way, for example to encrypt the output
+ /// data using a System.Security.Cryptography.CryptoStream.
+ ///
+ ///
+ protected virtual void SetQWForFiles(Stream fileStream)
+ {
#pragma warning disable CA2000 // Dispose objects before losing scope
- StreamWriter writer = new StreamWriter(fileStream, m_encoding);
+ StreamWriter writer = new StreamWriter(fileStream, m_encoding);
#pragma warning restore CA2000 // Dispose objects before losing scope
- SetQWForFiles(writer);
- }
-
- ///
- /// Sets the quiet writer being used.
- ///
- /// the writer over the file stream that has been opened for writing
- ///
- ///
- /// This method can be overridden by sub classes that want to
- /// wrap the in some way.
- ///
- ///
- protected virtual void SetQWForFiles(TextWriter writer)
- {
- QuietWriter = new QuietTextWriter(writer, ErrorHandler);
- }
-
- #endregion Protected Instance Methods
-
- #region Protected Static Methods
-
- ///
- /// Convert a path into a fully qualified path.
- ///
- /// The path to convert.
- /// The fully qualified path.
- ///
- ///
- /// Converts the path specified to a fully
- /// qualified path. If the path is relative it is
- /// taken as relative from the application base
- /// directory.
- ///
- ///
- protected static string ConvertToFullPath(string path)
- {
- return SystemInfo.ConvertToFullPath(path);
- }
-
- #endregion Protected Static Methods
-
- #region Private Instance Fields
-
- ///
- /// Flag to indicate if we should append to the file
- /// or overwrite the file. The default is to append.
- ///
- private bool m_appendToFile = true;
-
- ///
- /// The name of the log file.
- ///
- private string m_fileName = null;
-
- ///
- /// The encoding to use for the file stream.
- ///
- private Encoding m_encoding = Encoding.GetEncoding(0);
-
- ///
- /// The security context to use for privileged calls
- ///
- private SecurityContext m_securityContext;
-
- ///
- /// The stream to log to. Has added locking semantics
- ///
- private FileAppender.LockingStream m_stream = null;
-
- ///
- /// The locking model to use
- ///
- private FileAppender.LockingModelBase m_lockingModel = new FileAppender.ExclusiveLock();
-
- #endregion Private Instance Fields
-
- #region Private Static Fields
-
- ///
- /// The fully qualified type of the FileAppender class.
- ///
- ///
- /// Used by the internal logger to record the Type of the
- /// log message.
- ///
- private static readonly Type declaringType = typeof(FileAppender);
-
- #endregion Private Static Fields
- }
-}
+ SetQWForFiles(writer);
+ }
+
+ ///
+ /// Sets the quiet writer being used.
+ ///
+ /// the writer over the file stream that has been opened for writing
+ ///
+ ///
+ /// This method can be overridden by sub classes that want to
+ /// wrap the in some way.
+ ///
+ ///
+ protected virtual void SetQWForFiles(TextWriter writer)
+ {
+ QuietWriter = new QuietTextWriter(writer, ErrorHandler);
+ }
+
+ #endregion Protected Instance Methods
+
+ #region Protected Static Methods
+
+ ///
+ /// Convert a path into a fully qualified path.
+ ///
+ /// The path to convert.
+ /// The fully qualified path.
+ ///
+ ///
+ /// Converts the path specified to a fully
+ /// qualified path. If the path is relative it is
+ /// taken as relative from the application base
+ /// directory.
+ ///
+ ///
+ protected static string ConvertToFullPath(string path)
+ {
+ return SystemInfo.ConvertToFullPath(path);
+ }
+
+ #endregion Protected Static Methods
+
+ #region Private Instance Fields
+
+ ///
+ /// Flag to indicate if we should append to the file
+ /// or overwrite the file. The default is to append.
+ ///
+ private bool m_appendToFile = true;
+
+ ///
+ /// The name of the log file.
+ ///
+ private string m_fileName = null;
+
+ ///
+ /// The encoding to use for the file stream.
+ ///
+ private Encoding m_encoding = Encoding.GetEncoding(0);
+
+ ///
+ /// The security context to use for privileged calls
+ ///
+ private SecurityContext m_securityContext;
+
+ ///
+ /// The stream to log to. Has added locking semantics
+ ///
+ private FileAppender.LockingStream m_stream = null;
+
+ ///
+ /// The locking model to use
+ ///
+ private FileAppender.LockingModelBase m_lockingModel = new FileAppender.ExclusiveLock();
+
+ #endregion Private Instance Fields
+
+ #region Private Static Fields
+
+ ///
+ /// The fully qualified type of the FileAppender class.
+ ///
+ ///
+ /// Used by the internal logger to record the Type of the
+ /// log message.
+ ///
+ private static readonly Type declaringType = typeof(FileAppender);
+
+ #endregion Private Static Fields
+ }
+}
\ No newline at end of file
From cf2d2bdfa5a33b0991b172de5fd534991e30aa8e Mon Sep 17 00:00:00 2001
From: Craig Douglas French
Date: Mon, 29 Aug 2022 12:38:40 -0400
Subject: [PATCH 084/122] Fix typo in RemotingServer App.Config
Config file had sppendToFile element name instead of appendToFile.
---
examples/net/2.0/Remoting/RemotingServer/cs/src/App.config | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/net/2.0/Remoting/RemotingServer/cs/src/App.config b/examples/net/2.0/Remoting/RemotingServer/cs/src/App.config
index 52b699d96..9a8b39195 100644
--- a/examples/net/2.0/Remoting/RemotingServer/cs/src/App.config
+++ b/examples/net/2.0/Remoting/RemotingServer/cs/src/App.config
@@ -34,7 +34,7 @@
diff --git a/src/site/xdoc/release/release-notes.xml b/src/site/xdoc/release/release-notes.xml
index 08018c764..4bb166de9 100644
--- a/src/site/xdoc/release/release-notes.xml
+++ b/src/site/xdoc/release/release-notes.xml
@@ -17,1940 +17,2225 @@ limitations under the License.
-->
-
- Nicko Cadell
- Codestin Search App
-
-
-
-
-
-
-
-
- Attention: .NET 3.5 Client Profile is no longer supported. I'm really sorry, I've tried
- to keep as many of the legacy targets available as possible, but after spending another 4 or so
- hours trying to get net35-client to build on any machine, I've given up - as far as I'm aware,
- this should only affect Windows XP clients. I'm afraid 2.0.14 was the end of the road for you.
-
- Apache log4net 2.0.15 addresses reported issues:
-
-
-
Improper usage of xml namespacing for netfx targets after a netstandard update (
- LOG4NET-685,
- related LOG4NET-683)
-
Locking hashtables during write in RenderMap calls to make them thread-safe (
- LOG4NET-646)
-
An issue where RollingFilAppender would sometimes overwrite files instead of rolling them (
- LOG4NET-672)
Add information about FixFlags and performance to the BufferingAppender (and derivative) documentation
-
-
-
-
- Apache log4net 2.0.14 is a minor release to address some reported issues
- and accept a pull request provided by a community member:
-
-
-
Pull request by @NicholasNoise to address issues with logging via ado appender to PostgreSQL
-
Community request to correctly handle null data in ReadOnlyPropertiesDictionary
-
Pull request by @erikma to use the numeric thread id for .net worker pool threads
- (LOG4NET-680)
-
Pull request by @erikma to dispose of WindowsIdentity retrieved in TryGetCurrentUserName()
- (LOG4NET-671)
-
-
-
-
- Apache log4net 2.0.13 is a minor release to address some reported issues
- and accept some pull requests provided by community members:
-
-
-
Addresses issue [LOG4NET-583] with proposed solution by Emmo Emminghaus,
- namely to provide an unique mutex identifier for the file rolling logic.
-
Accepts pull request 76 by @dschwartzni
- to allow the netstandard2.0 library to be used within net472 web services
-
Accepts pull request 18 by @dmarlow
- to update the xml layout mimicking log4j
-
-
-
-
-
- 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.
-
-
-
-
-
- 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
-
-
-
- Apache log4net 2.0.10 improves netstandard2.0 support
- thanks to community member @NicholasNoise.
-
-
-
-
- [LOG4NET-575]
- Addresses CVE-2018-1285 by cherry-picking the fix from
- Dominik Psenner, reported by Karthik Balasundaram, as it already
- existed in the the develop branch
-
-
-
-
-
-
-
- Apache log4net 2.0.9 adds netstandard2.0 support
- and restructures the project to enable easier build as well as build
- at AppVeyer. Project files have been updated to the modern Sdk format.
-
-
-
-
[LOG4NET-559] Add null
- checkes to avoid issues thrown by custom appenders
-
- Apache log4net 2.0.8 fixes a
- LockRecursionException
- that could happen
- inside the FileAppender under certain
- circumstances. It also adds support for
- LogicalThreadContext
- to the .NET Standard
- build based on AsyncLocal rather than
- CallContext.
-
-
-
-
-
[LOG4NET-466] - "LockRecursionException:
- A read lock may not be acquired with the write lock held in this mode." exception
-
-
[LOG4NET-550] - Logging
- recursively from an Appender not supported for NET_4_0 and MONO_4_0
-
-
[LOG4NET-551] -
- LockRecursionException when using File Appenders
-
-
[LOG4NET-554] -
- LogicalThreadContext was removed in .NETStandard
-
-
-
-
-
-
-
[LOG4NET-553] -
- DebugAppender
- configuration should give the possibility to disable outputting loggerName as category
-
-
-
-
-
-
-
- Apache log4net 2.0.7 fixes a glitch in nuget packaging and
- is otherwise identical to 2.0.6 (apart from the copyright
- year and assembly version). If you are not using the nuget
- package there is no reason to upgrade.
-
-
-
-
-
[LOG4NET-540] - nuget
- dependencies for .NET Standard leak into net46
-
-
-
-
-
-
-
-
- The Apache log4net team is now responsible for the nuget
- package, we've changed the version number of this release
- to align the version numbers. Release 2.0.6 is supposed to
- be compatible with 1.2.15.
-
-
-
- The binary distributions no longer contain assemblies
- built for the .NET Framework 1.x or Mono 1.x - you can
- build those yourself using the source distribution.
-
-
-
- Starting with 2.0.6 .NET Core - or more precisely
- .NET Standard 1.3 - has become a supported platform. Please
- note that several features of log4net are not available
- when using the .NET Core version, see framework
- support
- for details.
-
-
-
-
-
[LOG4NET-508] - NAnt release
- build is not optimized
-
-
[LOG4NET-512] - Thread
- safety
- issue in Hierarchy.cs
-
-
[LOG4NET-527] - broken link
- on
- config-examples.html
-
-
[LOG4NET-529] - Possible
- thread-safety bug in LoggingEvent
-
[LOG4NET-394] - Lambda-based
- ILog-Extensions should catch errors
-
-
-
-
-
-
-
-
-
- The binary distributions no longer contain assemblies
- built for the Compact Framework 2.0 - you can build
- those yourself using the source distribution.
-
-
-
-
-
[LOG4NET-148] -
- ThreadContext
- uses LocalDataStore to store ThreadSpecific data instead should be using [ThreadStatic]
- variables.
-
-
[LOG4NET-178] - Log4Net
- stops
- logging after appdomain recycle of ASP.NET2.0 application
-
-
[LOG4NET-202] -
- AdoNetAppenderParameter.Size Property is not optional
-
-
[LOG4NET-218] - Test
- StringFormatTest.TestFormatString fails
-
-
[LOG4NET-220] - multiple
- users
- overwrite existing log file when RollingFileAppender is rolling over date and minimal
- locking is
- used
-
-
[LOG4NET-228] -
- log4net.Util.HostName may throw System.Configuration.ConfigurationErrorsException in
- System.Net.Dns.GetHostName(). The exception should be ignored.
-
-
[LOG4NET-266] -
- AdoNetAppender
- does not work on a IIS 7 website using Windows authentication
-
-
[LOG4NET-277] - Registering
- a
- custom Object Renderer in configuration file
-
-
[LOG4NET-284] - In a
- multithreaded application, duplicate messages are output.
-
-
[LOG4NET-294] - Exception
- rendering object type [System.OutOfMemoryException]
-
[LOG4NET-322] - Conditional
- compilation symbols for .net4 Release
-
-
[LOG4NET-323] -
- AbsoluteTimeDateFormatter caches string representation of now too aggressively
-
-
[LOG4NET-331] -
- AdoNetAppender
- errors when writing Asp.net item when Request object is null
-
-
[LOG4NET-335] - Lost the
- ability
- to monitor changes to logger config files when you call ConfigureAndWatch multiple times
- with
- different Config File Names - worked fine on 1.2.10.0
-
[LOG4NET-342] - Add a way to
- prevent silent failure
-
-
-
-
-
-
-
- log4net 1.2.11 is not only a bugfix release, it also
- adds support for Microsoft® .NET 4.0 as well as the client profiles
- of .NET 3.5 and .NET 4.0.
-
-
-
- Starting with this release log4net uses a new strong
- name key but we also provide a binary distribution using
- the "old" strong name key of log4net 1.2.10 and earlier.
- See the FAQ for details.
-
-
-
- The binary distributions no longer contain assemblies
- built for the Compact Framework 1.0 or the Shared Source
- CLI - you can build those yourself using the source
- distribution.
-
-
-
-
- The signature of
- ILoggerFactory.CreateLogger
- has changed.
-
-
-
-
-
-
[LOG4NET-76] -
- TextWriterAdapter
- is not thread safe
-
-
[LOG4NET-79] -
- SecurityException
- thrown in LogicalThreadContextProperties GetProperties
-
-
[LOG4NET-81] -
- LoggerRepositorySkeleton's OnConfigurationChanged method always raises its event with
- EventArgs.Empty instead of passing through its EventArgs parameter.
-
-
[LOG4NET-93] - Typos for node
- name in tutorial, excess quote, invalid XML
-
-
[LOG4NET-94] - Incorrect
- config
- file for ..\examples\net\1.0\Tutorials\ConsoleApp
-
-
[LOG4NET-95] -
- Level.CompareTo()
- may result a wrong Value -> sorting of Levels does not work
-
[LOG4NET-96] - Expose the
- Message, Exception, and ErrorCode properties of OnlyOnceErrorHandler.
-
-
[LOG4NET-97] - Make Hierarchy's
- ILoggerFactory aware of the repository's LevelMap
-
-
[LOG4NET-98] - Update header
- comment in files to be compliant with new Apache header requirements:
- http://www.apache.org/legal/src-headers.html for 11/1/2006 deadline
-
-
[LOG4NET-100] -
- IPAddressConverter improvement for .NET 2 or .NET 3
-
-
[LOG4NET-106] -
- TraceAppender :
- Add switch to disable using logger name as trace category
-
-
[LOG4NET-112] - Add support
- to
- the UdpAppender for IP v6 remote addresses
-
-
[LOG4NET-131] - Add Cc and
- Bcc
- support to SmtpAppender
-
-
[LOG4NET-141] - Add
- CreateConnection method to AdoNetAppender to allow subclasses to have control of
- IDbConnection.
-
-
[LOG4NET-153] - Make it
- easier
- to configure multiple appenders in code using BasicConfigurator
-
-
[LOG4NET-157] - FAQ for
- getting
- the fully-qualified name of a class
-
-
[LOG4NET-164] - using a
- named
- mutex for file appenders
-
-
[LOG4NET-170] -
- Documentation
- improvement re: fixing and active properties
-
-
[LOG4NET-246] - Make it
- possible
- to choose whether or not to watch configuration files specified using the "log4net.Config"
- appsetting key
-
-
-
-
-
-
-
The various static Configure methods of the Configurator classes
- now
- return collections of configuration messages rather than void.
-
-
[LOG4NET-59] - add the
- ability to
- roll files based on universal time (UTC).
-
-
[LOG4NET-64] - add the
- ability to
- preserve the log file name extension when rolling the log file.
-
-
[LOG4NET-87] - Support
- ASP.Net
- related PatternConverters to allow items from the HttpContext.Current.Session, Cache,
- Request,
- etc. to be captured.
-
[LOG4NET-92] - Build for
- Compact Framework 2.0
-
[LOG4NET-33] - Ability to use
- global property to point to log4net configuration file
-
-
[LOG4NET-34] - Allow xml
- config
- values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"
-
-
[LOG4NET-45] - PluginAttribute
- does not allow plugin type to be specified as a Type, only as a string
-
-
[LOG4NET-52] - Allow XML
- configurator to set properties of type Object
-
-
[LOG4NET-53] - Allow
- repository
- properties to be set in the config file
-
-
[LOG4NET-56] - Support
- rendering
- IEnumerator objects as well as ICollections
-
-
[LOG4NET-58] - Support clean
- build
- on .NET 2.0
-
-
[LOG4NET-72] - Performance of
- ILog.xxxFormat methods
-
-
[LOG4NET-74] - Change
- MemoryAppender member variables to protected
-
-
-
-
-
-
-
-
-
-
Renamed namespaces
-
- Renamed namespace log4net.spi to
- log4net.Core.
- Renamed namespace log4net.helpers to
- log4net.Util.
-
-
Renamed config classes and attributes
-
- In the log4net.Config namespace the
- DOMConfigurator,
- DOMConfiguratorAttribute, DomainAttribute,
- and AliasDomainAttribute have been marked as obsolete. These types are
- still available and functional in this release.
-
-
- The XmlConfigurator and
- XmlConfiguratorAttribute
- types replace DOMConfigurator and
- DOMConfiguratorAttribute. The
- RepositoryAttribute
- and AliasRepositoryAttribute types replace
- DomainAttribute
- and AliasDomainAttribute.
-
-
Fixed pascal casing of type names
-
- Renamed AdoNetAppender, AspNetTraceAppender,
- SmtpAppender, Iso8601DateFormatter,
- MdcFilter, and NdcFilter.
- Note that the config file type resolver is case insensitive so this is only a breaking change
- for code that programmatically creates a type that has been renamed.
-
-
Layouts changed to stream their output to a
- TextWriter
-
-
- Layouts have been changed to format their output to a
- TextWriter
- rather than return a string. This increases performance and reduces temporary object creation.
-
-
C style string escapes no longer supported by config parser
-
- The XML config parser no longer supports decoding C style escape sequences in strings.
- Previously sequences like \n and
- \\
- where decoded. Instead use the appropriate XML encodings as required.
-
-
-
-
-
New CLI build
-
- A new log4net assembly is built that targets all CLI 1.0 compatible runtimes.
- This build is essentially a common subset of the Mono 1.0 and .NET 1.0 builds.
- It is built using the MS .NET 1.0 compiler and libraries but does not use any
- platform specific APIs.
-
-
- This build is only available in release configuration and can be found at
- bin\cli\1.0\release.
-
-
Logging contexts
-
- Logging contexts can be used to record contextual data that is relevant to the current
- process. Logging contexts are both an extension of the concepts embodied in the
- MDC
- and NDC and a replacement for
- them. The MDC and NDC have been
- reimplemented to use the ThreadContext as storage.
-
-
- The logging contexts provide a single unified view that cuts across different
- scopes within an application.
- The contexts are layered in the following order of narrowing scope:
- GlobalContext, ThreadContext,
- LogicalThreadContext, and LoggingEvent.
- Context values specified in a narrower scope hide the matching value in a wider scope.
-
-
- PatternLayout
- customization and long pattern names
-
-
- The PatternLayout now supports long pattern names.
- These pattern names are significantly more readable than the single character patterns.
-
-
- The PatternLayout now supports custom patterns. New patterns
- can be defined in the config file:
-
- The above config defines a custom pattern called
- myConverter
- which is bound to the
- TestApp.MyPatternConverter, TestApp
- type. This type must extend the
- log4net.Util.PatternConverter
- base class. The custom pattern can then be used in the pattern string.
-
+
+
+
+ Attention: .NET 3.5 Client Profile is no longer supported. I'm really sorry, I've tried
+ to keep as many of the legacy targets available as possible, but after spending another 4 or so
+ hours trying to get net35-client to build on any machine, I've given up - as far as I'm aware,
+ this should only affect Windows XP clients. I'm afraid 2.0.14 was the end of the road for you.
+
+ Apache log4net 2.0.15 addresses reported issues:
+
+
+
+ Improper usage of xml namespacing for netfx targets after a netstandard update (
+ LOG4NET-685,
+ related LOG4NET-683)
+
+
+ Locking hashtables during write in RenderMap calls to make them thread-safe (
+ LOG4NET-646)
+
+
+ An issue where RollingFilAppender would sometimes overwrite files instead of rolling them (
+ LOG4NET-672)
+
Add information about FixFlags and performance to the BufferingAppender (and derivative) documentation
+
+
+
+
+ Apache log4net 2.0.14 is a minor release to address some reported issues
+ and accept a pull request provided by a community member:
+
+
+
+ Pull request by @NicholasNoise to address issues with logging via ado appender to PostgreSQL
+
+
Community request to correctly handle null data in ReadOnlyPropertiesDictionary
+
+ Pull request by @erikma to use the numeric thread id for .net worker pool threads
+ (LOG4NET-680)
+
+
+ Pull request by @erikma to dispose of WindowsIdentity retrieved in TryGetCurrentUserName()
+ (LOG4NET-671)
+
+
+
+
+
+ Apache log4net 2.0.13 is a minor release to address some reported issues
+ and accept some pull requests provided by community members:
+
+
+
+ Addresses issue [LOG4NET-583] with proposed solution by Emmo Emminghaus,
+ namely to provide an unique mutex identifier for the file rolling logic.
+
+
+ Accepts pull request 76 by @dschwartzni
+ to allow the netstandard2.0 library to be used within net472 web services
+
+
+ Accepts pull request 18 by @dmarlow
+ to update the xml layout mimicking log4j
+
+
+
+
+
+
+ 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.
+
+
+
+
+
+ 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
+
+
+
+ Apache log4net 2.0.10 improves netstandard2.0 support
+ thanks to community member @NicholasNoise.
+
+
+
+
+ [LOG4NET-575]
+ Addresses CVE-2018-1285 by cherry-picking the fix from
+ Dominik Psenner, reported by Karthik Balasundaram, as it already
+ existed in the the develop branch
+
+
+
+
+
+
+
+ Apache log4net 2.0.9 adds netstandard2.0 support
+ and restructures the project to enable easier build as well as build
+ at AppVeyer. Project files have been updated to the modern Sdk format.
+
+
+
+
+ [LOG4NET-559] Add null
+ checkes to avoid issues thrown by custom appenders
+
+
+ [LOG4NET-563] Site styling
+ copied from log4j
+
+
+
+
+
+
+ Apache log4net 2.0.8 fixes a
+ LockRecursionException
+ that could happen
+ inside the FileAppender under certain
+ circumstances. It also adds support for
+ LogicalThreadContext
+ to the .NET Standard
+ build based on AsyncLocal rather than
+ CallContext.
+
+
+
+
+
+ [LOG4NET-466] - "LockRecursionException:
+ A read lock may not be acquired with the write lock held in this mode." exception
+
+
+ [LOG4NET-550] - Logging
+ recursively from an Appender not supported for NET_4_0 and MONO_4_0
+
+
+ [LOG4NET-551] -
+ LockRecursionException when using File Appenders
+
+
+ [LOG4NET-554] -
+ LogicalThreadContext was removed in .NETStandard
+
+
+
+
+
+
+
+ [LOG4NET-553] -
+ DebugAppender
+ configuration should give the possibility to disable outputting loggerName as category
+
+
+
+
+
+
+
+ Apache log4net 2.0.7 fixes a glitch in nuget packaging and
+ is otherwise identical to 2.0.6 (apart from the copyright
+ year and assembly version). If you are not using the nuget
+ package there is no reason to upgrade.
+
+
+
+
+
+ [LOG4NET-540] - nuget
+ dependencies for .NET Standard leak into net46
+
+
+
+
+
+
+
+
+ The Apache log4net team is now responsible for the nuget
+ package, we've changed the version number of this release
+ to align the version numbers. Release 2.0.6 is supposed to
+ be compatible with 1.2.15.
+
+
+
+ The binary distributions no longer contain assemblies
+ built for the .NET Framework 1.x or Mono 1.x - you can
+ build those yourself using the source distribution.
+
+
+
+ Starting with 2.0.6 .NET Core - or more precisely
+ .NET Standard 1.3 - has become a supported platform. Please
+ note that several features of log4net are not available
+ when using the .NET Core version, see
+ framework
+ support
+ for details.
+
+
+
+
+
+ [LOG4NET-508] - NAnt release
+ build is not optimized
+
+ [LOG4NET-394] - Lambda-based
+ ILog-Extensions should catch errors
+
+
+
+
+
+
+
+
+
+ The binary distributions no longer contain assemblies
+ built for the Compact Framework 2.0 - you can build
+ those yourself using the source distribution.
+
+
+
+
+
+ [LOG4NET-148] -
+ ThreadContext
+ uses LocalDataStore to store ThreadSpecific data instead should be using [ThreadStatic]
+ variables.
+
+
+ [LOG4NET-178] - Log4Net
+ stops
+ logging after appdomain recycle of ASP.NET2.0 application
+
+
+ [LOG4NET-202] -
+ AdoNetAppenderParameter.Size Property is not optional
+
+
+ [LOG4NET-218] - Test
+ StringFormatTest.TestFormatString fails
+
+
+ [LOG4NET-220] - multiple
+ users
+ overwrite existing log file when RollingFileAppender is rolling over date and minimal
+ locking is
+ used
+
+
+ [LOG4NET-228] -
+ log4net.Util.HostName may throw System.Configuration.ConfigurationErrorsException in
+ System.Net.Dns.GetHostName(). The exception should be ignored.
+
+
+ [LOG4NET-266] -
+ AdoNetAppender
+ does not work on a IIS 7 website using Windows authentication
+
+
+ [LOG4NET-277] - Registering
+ a
+ custom Object Renderer in configuration file
+
+
+ [LOG4NET-284] - In a
+ multithreaded application, duplicate messages are output.
+
+
+ [LOG4NET-294] - Exception
+ rendering object type [System.OutOfMemoryException]
+
+ [LOG4NET-323] -
+ AbsoluteTimeDateFormatter caches string representation of now too aggressively
+
+
+ [LOG4NET-331] -
+ AdoNetAppender
+ errors when writing Asp.net item when Request object is null
+
+
+ [LOG4NET-335] - Lost the
+ ability
+ to monitor changes to logger config files when you call ConfigureAndWatch multiple times
+ with
+ different Config File Names - worked fine on 1.2.10.0
+
+ [LOG4NET-342] - Add a way to
+ prevent silent failure
+
+
+
+
+
+
+
+ log4net 1.2.11 is not only a bugfix release, it also
+ adds support for Microsoft® .NET 4.0 as well as the client profiles
+ of .NET 3.5 and .NET 4.0.
+
+
+
+ Starting with this release log4net uses a new strong
+ name key but we also provide a binary distribution using
+ the "old" strong name key of log4net 1.2.10 and earlier.
+ See the FAQ for details.
+
+
+
+ The binary distributions no longer contain assemblies
+ built for the Compact Framework 1.0 or the Shared Source
+ CLI - you can build those yourself using the source
+ distribution.
+
+
+
+
+ The signature of
+ ILoggerFactory.CreateLogger
+ has changed.
+
+
+
+
+
+
+ [LOG4NET-76] -
+ TextWriterAdapter
+ is not thread safe
+
+ [LOG4NET-81] -
+ LoggerRepositorySkeleton's OnConfigurationChanged method always raises its event with
+ EventArgs.Empty instead of passing through its EventArgs parameter.
+
+
+ [LOG4NET-93] - Typos for node
+ name in tutorial, excess quote, invalid XML
+
+ [LOG4NET-96] - Expose the
+ Message, Exception, and ErrorCode properties of OnlyOnceErrorHandler.
+
+
+ [LOG4NET-97] - Make Hierarchy's
+ ILoggerFactory aware of the repository's LevelMap
+
+
+ [LOG4NET-98] - Update header
+ comment in files to be compliant with new Apache header requirements:
+ http://www.apache.org/legal/src-headers.html for 11/1/2006 deadline
+
+
+ [LOG4NET-100] -
+ IPAddressConverter improvement for .NET 2 or .NET 3
+
+
+ [LOG4NET-106] -
+ TraceAppender :
+ Add switch to disable using logger name as trace category
+
+
+ [LOG4NET-112] - Add support
+ to
+ the UdpAppender for IP v6 remote addresses
+
+
+ [LOG4NET-131] - Add Cc and
+ Bcc
+ support to SmtpAppender
+
+
+ [LOG4NET-141] - Add
+ CreateConnection method to AdoNetAppender to allow subclasses to have control of
+ IDbConnection.
+
+
+ [LOG4NET-153] - Make it
+ easier
+ to configure multiple appenders in code using BasicConfigurator
+
+
+ [LOG4NET-157] - FAQ for
+ getting
+ the fully-qualified name of a class
+
+
+ [LOG4NET-164] - using a
+ named
+ mutex for file appenders
+
+
+ [LOG4NET-170] -
+ Documentation
+ improvement re: fixing and active properties
+
+
+ [LOG4NET-246] - Make it
+ possible
+ to choose whether or not to watch configuration files specified using the "log4net.Config"
+ appsetting key
+
+
+
+
+
+
+
+ The various static Configure methods of the Configurator classes
+ now
+ return collections of configuration messages rather than void.
+
+
+ [LOG4NET-59] - add the
+ ability to
+ roll files based on universal time (UTC).
+
+
+ [LOG4NET-64] - add the
+ ability to
+ preserve the log file name extension when rolling the log file.
+
+
+ [LOG4NET-87] - Support
+ ASP.Net
+ related PatternConverters to allow items from the HttpContext.Current.Session, Cache,
+ Request,
+ etc. to be captured.
+
+ [LOG4NET-92] - Build for
+ Compact Framework 2.0
+
+ [LOG4NET-33] - Ability to use
+ global property to point to log4net configuration file
+
+
+ [LOG4NET-34] - Allow xml
+ config
+ values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value="foo"
+
+
+ [LOG4NET-45] - PluginAttribute
+ does not allow plugin type to be specified as a Type, only as a string
+
+
+ [LOG4NET-52] - Allow XML
+ configurator to set properties of type Object
+
+
+ [LOG4NET-53] - Allow
+ repository
+ properties to be set in the config file
+
+
+ [LOG4NET-56] - Support
+ rendering
+ IEnumerator objects as well as ICollections
+
+
+ [LOG4NET-58] - Support clean
+ build
+ on .NET 2.0
+
+
+ [LOG4NET-72] - Performance of
+ ILog.xxxFormat methods
+
+
+ [LOG4NET-74] - Change
+ MemoryAppender member variables to protected
+
+
+
+
+
+
+
+
+
+
Renamed namespaces
+
+ Renamed namespace log4net.spi to
+ log4net.Core
+ .
+ Renamed namespace log4net.helpers to
+ log4net.Util
+ .
+
+
Renamed config classes and attributes
+
+ In the log4net.Config namespace the
+ DOMConfigurator
+ ,
+ DOMConfiguratorAttribute, DomainAttribute,
+ and AliasDomainAttribute have been marked as obsolete. These types are
+ still available and functional in this release.
+
+
+ The XmlConfigurator and
+ XmlConfiguratorAttribute
+ types replace DOMConfigurator and
+ DOMConfiguratorAttribute. The
+ RepositoryAttribute
+ and AliasRepositoryAttribute types replace
+ DomainAttribute
+ and AliasDomainAttribute.
+
+
Fixed pascal casing of type names
+
+ Renamed AdoNetAppender, AspNetTraceAppender,
+ SmtpAppender, Iso8601DateFormatter,
+ MdcFilter, and NdcFilter.
+ Note that the config file type resolver is case insensitive so this is only a breaking change
+ for code that programmatically creates a type that has been renamed.
+
+
+ Layouts changed to stream their output to a
+ TextWriter
+
+
+ Layouts have been changed to format their output to a
+ TextWriter
+ rather than return a string. This increases performance and reduces temporary object creation.
+
+
C style string escapes no longer supported by config parser
+
+ The XML config parser no longer supports decoding C style escape sequences in strings.
+ Previously sequences like \n and
+ \\
+ where decoded. Instead use the appropriate XML encodings as required.
+
+
+
+
+
New CLI build
+
+ A new log4net assembly is built that targets all CLI 1.0 compatible runtimes.
+ This build is essentially a common subset of the Mono 1.0 and .NET 1.0 builds.
+ It is built using the MS .NET 1.0 compiler and libraries but does not use any
+ platform specific APIs.
+
+
+ This build is only available in release configuration and can be found at
+ bin\cli\1.0\release.
+
+
Logging contexts
+
+ Logging contexts can be used to record contextual data that is relevant to the current
+ process. Logging contexts are both an extension of the concepts embodied in the
+ MDC
+ and NDC and a replacement for
+ them. The MDC and NDC have been
+ reimplemented to use the ThreadContext as storage.
+
+
+ The logging contexts provide a single unified view that cuts across different
+ scopes within an application.
+ The contexts are layered in the following order of narrowing scope:
+ GlobalContext, ThreadContext,
+ LogicalThreadContext, and LoggingEvent.
+ Context values specified in a narrower scope hide the matching value in a wider scope.
+
+
+ PatternLayout
+ customization and long pattern names
+
+
+ The PatternLayout now supports long pattern names.
+ These pattern names are significantly more readable than the single character patterns.
+
+
+ The PatternLayout now supports custom patterns. New patterns
+ can be defined in the config file:
+
+ The above config defines a custom pattern called
+ myConverter
+ which is bound to the
+ TestApp.MyPatternConverter, TestApp
+ type. This type must extend the
+ log4net.Util.PatternConverter
+ base class. The custom pattern can then be used in the pattern string.
+
- PatternString
- for pattern based configuration
-
-
- A new pattern based type, PatternString, can be used in
- the config file to set string properties using a pattern syntax. For example the
- File property of the FileAppender could be set as follows:
-
- For full details see the SDK Reference entry: .
+
+
+ PatternString
+ for pattern based configuration
+
+
+ A new pattern based type, PatternString, can be used in
+ the config file to set string properties using a pattern syntax. For example the
+ File property of the FileAppender could be set as follows:
+
- The XmlConfigurator methods now support loading the
- configuration data from a URI. Config can be loaded from any URI supported by the
- System.Net.WebRequest
- class.
-
-
Support for No-Touch deployment
-
- Log4net supports configuring No-Touch deployment applications using the
- XmlConfiguratorAttribute. If a relative config file
- or extension is specified then this is resolved relative to the deployment
- URI.
-
-
Config file parser enhancements
-
- The config file parser has been enhanced to support specifying the property subtype, or
- intermediate
- type,
- directly on the property element, for example:
-
- Implicit conversion will be attempted between the value string and the type specified,
- and then again between the type and the target property type.
-
-
.NET string formatting syntax
-
- Added .NET String.Format style formatting syntax methods to
- the ILog interface. The new methods are:
- DebugFormat, InfoFormat,
- WarnFormat,
- ErrorFormat
- and FatalFormat.
-
-
Customizable levels
-
- Levels are defined by the repository LevelMap. The defined
- levels, the relative ordering of levels and level display names can be configured on
- a per-repository basis.
-
-
Per-appender security contexts
-
- Appenders that interact with controlled platform resources, e.g. files, can be
- configured to use a separate security context when accessing these resources.
- The calling thread may not have appropriate privileges to access the resource a
- custom SecurityContext can be used to elevate the
- privileges of the appender. The
- WindowsSecurityContext
- is used to specify alternative credentials on the Windows platform.
-
-
Added new appenders
-
-
- AnsiColorTerminalAppender
-
-
-
- The AnsiColorTerminalAppender writes events to
- the application's ANSI terminal window. It can be configured to specify
- the text and background colors for different level events. Note that Console
- applications running on Windows do not have an ANSI terminal window and
- should use the ColoredConsoleAppender instead.
-
-
-
- LocalSyslogAppender
-
-
-
- Logs events to a local syslog service. This appender uses the POSIX libc syslog
- library functions. If these functions are not available on the local system then
- this appender will not work!
-
-
-
- RemoteSyslogAppender
-
-
-
- The RemoteSyslogAppender uses the BSD syslog protocol to
- log to a syslog daemon. The syslogd listens for for messages on UDP port 514.
-
-
-
- TelnetAppender
-
-
-
- The TelnetAppender accepts socket connections and streams
- logging messages back to the client. The output is provided in a telnet-friendly way
- so that a log can be monitored over a TCP/IP socket.
- This allows simple remote monitoring of application logging.
-
-
-
-
Added new LoggerMatchFilter filter
-
-
- Added LoggerMatchFilter which matches a string against
- the event's logger name.
-
-
Pluggable file locking models for the
- FileAppender
-
-
- The FileAppender (and by extension the
- RollingFileAppender) now support pluggable file
- locking models. The default model, ExclusiveLock,
- maintains the current exclusive file locking behavior. An alternative
- model, MinimalLock, can be used to support writing to
- a single output file from multiple processes.
-
-
- For full details see the SDK Reference entry: .
+
+
Loading configuration from a URI
+
+ The XmlConfigurator methods now support loading the
+ configuration data from a URI. Config can be loaded from any URI supported by the
+ System.Net.WebRequest
+ class.
+
+
Support for No-Touch deployment
+
+ Log4net supports configuring No-Touch deployment applications using the
+ XmlConfiguratorAttribute. If a relative config file
+ or extension is specified then this is resolved relative to the deployment
+ URI.
+
+
Config file parser enhancements
+
+ The config file parser has been enhanced to support specifying the property subtype, or
+ intermediate
+ type,
+ directly on the property element, for example:
+
+ Implicit conversion will be attempted between the value string and the type specified,
+ and then again between the type and the target property type.
+
+
.NET string formatting syntax
+
+ Added .NET String.Format style formatting syntax methods to
+ the ILog interface. The new methods are:
+ DebugFormat, InfoFormat,
+ WarnFormat,
+ ErrorFormat
+ and FatalFormat.
+
+
Customizable levels
+
+ Levels are defined by the repository LevelMap. The defined
+ levels, the relative ordering of levels and level display names can be configured on
+ a per-repository basis.
+
+
Per-appender security contexts
+
+ Appenders that interact with controlled platform resources, e.g. files, can be
+ configured to use a separate security context when accessing these resources.
+ The calling thread may not have appropriate privileges to access the resource a
+ custom SecurityContext can be used to elevate the
+ privileges of the appender. The
+ WindowsSecurityContext
+ is used to specify alternative credentials on the Windows platform.
+
+
Added new appenders
+
+
+ AnsiColorTerminalAppender
+
+
+
+ The AnsiColorTerminalAppender writes events to
+ the application's ANSI terminal window. It can be configured to specify
+ the text and background colors for different level events. Note that Console
+ applications running on Windows do not have an ANSI terminal window and
+ should use the ColoredConsoleAppender instead.
+
+
+
+ LocalSyslogAppender
+
+
+
+ Logs events to a local syslog service. This appender uses the POSIX libc syslog
+ library functions. If these functions are not available on the local system then
+ this appender will not work!
+
+
+
+ RemoteSyslogAppender
+
+
+
+ The RemoteSyslogAppender uses the BSD syslog protocol to
+ log to a syslog daemon. The syslogd listens for for messages on UDP port 514.
+
+
+
+ TelnetAppender
+
+
+
+ The TelnetAppender accepts socket connections and streams
+ logging messages back to the client. The output is provided in a telnet-friendly way
+ so that a log can be monitored over a TCP/IP socket.
+ This allows simple remote monitoring of application logging.
+
+
+
+
+ Added new LoggerMatchFilter filter
+
+
+ Added LoggerMatchFilter which matches a string against
+ the event's logger name.
+
+
+ Pluggable file locking models for the
+ FileAppender
+
+
+ The FileAppender (and by extension the
+ RollingFileAppender) now support pluggable file
+ locking models. The default model, ExclusiveLock,
+ maintains the current exclusive file locking behavior. An alternative
+ model, MinimalLock, can be used to support writing to
+ a single output file from multiple processes.
+
- The RollingFileAppender now supports a new
- rolling style, Once. In this mode the appender
- will roll the file once per run.
-
-
- SmtpAppender
- authentication
-
-
- On the .NET 1.1 platform only, the SmtpAppender supports
- authenticating
- against the mail server using either username and password or integrated NTLM authentication.
-
-
- AdoNetAppender
- ReconnectOnError
-
-
- Added new configuration property to AdoNetAppender.
- Setting ReconnectOnError to
- true
- will force the appender to attempt to reconnect to the database if the connection
- is lost.
-
-
- UdpAppender
- hostname support
-
-
- The UdpAppender config property
- RemoteAddress
- can now be specified as a DNS hostname string. The hostname is resolved to an IP address.
-
-
-
-
-
FxCop compliance
-
- Updates to bring the internal code in line with the current FxCop rules.
-
-
Separate NUnit tests
-
- Moved the NUnit tests into a separate project, log4net.Tests.
-
-
Bug Fixes
-
-
- RemotingAppender
-
-
-
- Sends events from a ThreadPool thread
- rather than the calling thread to prevent transfer,
- and potential loss, of the CallContext.
-
-
-
- RollingFileAppender
-
-
-
- Fixed date rolling period detection for non UTC timezones.
-
-
-
- ColoredConsoleAppender
-
-
-
- Updated to support writing more than 30,000 chars in a single message.
- Fixed background color overspill if the console window needs to
- scroll the contents.
-
-
-
-
-
-
-
-
-
Changed assembly name to
- log4net
-
-
- The build output is now
- log4net.dll
- for all frameworks. This is a breaking change.
-
-
- To resolve cross platform and cross version issues we have
- changed the log4net assembly to use a common name for all
- frameworks. The assembly friendly name is now log4net.
- The builds for each framework can now be differentiated
- by the assembly title. This includes the name of the framework
- that the assembly was built on.
-
-
Combined Release and ReleaseStrong builds
-
- The Release and ReleaseStrong builds have been consolidated into
- a single build called Release. This Release build is strongly named.
-
-
New Appender: ColoredConsoleAppender
-
- The ColoredConsoleAppender writes events to the
- application's console. It can be configured to specify the text and background
- colors for different level events.
-
-
New Appender: SmtpPickupDirAppender
-
- The SmtpPickupDirAppender generates SMTP compliant
- messages and writes them to a local directory. These files can then be read
- by an SMTP agent (e.g. the IIS SMTP Agent) and delivered.
-
-
New Layout: XmlLayoutSchemaLog4j
-
- This new layout formats the logging events as XML which complies with
- the Apache log4j™ event dtd. This can be used to transfer log event from log4net
- to log4j. Currently the only appender that can communicate directly with
- log4j is the UdpAppender.
-
-
New PatternLayout conversion characters
-
- Added support for capturing the current thread principal name and the
- app domain friendly name for each logging event.
-
-
-
%a
-
- Used to output the friendly name of the AppDomain where the
- logging event was generated.
-
-
%u
-
- Used to output the user name for the currently active user
- (Principal.Identity.Name).
-
-
-
Types specified in the config file are now loaded ignoring case
-
- All types specified in the configuration files are now loaded
- using a case insensitive method.
-
-
Fine grained fixing for buffered events
-
- The LoggingEvent now supports fine grained
- fixing of data that needs to be accessed outside the append context,
- e.g. when an event is buffered. The new
- Fix
- property takes a combination of the
- FixFlags
- enumeration values.
-
-
Code updated inline with FxCop 1.21
-
- In line with the FxCop 1.21 guidelines:
- Sealed utility classes. Added serialization security demand to GetObjectData.
- Renamed parameters.
-
-
EventLogAppender 32K Limit
-
- There is a limit of 32K characters in an EventLog message. Added a
- check that only logs the first 32000 characters from the rendered
- message.
-
-
-
-
-
Updated to support the Microsoft .NET Framework 1.1 Final
-
- Updated to support the Microsoft .NET Framework 1.1 Final Beta (1.1.4322).
-
-
Features document
-
- Added a new document that covers the main features of log4net.
- See the
- features
- document for more information.
-
-
Hierarchy disabled until it is configured
-
- The Hierarchy is now disabled until it has been configured.
- All messages logged to the Hierarchy before it has been
- configured will be ignored without an error message being
- written to the console.
-
-
- If you are configuring log4net programmatically (i.e. not using
- one of the built-in configurators) you must set the
- ILoggerRepository.Configured
- property
- to true once you have configured
- the repository.
-
-
- The no appenders defined for a logger message will no longer be
- displayed on the console by default. This message will only be
- displayed if internal debugging is enabled.
-
-
New examples in VisualBasic.NET, JScript and Managed C++
-
- New examples in VisualBasic.NET, JScript and Managed C++.
- TODO Link to document about examples.
-
-
Code and Documentation Updates
-
- Code fixes. Documentation and manual updates.
- See the ChangeLog for more information.
-
-
Added document with example appender configurations
- Not all frameworks are created equal and some features have been excluded from
- some of the builds. See the Framework Support document for more
- information.
-
-
New build system using NAnt
-
- The new build system allows log4net to be built for all supported frameworks and
- in all build configurations in one go.
-
-
New source code & distribution layout
-
- The source code & distribution layout has been updated to support the new
- build environment and multiple target frameworks.
-
-
Removed DomainAttribute.UseDefaultDomain property
-
- Updated default behavior of DefaultRepositorySelector. Assemblies
- are now by default placed into the default domain. To specify another domain,
- the DomainAttribute must be used. This is the opposite behavior
- to what was previously available. If you were previously specifying the
- DomainAttribute.UseDefaultDomain
- property then you should remove it, and if the default behavior is now
- sufficient, you do not need to specify the DomainAttribute at all.
-
-
Updated configuration file parser
-
- Updated config file parser to use the element name as the property to set. Also
- removed <object> tag, the type attribute can now be
- specified on the property element directly.
-
- The EventLogAppender now supports setting the event ID in the
- event log, this is taken from the EventID property from the per
- event Properties map on the LoggingEvent.
-
-
Updated ADONetAppender
-
-
-
- Added support for prepared statements and stored procedures
-
-
- Added RawTimeStampLayoutto correctly convert the timestamps into
- database date time format
-
-
- Added ExceptionLayout to render the exception data
-
-
-
-
Support for front-end extension
-
- This allows the logging API to be wrapped or adapted for specific purposes. Two
- extension samples are included in the distribution:
-
-
-
-
-
-
-
-
-
- Extension
-
-
- Description
-
-
-
-
log4net.Ext.Trace
-
Adds trace logging methods
-
-
-
log4net.Ext.EventID
-
Adds additional eventId parameter to all methods
-
-
-
-
-
Added ForwardingAppender
-
Forwards events to multiple sub appenders after applying filter rules.
-
Added BufferingForwardingAppender
-
Forward events to sub appenders after buffering them.
-
Added ASPNetTraceAppender
-
Logs events to the ASP.NET trace system.
-
Added NetSendAppender
-
Delivers logging events using the Windows Messenger service.
-
Added UdpAppender
-
Sends logging events as connectionless UDP datagrams to a remote host or a
- multicast group.
-
-
Removed obsolete methods
-
Lots of updates to improve our compliance with FxCop
-
Improved SDK documentation
-
-
-
-
Fixed Exception thrown when DOM Configurator called with a null XML
- Element.
-
-
This occurred if the configuration file did not have a log4net section defined.
-
Made level lookup case insensitive
-
Prevented the Hierarchy's Threshold level from being set to a null reference
-
-
-
-
Added event specific properties to the logging event object
-
- Appenders can add additional information to the events they are logging. The
- RemotingAppender
- and the SMTPAppender both add a 'hostname' property to the events.
- These properties can be accessed using the PatternLayout with the
- %P{name} syntax.
-
-
Added a plugin framework
-
An IPlugin interface can be attached to any repository.
-
-
A new RemoteLoggingServerPlugin plugin acts as the server for the
- RemotingAppender
-
-
Updated the core log4net framework to work in an environment with no
- permissions
-
-
Specific appenders still require additional permissions to log correctly
-
Added support for domain aliasing using the AliasDomainAttribute
-
This allows a parent assembly to take control of the logging domain for child
- assemblies.
-
-
Added events for repository creation, configuration change, configuration reset
- and repository shutdown
-
-
Added LevelMap to the ILoggerRepository interface
-
The mapping from level name to level object is now repository specific,
- therefore each repository can have independent mappings.
-
-
Moved hierarchy specific config file parser to new DOMHierarchyConfigurator class
-
This is controlled by the Hierarchy object and allows for better
- encapsulation.
-
-
Added OnlyFixPartialEventData property to the buffered appenders
-
This setting causes slow settings to be ignored. This significantly improves the
- performance of the buffered appenders.
-
-
XML entity references are supported in the XML config file.
-
Added support for expanding environment variables in <param> values
-
- The environment variables must be specified as ${FOO} where
- FOO
- is the name of the variable to expand.
-
-
Upgraded to use NUnit 2.0
-
File appenders can specify the encoding to use for the file
-
Added strong named configuration
-
-
-
-
Added log4net.Ext.Trace extension
-
This is a separate assembly that adds a trace level to log4net.
-
The default log file output directory is now the application base directory not
- the current directory
-
-
Added MemoryAppender
-
Stores all the logging events in an in-memory buffer.
-
Moved the Hierarchy implementation into a separate namespace
-
- The log4net.Repository.Hierarchy namespace now contains all the
- code that is specific to the Hierarchy implementation.
-
-
Refactored the DOMConfigurator and BasicConfigurator
-
- The Hierarchy specific data schema and implementation could be has
- now been moved to the log4net.Repository.Hierarchy namespace. The
- bootstrap code for these configurators remains in the
- log4net.Config
- namespace.
-
-
Replaced the DOMConfiguratorAttribute UseExecutableDomain
- property with UseDefaultDomain
-
-
- This change to the implementation of the DOMConfiguratorAttribute should
- allow the configuration of multiple assemblies to be accomplished more easily,
- especially when developing web applications (ASP.NET).
-
-
A few good bug fixes!
-
-
-
-
Added ADONetAppender
-
Thanks to TechnologyOneCorp.com.
-
Added TraceLogAssembly extensibility example
-
Lots of bug fixes
-
-
-
-
Added 6 new examples
-
Split Category class into Logger and LogManager classes
-
- The instance methods from Category have moved to the
- Logger
- class. The static methods from Category have moved to the
- LogManager
- class. The Category class still exists but for backward
- compatibility only. Changed interface ICategoryFactory to
- ILoggerFactory
- and the implementation class DefaultCategoryFactory to
- DefaultLoggerFactory.
-
-
Replaced Priority class with Level class
-
- The Priority class has been replaced by the Level
- class.
- The Priority class still exists for backward compatibility only.
- The Level class implements a static pool of Level
- objects.
- The Level class is sealed and serializable.
-
-
Added ILoggerRepository interface implemented by Hierarchy
-
- The Hierarchy class implements the ILoggerRepository
- interface.
- This interface is used by the LogManager class and therefore
- allows different implementations of ILoggerRepository to be used.
-
-
Enhanced NUnit tests
-
- All the NUnit tests can be run using a single TestSuite: NUnitGUI
- log4net.LogManager+AllTests,log4net.dll.
-
-
Added support for serializing LoggingEvents
-
- The LoggingEvent class is serializable. All local state is
- captured before serialization occurs. This now allows
- LoggingEvent
- objects to be serialized between applications or machines.
-
-
Added RemotingAppender
-
- Delivers LoggingEvents to a remote interface. This can be used to
- collect distributed logging into a single log file. There is an example
- remoting sink that receives the logging events, see
- examples\net\remoting\RemotingServer
- for details.
-
-
Added support for rendering composite objects
-
- The IObjectRenderer interface method DoRender now
- takes a RendererMap argument. This allows the renderer to use the
- appropriate renderer from the RendererMap to render any nested
- objects.
-
-
Added support for rendering exceptions
-
- The DefaultRenderer now has support for rendering exceptions to a
- string. This includes nested exceptions. The RendererMap is now
- used to render exceptions in the LoggingEvent. This allows the
- rendering of specific exceptions to be enhanced by specific renderers.
-
-
Added ITriggeringEventEvaluator interface
-
- This interface is used by SMTPAppender and
- RemotingAppender
- to determine if a LoggingEvent meets a set of user defined
- criteria. These appenders use the interface to determine whether or not to
- deliver the current buffer of events to their listener. The interface is
- implemented by the LevelEvaluator class, which triggers above a
- set level.
-
-
Added regex matching to the MDCFilter, NDCFilter and StringMatchFilter
-
- The MDCFilter, NDCFilter and
- StringMatchFilter
- can now be configured to use regex matches in addition to substring matches.
- Set the RegexToMatch property to use this feature.
-
-
Added XMLLayout
-
- emits an XML element for each LoggingEvent. This allows logging
- events to be stored and manipulated as XML. The DTD for the XML emitted is in
- the
- log4net-events.dtd
-
-
Added support for <logger> and <level> elements in the
- DOMConfigurator
-
-
- As the Category and Priority classes have been
- replaced by the Logger and Level classes. The
- DOMConfigurator
- has been updated to allow the <logger> and
- <level>
- elements to be used in place of the <category> and
- <priority>
- elements. The old elements are still accepted for backward compatibility.
-
-
Added Threshold property to Hierarchy
-
- Changed DisableXXX() methods on Hierarchy to a
- Threshold
- property.
-
-
Added support for logging domains
-
- The LogManager supports multiple logging domains. The
- LogManager
- uses an instance of the IRepositorySelector class to map from
- domains to ILoggerRepository instances. The default implementation
- is to have a separate ILoggerRepository for each domain. When a
- call is made to the static methods on LogManager the domain can be
- specified (as a string) or the domain can be inferred automatically from the
- calling assembly. The default behavior is for each assembly loaded into the
- process to have its own domain and ILoggerRepository. These can
- each be configured separately. This allows standalone assemblies to use log4net
- without conflicting with other modules in the process. The domain for the
- assembly is configured using metadata attributes defined on the assembly.
-
-
DOMConfigurator can set params to arbitrary objects
-
- Using a new <object> element, params can now be set to any
- creatable object.
-
+ The RollingFileAppender now supports a new
+ rolling style, Once. In this mode the appender
+ will roll the file once per run.
+
+
+ SmtpAppender
+ authentication
+
+
+ On the .NET 1.1 platform only, the SmtpAppender supports
+ authenticating
+ against the mail server using either username and password or integrated NTLM authentication.
+
+
+ AdoNetAppender
+ ReconnectOnError
+
+
+ Added new configuration property to AdoNetAppender.
+ Setting ReconnectOnError to
+ true
+ will force the appender to attempt to reconnect to the database if the connection
+ is lost.
+
+
+ UdpAppender
+ hostname support
+
+
+ The UdpAppender config property
+ RemoteAddress
+ can now be specified as a DNS hostname string. The hostname is resolved to an IP address.
+
+
+
+
FxCop compliance
+
+ Updates to bring the internal code in line with the current FxCop rules.
+
+
Separate NUnit tests
+
+ Moved the NUnit tests into a separate project, log4net.Tests.
+
+
Bug Fixes
+
+
+ RemotingAppender
+
+
+
+ Sends events from a ThreadPool thread
+ rather than the calling thread to prevent transfer,
+ and potential loss, of the CallContext.
+
+
+
+ RollingFileAppender
+
+
+
+ Fixed date rolling period detection for non UTC timezones.
+
+
+
+ ColoredConsoleAppender
+
+
+
+ Updated to support writing more than 30,000 chars in a single message.
+ Fixed background color overspill if the console window needs to
+ scroll the contents.
+
+
+
-
+
+
+
+
+
+ Changed assembly name to
+ log4net
+
+
+ The build output is now
+ log4net.dll
+ for all frameworks. This is a breaking change.
+
+
+ To resolve cross platform and cross version issues we have
+ changed the log4net assembly to use a common name for all
+ frameworks. The assembly friendly name is now log4net.
+ The builds for each framework can now be differentiated
+ by the assembly title. This includes the name of the framework
+ that the assembly was built on.
+
+
Combined Release and ReleaseStrong builds
+
+ The Release and ReleaseStrong builds have been consolidated into
+ a single build called Release. This Release build is strongly named.
+
+
New Appender: ColoredConsoleAppender
+
+ The ColoredConsoleAppender writes events to the
+ application's console. It can be configured to specify the text and background
+ colors for different level events.
+
+
New Appender: SmtpPickupDirAppender
+
+ The SmtpPickupDirAppender generates SMTP compliant
+ messages and writes them to a local directory. These files can then be read
+ by an SMTP agent (e.g. the IIS SMTP Agent) and delivered.
+
+
New Layout: XmlLayoutSchemaLog4j
+
+ This new layout formats the logging events as XML which complies with
+ the Apache log4j™ event dtd. This can be used to transfer log event from log4net
+ to log4j. Currently the only appender that can communicate directly with
+ log4j is the UdpAppender.
+
+
New PatternLayout conversion characters
+
+ Added support for capturing the current thread principal name and the
+ app domain friendly name for each logging event.
+
+
+
%a
+
+ Used to output the friendly name of the AppDomain where the
+ logging event was generated.
+
+
%u
+
+ Used to output the user name for the currently active user
+ (Principal.Identity.Name).
+
+
+
Types specified in the config file are now loaded ignoring case
+
+ All types specified in the configuration files are now loaded
+ using a case insensitive method.
+
+
Fine grained fixing for buffered events
+
+ The LoggingEvent now supports fine grained
+ fixing of data that needs to be accessed outside the append context,
+ e.g. when an event is buffered. The new
+ Fix
+ property takes a combination of the
+ FixFlags
+ enumeration values.
+
+
Code updated inline with FxCop 1.21
+
+ In line with the FxCop 1.21 guidelines:
+ Sealed utility classes. Added serialization security demand to GetObjectData.
+ Renamed parameters.
+
+
EventLogAppender 32K Limit
+
+ There is a limit of 32K characters in an EventLog message. Added a
+ check that only logs the first 32000 characters from the rendered
+ message.
+
+
+
+
+
Updated to support the Microsoft .NET Framework 1.1 Final
+
+ Updated to support the Microsoft .NET Framework 1.1 Final Beta (1.1.4322).
+
+
Features document
+
+ Added a new document that covers the main features of log4net.
+ See the
+ features
+ document for more information.
+
+
Hierarchy disabled until it is configured
+
+ The Hierarchy is now disabled until it has been configured.
+ All messages logged to the Hierarchy before it has been
+ configured will be ignored without an error message being
+ written to the console.
+
+
+ If you are configuring log4net programmatically (i.e. not using
+ one of the built-in configurators) you must set the
+ ILoggerRepository.Configured
+ property
+ to true once you have configured
+ the repository.
+
+
+ The no appenders defined for a logger message will no longer be
+ displayed on the console by default. This message will only be
+ displayed if internal debugging is enabled.
+
+
New examples in VisualBasic.NET, JScript and Managed C++
+
+ New examples in VisualBasic.NET, JScript and Managed C++.
+ TODO Link to document about examples.
+
+
Code and Documentation Updates
+
+ Code fixes. Documentation and manual updates.
+ See the ChangeLog for more information.
+
+
Added document with example appender configurations
+ Not all frameworks are created equal and some features have been excluded from
+ some of the builds. See the Framework Support document for more
+ information.
+
+
New build system using NAnt
+
+ The new build system allows log4net to be built for all supported frameworks and
+ in all build configurations in one go.
+
+
New source code & distribution layout
+
+ The source code & distribution layout has been updated to support the new
+ build environment and multiple target frameworks.
+
+
Removed DomainAttribute.UseDefaultDomain property
+
+ Updated default behavior of DefaultRepositorySelector. Assemblies
+ are now by default placed into the default domain. To specify another domain,
+ the DomainAttribute must be used. This is the opposite behavior
+ to what was previously available. If you were previously specifying the
+ DomainAttribute.UseDefaultDomain
+ property then you should remove it, and if the default behavior is now
+ sufficient, you do not need to specify the DomainAttribute at all.
+
+
Updated configuration file parser
+
+ Updated config file parser to use the element name as the property to set. Also
+ removed <object> tag, the type attribute can now be
+ specified on the property element directly.
+
+ The EventLogAppender now supports setting the event ID in the
+ event log, this is taken from the EventID property from the per
+ event Properties map on the LoggingEvent.
+
+
Updated ADONetAppender
+
+
+
+ Added support for prepared statements and stored procedures
+
+
+ Added RawTimeStampLayoutto correctly convert the timestamps into
+ database date time format
+
+
+ Added ExceptionLayout to render the exception data
+
+
+
+
Support for front-end extension
+
+ This allows the logging API to be wrapped or adapted for specific purposes. Two
+ extension samples are included in the distribution:
+
+
+
+
+
+
+
+
+
+ Extension
+
+
+ Description
+
+
+
+
log4net.Ext.Trace
+
Adds trace logging methods
+
+
+
log4net.Ext.EventID
+
Adds additional eventId parameter to all methods
+
+
+
+
+
Added ForwardingAppender
+
Forwards events to multiple sub appenders after applying filter rules.
+
Added BufferingForwardingAppender
+
Forward events to sub appenders after buffering them.
+
Added ASPNetTraceAppender
+
Logs events to the ASP.NET trace system.
+
Added NetSendAppender
+
Delivers logging events using the Windows Messenger service.
+
Added UdpAppender
+
+ Sends logging events as connectionless UDP datagrams to a remote host or a
+ multicast group.
+
+
Removed obsolete methods
+
Lots of updates to improve our compliance with FxCop
+
Improved SDK documentation
+
+
+
+
+ Fixed Exception thrown when DOM Configurator called with a null XML
+ Element.
+
+
This occurred if the configuration file did not have a log4net section defined.
+
Made level lookup case insensitive
+
Prevented the Hierarchy's Threshold level from being set to a null reference
+
+
+
+
Added event specific properties to the logging event object
+
+ Appenders can add additional information to the events they are logging. The
+ RemotingAppender
+ and the SMTPAppender both add a 'hostname' property to the events.
+ These properties can be accessed using the PatternLayout with the
+ %P{name} syntax.
+
+
Added a plugin framework
+
+ An IPlugin interface can be attached to any repository.
+
+
+ A new RemoteLoggingServerPlugin plugin acts as the server for the
+ RemotingAppender
+
+
+ Updated the core log4net framework to work in an environment with no
+ permissions
+
+
Specific appenders still require additional permissions to log correctly
+
Added support for domain aliasing using the AliasDomainAttribute
+
+ This allows a parent assembly to take control of the logging domain for child
+ assemblies.
+
+
+ Added events for repository creation, configuration change, configuration reset
+ and repository shutdown
+
+
Added LevelMap to the ILoggerRepository interface
+
+ The mapping from level name to level object is now repository specific,
+ therefore each repository can have independent mappings.
+
+
Moved hierarchy specific config file parser to new DOMHierarchyConfigurator class
+
+ This is controlled by the Hierarchy object and allows for better
+ encapsulation.
+
+
Added OnlyFixPartialEventData property to the buffered appenders
+
+ This setting causes slow settings to be ignored. This significantly improves the
+ performance of the buffered appenders.
+
+
XML entity references are supported in the XML config file.
+
Added support for expanding environment variables in <param> values
+
+ The environment variables must be specified as ${FOO} where
+ FOO
+ is the name of the variable to expand.
+
+
Upgraded to use NUnit 2.0
+
File appenders can specify the encoding to use for the file
+
Added strong named configuration
+
+
+
+
Added log4net.Ext.Trace extension
+
This is a separate assembly that adds a trace level to log4net.
+
+ The default log file output directory is now the application base directory not
+ the current directory
+
+
Added MemoryAppender
+
Stores all the logging events in an in-memory buffer.
+
Moved the Hierarchy implementation into a separate namespace
+
+ The log4net.Repository.Hierarchy namespace now contains all the
+ code that is specific to the Hierarchy implementation.
+
+
Refactored the DOMConfigurator and BasicConfigurator
+
+ The Hierarchy specific data schema and implementation could be has
+ now been moved to the log4net.Repository.Hierarchy namespace. The
+ bootstrap code for these configurators remains in the
+ log4net.Config
+ namespace.
+
+
+ Replaced the DOMConfiguratorAttribute UseExecutableDomain
+ property with UseDefaultDomain
+
+
+ This change to the implementation of the DOMConfiguratorAttribute should
+ allow the configuration of multiple assemblies to be accomplished more easily,
+ especially when developing web applications (ASP.NET).
+
+
A few good bug fixes!
+
+
+
+
Added ADONetAppender
+
Thanks to TechnologyOneCorp.com.
+
Added TraceLogAssembly extensibility example
+
Lots of bug fixes
+
+
+
+
Added 6 new examples
+
Split Category class into Logger and LogManager classes
+
+ The instance methods from Category have moved to the
+ Logger
+ class. The static methods from Category have moved to the
+ LogManager
+ class. The Category class still exists but for backward
+ compatibility only. Changed interface ICategoryFactory to
+ ILoggerFactory
+ and the implementation class DefaultCategoryFactory to
+ DefaultLoggerFactory
+ .
+
+
Replaced Priority class with Level class
+
+ The Priority class has been replaced by the
+ Level
+ class.
+ The Priority class still exists for backward compatibility only.
+ The Level class implements a static pool of
+ Level
+ objects.
+ The Level class is sealed and serializable.
+
+
Added ILoggerRepository interface implemented by Hierarchy
+
+ The Hierarchy class implements the
+ ILoggerRepository
+ interface.
+ This interface is used by the LogManager class and therefore
+ allows different implementations of ILoggerRepository to be used.
+
+
Enhanced NUnit tests
+
+ All the NUnit tests can be run using a single TestSuite: NUnitGUI
+ log4net.LogManager+AllTests,log4net.dll.
+
+
Added support for serializing LoggingEvents
+
+ The LoggingEvent class is serializable. All local state is
+ captured before serialization occurs. This now allows
+ LoggingEvent
+ objects to be serialized between applications or machines.
+
+
Added RemotingAppender
+
+ Delivers LoggingEvents to a remote interface. This can be used to
+ collect distributed logging into a single log file. There is an example
+ remoting sink that receives the logging events, see
+ examples\net\remoting\RemotingServer
+ for details.
+
+
Added support for rendering composite objects
+
+ The IObjectRenderer interface method DoRender now
+ takes a RendererMap argument. This allows the renderer to use the
+ appropriate renderer from the RendererMap to render any nested
+ objects.
+
+
Added support for rendering exceptions
+
+ The DefaultRenderer now has support for rendering exceptions to a
+ string. This includes nested exceptions. The RendererMap is now
+ used to render exceptions in the LoggingEvent. This allows the
+ rendering of specific exceptions to be enhanced by specific renderers.
+
+
Added ITriggeringEventEvaluator interface
+
+ This interface is used by SMTPAppender and
+ RemotingAppender
+ to determine if a LoggingEvent meets a set of user defined
+ criteria. These appenders use the interface to determine whether or not to
+ deliver the current buffer of events to their listener. The interface is
+ implemented by the LevelEvaluator class, which triggers above a
+ set level.
+
+
Added regex matching to the MDCFilter, NDCFilter and StringMatchFilter
+
+ The MDCFilter, NDCFilter and
+ StringMatchFilter
+ can now be configured to use regex matches in addition to substring matches.
+ Set the RegexToMatch property to use this feature.
+
+
Added XMLLayout
+
+ emits an XML element for each LoggingEvent. This allows logging
+ events to be stored and manipulated as XML. The DTD for the XML emitted is in
+ the
+ log4net-events.dtd
+
+
+ Added support for <logger> and <level> elements in the
+ DOMConfigurator
+
+
+ As the Category and Priority classes have been
+ replaced by the Logger and Level classes. The
+ DOMConfigurator
+ has been updated to allow the <logger> and
+ <level>
+ elements to be used in place of the <category> and
+ <priority>
+ elements. The old elements are still accepted for backward compatibility.
+
+
Added Threshold property to Hierarchy
+
+ Changed DisableXXX() methods on Hierarchy to a
+ Threshold
+ property.
+
+
Added support for logging domains
+
+ The LogManager supports multiple logging domains. The
+ LogManager
+ uses an instance of the IRepositorySelector class to map from
+ domains to ILoggerRepository instances. The default implementation
+ is to have a separate ILoggerRepository for each domain. When a
+ call is made to the static methods on LogManager the domain can be
+ specified (as a string) or the domain can be inferred automatically from the
+ calling assembly. The default behavior is for each assembly loaded into the
+ process to have its own domain and ILoggerRepository. These can
+ each be configured separately. This allows standalone assemblies to use log4net
+ without conflicting with other modules in the process. The domain for the
+ assembly is configured using metadata attributes defined on the assembly.
+
+
DOMConfigurator can set params to arbitrary objects
+
+ Using a new <object> element, params can now be set to any
+ creatable object.
+
+
+
+
+
From d565df422dd7ba4fbb4b2b297582eb3437dc792c Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Fri, 1 Mar 2024 14:21:50 +0200
Subject: [PATCH 100/122] :wrench: upgrade update-version-info task and zarro
---
.gitignore | 2 ++
...version-info.js => update-version-info.ts} | 25 ++++++-------
package-lock.json | 36 ++++++++++++++-----
package.json | 8 +++--
4 files changed, 48 insertions(+), 23 deletions(-)
rename local-tasks/{update-version-info.js => update-version-info.ts} (81%)
diff --git a/.gitignore b/.gitignore
index ad029ec8f..32ccf02ca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -244,3 +244,5 @@ vs_buildtools.exe
dotnetfx35.exe
*.exe
/src/Binaries/*
+
+local-tasks/*.generated.js
\ No newline at end of file
diff --git a/local-tasks/update-version-info.js b/local-tasks/update-version-info.ts
similarity index 81%
rename from local-tasks/update-version-info.js
rename to local-tasks/update-version-info.ts
index c1e0353f7..8c48510aa 100644
--- a/local-tasks/update-version-info.js
+++ b/local-tasks/update-version-info.ts
@@ -1,3 +1,4 @@
+///
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
@@ -5,9 +6,9 @@
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -16,22 +17,22 @@
// under the License.
const
- gulp = requireModule("gulp");
+ gulp = requireModule("gulp");
gulp.task("update-version-info", async () => {
// the version as per the .csproj is the correct version, but there
// are other places where the version string is set via [assembly]
// attributes, so we need to re-align them all
const
- Git = require("simple-git/promise"),
- readTextFile = requireModule("read-text-file"),
- writeTextFile = requireModule("write-text-file"),
- readCsProjVersion = requireModule("read-csproj-version"),
- currentVersion = await readCsProjVersion("src/log4net/log4net.csproj"),
+ Git = require("simple-git"),
+ { readTextFile, writeTextFile } = require("yafs"),
+ { readProjectVersion } = requireModule("csproj-utils"),
+ currentVersion = await readProjectVersion("src/log4net/log4net.csproj"),
assemblyInfo = "src/log4net/AssemblyInfo.cs",
assemblyVersionInfo = "src/log4net/AssemblyVersionInfo.cs",
versionString = sanitiseVersion(currentVersion);
+
await updateVersionsIn(assemblyInfo, versionString);
await updateVersionsIn(assemblyVersionInfo, versionString);
@@ -43,9 +44,9 @@ gulp.task("update-version-info", async () => {
await git.commit(`:bookmark: update versioning to ${versionString}`);
async function updateVersionsIn(
- filePath,
- newVersion
- ) {
+ filePath: string,
+ newVersion: string
+ ): Promise {
const
contents = await readTextFile(filePath),
updated = contents
@@ -56,7 +57,7 @@ gulp.task("update-version-info", async () => {
await writeTextFile(filePath, updated);
}
- function sanitiseVersion(version) {
+ function sanitiseVersion(version: string): string {
const parts = version.split(".");
while (parts.length < 4) {
parts.push("0");
diff --git a/package-lock.json b/package-lock.json
index 1044a25f2..04544316f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -15,9 +15,10 @@
"gulp-zip": "^5.0.2",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
- "simple-git": "^3.16.0",
+ "simple-git": "^3.22.0",
+ "typescript": "^5.3.3",
"which": "^2.0.2",
- "yafs": "^1.5.0",
+ "yafs": "^1.36.0",
"zarro": "^1.169.0"
}
},
@@ -6597,9 +6598,9 @@
}
},
"node_modules/simple-git": {
- "version": "3.16.0",
- "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.16.0.tgz",
- "integrity": "sha512-zuWYsOLEhbJRWVxpjdiXl6eyAyGo/KzVW+KFhhw9MqEEJttcq+32jTWSGyxTdf9e/YCohxRE+9xpWFj9FdiJNw==",
+ "version": "3.22.0",
+ "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.22.0.tgz",
+ "integrity": "sha512-6JujwSs0ac82jkGjMHiCnTifvf1crOiY/+tfs/Pqih6iow7VrpNKRRNdWm6RtaXpvvv/JGNYhlUtLhGFqHF+Yw==",
"dev": true,
"dependencies": {
"@kwsites/file-exists": "^1.1.1",
@@ -7386,6 +7387,19 @@
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
"dev": true
},
+ "node_modules/typescript": {
+ "version": "5.3.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
+ "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
+ "dev": true,
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=14.17"
+ }
+ },
"node_modules/unbox-primitive": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz",
@@ -13255,9 +13269,9 @@
}
},
"simple-git": {
- "version": "3.16.0",
- "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.16.0.tgz",
- "integrity": "sha512-zuWYsOLEhbJRWVxpjdiXl6eyAyGo/KzVW+KFhhw9MqEEJttcq+32jTWSGyxTdf9e/YCohxRE+9xpWFj9FdiJNw==",
+ "version": "3.22.0",
+ "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.22.0.tgz",
+ "integrity": "sha512-6JujwSs0ac82jkGjMHiCnTifvf1crOiY/+tfs/Pqih6iow7VrpNKRRNdWm6RtaXpvvv/JGNYhlUtLhGFqHF+Yw==",
"dev": true,
"requires": {
"@kwsites/file-exists": "^1.1.1",
@@ -13907,6 +13921,12 @@
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
"dev": true
},
+ "typescript": {
+ "version": "5.3.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
+ "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
+ "dev": true
+ },
"unbox-primitive": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz",
diff --git a/package.json b/package.json
index 5f0607724..a3aa9a9aa 100644
--- a/package.json
+++ b/package.json
@@ -17,7 +17,8 @@
"dump-env": "node -e \"console.log(process.env);\"",
"release": "run-s update-version-info build-release prepare-build-artifacts build-site",
"zarro": "zarro",
- "update-version-info": "zarro @"
+ "update-version-info": "zarro @",
+ "this-is-an-example": "zarro @"
},
"repository": {
"type": "git",
@@ -36,9 +37,10 @@
"gulp-zip": "^5.0.2",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
- "simple-git": "^3.16.0",
+ "simple-git": "^3.22.0",
+ "typescript": "^5.3.3",
"which": "^2.0.2",
- "yafs": "^1.5.0",
+ "yafs": "^1.36.0",
"zarro": "^1.169.0"
}
}
From 2f9666e209dcafe9a91a0395f9e280132e154e50 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Fri, 1 Mar 2024 14:22:03 +0200
Subject: [PATCH 101/122] :bookmark: update versioning to 2.0.16.0
---
log4net.build | 2 +-
log4net.shfbproj | 2 +-
pom.xml | 2 +-
src/log4net/AssemblyInfo.cs | 46 +++++++++++++++---------------
src/log4net/AssemblyVersionInfo.cs | 4 +--
5 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/log4net.build b/log4net.build
index 0bb50afd0..7172d4f23 100644
--- a/log4net.build
+++ b/log4net.build
@@ -20,7 +20,7 @@ limitations under the License.
-
+
diff --git a/log4net.shfbproj b/log4net.shfbproj
index d8e22eb66..ae39e0377 100644
--- a/log4net.shfbproj
+++ b/log4net.shfbproj
@@ -33,7 +33,7 @@ limitations under the License.
.NET Framework 3.5doc\sdk\net\4.0\
- log4net-sdk-2.0.15
+ log4net-sdk-2.0.16en-USStandardBlank
diff --git a/pom.xml b/pom.xml
index f1787c14c..c7f190585 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
log4netapache-log4netpom
- 2.0.15
+ 2.0.16Apache log4netLogging framework for Microsoft .NET Framework.http://logging.apache.org/log4net/
diff --git a/src/log4net/AssemblyInfo.cs b/src/log4net/AssemblyInfo.cs
index a767ff7a2..2cae3b92b 100644
--- a/src/log4net/AssemblyInfo.cs
+++ b/src/log4net/AssemblyInfo.cs
@@ -55,77 +55,77 @@
//
#if (CLI_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-.CLI 1.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-.CLI 1.0")]
[assembly: AssemblyTitle("Apache log4net for CLI 1.0 Compatible Frameworks")]
#elif (NET_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-.NET 1.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-.NET 1.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 1.0")]
#elif (NET_1_1)
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-.NET 1.1")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-.NET 1.1")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 1.1")]
#elif (NET_4_5)
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-.NET 4.5")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-.NET 4.5")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 4.5")]
#elif (NET_4_0)
#if CLIENT_PROFILE
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-.NET 4.0 CP")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-.NET 4.0 CP")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 4.0 Client Profile")]
#else
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-.NET 4.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.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.15.0-.NET 3.5 CP")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-.NET 3.5 CP")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 3.5 Client Profile")]
#else
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-.NET 3.5")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-.NET 3.5")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 3.5")]
#endif // Client Profile
#elif (NET_2_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-.NET 2.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-.NET 2.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework 2.0")]
#elif (NETCF_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-.NETCF 1.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-.NETCF 1.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Compact Framework 1.0")]
#elif (NETCF_2_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-.NETCF 2.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-.NETCF 2.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Compact Framework 2.0")]
#elif (MONO_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-Mono 1.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-Mono 1.0")]
[assembly: AssemblyTitle("Apache log4net for Mono 1.0")]
#elif (MONO_2_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-Mono 2.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-Mono 2.0")]
[assembly: AssemblyTitle("Apache log4net for Mono 2.0")]
#elif (MONO_3_5)
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-Mono 3.5")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-Mono 3.5")]
[assembly: AssemblyTitle("Apache log4net for Mono 3.5")]
#elif (MONO_4_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-Mono 4.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-Mono 4.0")]
[assembly: AssemblyTitle("Apache log4net for Mono 4.0")]
#elif (SSCLI_1_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-SSCLI 1.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-SSCLI 1.0")]
[assembly: AssemblyTitle("Apache log4net for Shared Source CLI 1.0")]
#elif (NET)
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-.NET")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-.NET")]
[assembly: AssemblyTitle("Apache log4net for .NET Framework")]
#elif (NETSTANDARD1_3)
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-.NET Standard 1.3")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-.NET Standard 1.3")]
[assembly: AssemblyTitle("Apache log4net for .NET Standard 1.3")]
#elif (NETSTANDARD2_0)
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-.NET Standard 2.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-.NET Standard 2.0")]
[assembly: AssemblyTitle("Apache log4net for .NET Standard 2.0")]
#elif (NETCF)
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-.NETCF")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-.NETCF")]
[assembly: AssemblyTitle("Apache log4net for .NET Compact Framework")]
#elif (MONO)
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-Mono")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-Mono")]
[assembly: AssemblyTitle("Apache log4net for Mono")]
#elif (SSCLI)
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0-SSCLI")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0-SSCLI")]
[assembly: AssemblyTitle("Apache log4net for Shared Source CLI")]
#else
-[assembly: AssemblyInformationalVersionAttribute("2.0.15.0")]
+[assembly: AssemblyInformationalVersionAttribute("2.0.16.0")]
[assembly: AssemblyTitle("Apache log4net")]
#endif
diff --git a/src/log4net/AssemblyVersionInfo.cs b/src/log4net/AssemblyVersionInfo.cs
index 1c27d5799..14524de48 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.15.0")]
+[assembly: System.Reflection.AssemblyVersion("2.0.16.0")]
#if !NETCF
#if !SSCLI
-[assembly: System.Reflection.AssemblyFileVersion("2.0.15.0")]
+[assembly: System.Reflection.AssemblyFileVersion("2.0.16.0")]
#endif
#endif
From 66891fdde50c8ad16814ae7cd4867cdc9db1e687 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Fri, 1 Mar 2024 14:54:55 +0200
Subject: [PATCH 102/122] :bug: should delete old site before asking mvn to
make a new one
---
local-tasks/build-site.js | 53 ++++++++++++++++++++-------------------
1 file changed, 27 insertions(+), 26 deletions(-)
diff --git a/local-tasks/build-site.js b/local-tasks/build-site.js
index d63d91cd2..ec3524299 100644
--- a/local-tasks/build-site.js
+++ b/local-tasks/build-site.js
@@ -5,9 +5,9 @@
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -16,32 +16,33 @@
// under the License.
const
- gulp = requireModule("gulp"),
- spawn = requireModule("spawn"),
- env = requireModule("env"),
- os = require("os"),
- which = require("which");
+ gulp = requireModule("gulp"),
+ spawn = requireModule("spawn"),
+ env = requireModule("env"),
+ os = require("os"),
+ which = require("which");
gulp.task("build-site", async () => {
- let maven;
- try {
- maven = await which("mvn");
- } catch (e) {
- let extra;
- switch (os.platform()) {
- case "win32":
- extra = "You may install maven via chocolatey (https://chocolatey.org)";
- break;
- case "darwin":
- extra = "You may install maven via homebrew";
- break;
- default:
- extra = "You should install maven with your package manager";
- break;
- }
- throw new Error(`Unable to find mvn in your path. ${extra}`);
+ const { rm } = require("yafs");
+ let maven;
+ try {
+ maven = await which("mvn");
+ } catch (e) {
+ let extra;
+ switch (os.platform()) {
+ case "win32":
+ extra = "You may install maven via chocolatey (https://chocolatey.org)";
+ break;
+ case "darwin":
+ extra = "You may install maven via homebrew";
+ break;
+ default:
+ extra = "You should install maven with your package manager";
+ break;
}
-
- return spawn("mvn", [ "site" ]);
+ throw new Error(`Unable to find mvn in your path. ${ extra }`);
+ }
+ await rm("target");
+ return spawn("mvn", [ "site" ]);
});
From 77f016607ac1f2010868caf88059063691025033 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Fri, 1 Mar 2024 15:00:58 +0200
Subject: [PATCH 103/122] :fire: remove changelog item - it's not done yet!
---
src/site/xdoc/release/release-notes.xml | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/site/xdoc/release/release-notes.xml b/src/site/xdoc/release/release-notes.xml
index 4bb166de9..928b2002e 100644
--- a/src/site/xdoc/release/release-notes.xml
+++ b/src/site/xdoc/release/release-notes.xml
@@ -62,9 +62,6 @@ limitations under the License.
From 9f8a047ad669be080f2ecd4d5e93b460e9c0d2d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Volkan=20Yaz=C4=B1c=C4=B1?=
Date: Mon, 4 Mar 2024 09:02:33 +0100
Subject: [PATCH 104/122] Update copyright year in `NOTICE`
---
NOTICE | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/NOTICE b/NOTICE
index 468a2f549..eaab50a68 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
Apache log4net
- Copyright 2004-2022 The Apache Software Foundation
+ Copyright 2004-2024 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (https://www.apache.org/).
From fe6bf0559c0fb06545a28a5ea974b9fd48786894 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Mon, 4 Mar 2024 11:27:38 +0200
Subject: [PATCH 105/122] :memo: update build docs
---
doc/BUILDING.md | 33 +++++++++++++++++++++++++++++++--
src/log4net/log4net.csproj | 9 +--------
2 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/doc/BUILDING.md b/doc/BUILDING.md
index 597aafaf1..87d049166 100644
--- a/doc/BUILDING.md
+++ b/doc/BUILDING.md
@@ -1,11 +1,36 @@
## Building log4net
Log4net provides support for a wide array of targets, including
-- older .net 2 and 3.5 (including client profiles)
+- older .net 2 and 3.5 (including client profile for net-40)
- more modern net40/net45
- netstandard1.3/2.0
As such, it does require a relatively full .net environment on Windows to build.
+I have recently found a fairly freshly-installed win11 machine to work adequately,
+after adding the "windows feature" for ".NET Framework 3.5 (includes .NET 2.0 and 3.0)"
+
+TL;DR (Windows):
+- install Visual Studio Build Tools (at least VS2019)
+- install nodejs (at least v16)
+- install dotnet (v7+) and the .NET SDK (current latest)
+- install dotnet 2, 3, 3.5 via "add windows features"
+- in the project folder:
+ - `npm i`
+ - `npm run build`
+
+TL;DR (!Windows):
+- install the dotnet SDK - v7 or better (at time of writing, v8 is current but
+ I've had some issues elsewhere, so I'm waiting a bit before recommending it
+ everywhere
+- install Mono (you're going to need it to target certain versions of .NET)
+- install nodejs 16+
+ - in the project folder:
+ - `npm i`
+ - `export DOTNET_CORE=1 npm run build`
+ - we force using `dotnet` on non-windows targets for now. At some point,
+ this should become automatic
+
+## The full story
Options:
- build locally. Suggested environment:
@@ -35,6 +60,10 @@ Options:
- `npm run build`
- optionally `npm test` to run all tests
- optionally `npm run release` to generate release artifacts
+- build locally (CLI edition)
+ - install nodejs (at least v16)
+ - `npm i`
+ - `npm run build`
- 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
@@ -54,4 +83,4 @@ The site will be generated in `target/site`, and can be viewed locally. Updates
be pushed to the `asf-staging` branch of [https://github.com/apache/logging-log4net-site](https://github.com/apache/logging-log4net-site])
Once the site has been pushed to the `asf-staging` branch, it can be viewed at
-[http://logging.staged.apache.org/log4net](http://logging.staged.apache.org/log4net)
\ No newline at end of file
+[http://logging.staged.apache.org/log4net](http://logging.staged.apache.org/log4net)
diff --git a/src/log4net/log4net.csproj b/src/log4net/log4net.csproj
index be9355b4f..2c9e4a4e8 100644
--- a/src/log4net/log4net.csproj
+++ b/src/log4net/log4net.csproj
@@ -72,13 +72,6 @@
falsefalse
-
- .NETFramework
- v3.5
- Client
- ..\..\build\$(Configuration)\net35-client
- $(DefineConstants);NET_2_0;NET_3_5;CLIENT_PROFILE
- .NETFrameworkv4.0
@@ -212,4 +205,4 @@
-
\ No newline at end of file
+
From f43726a34d28519907f7d2c2a7c676a11d038e36 Mon Sep 17 00:00:00 2001
From: Davyd McColl
Date: Mon, 4 Mar 2024 12:25:50 +0200
Subject: [PATCH 106/122] :alembic: enable beta package building
---
.zarro-defaults | 11 +++++++++++
doc/BUILDING.md | 2 +-
package-lock.json | 14 +++++++-------
package.json | 3 ++-
pom.xml | 1 +
src/log4net.sln | 9 +++++++++
src/log4net/log4net.csproj | 1 +
7 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/.zarro-defaults b/.zarro-defaults
index 43b612c04..b7bbc3058 100644
--- a/.zarro-defaults
+++ b/.zarro-defaults
@@ -15,3 +15,14 @@ MAX_CONCURRENCY=1
# specify what to build (prevents accidental build of any other sln)
BUILD_INCLUDE=src/log4net.sln
+
+# using zarro's pack target, tell it what to pack
+PACK_INCLUDE_CSPROJ=log4net.csproj
+# the pack target increments the PackageVersion node in log4net.csproj
+# - setting this "truthy" propagates that change to the Version node
+PACK_SYNC_PROJECT_VERSION=1
+# all version changes should be manual, however, it's generally
+# accepted that the beta for, eg, 1.2.3 is 1.2.3-{date}-{sha}
+# ie beta packages carry the main version of their intended
+# release version
+PACK_INCREMENT_MINOR_ON_FIRST_RELEASE=0
diff --git a/doc/BUILDING.md b/doc/BUILDING.md
index 597aafaf1..aeff9f6bc 100644
--- a/doc/BUILDING.md
+++ b/doc/BUILDING.md
@@ -54,4 +54,4 @@ The site will be generated in `target/site`, and can be viewed locally. Updates
be pushed to the `asf-staging` branch of [https://github.com/apache/logging-log4net-site](https://github.com/apache/logging-log4net-site])
Once the site has been pushed to the `asf-staging` branch, it can be viewed at
-[http://logging.staged.apache.org/log4net](http://logging.staged.apache.org/log4net)
\ No newline at end of file
+[http://logging.staged.apache.org/log4net](http://logging.staged.apache.org/log4net)
diff --git a/package-lock.json b/package-lock.json
index 04544316f..f7ec4f498 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -19,7 +19,7 @@
"typescript": "^5.3.3",
"which": "^2.0.2",
"yafs": "^1.36.0",
- "zarro": "^1.169.0"
+ "zarro": "^1.168.5"
}
},
"node_modules/@kwsites/file-exists": {
@@ -7926,9 +7926,9 @@
}
},
"node_modules/zarro": {
- "version": "1.169.0",
- "resolved": "https://registry.npmjs.org/zarro/-/zarro-1.169.0.tgz",
- "integrity": "sha512-2k89dREJ3XKVefgB7PoXZAjnrRZ8f9RwLLuo3SnXabb9PZb3P1fVCC5S3wjGNsD/LoG7CtI27AUOp3uWg+buhQ==",
+ "version": "1.168.5",
+ "resolved": "https://registry.npmjs.org/zarro/-/zarro-1.168.5.tgz",
+ "integrity": "sha512-MPW/cBPUNnL4+JK+43/+xjlBMLKuJJn6n7X32JdAf7QoY6KkHA4vdqKtla1kX0mPSlEICPEqtHHRA2VQ+d/+9w==",
"dev": true,
"dependencies": {
"@octokit/rest": "^20.0.1",
@@ -14373,9 +14373,9 @@
}
},
"zarro": {
- "version": "1.169.0",
- "resolved": "https://registry.npmjs.org/zarro/-/zarro-1.169.0.tgz",
- "integrity": "sha512-2k89dREJ3XKVefgB7PoXZAjnrRZ8f9RwLLuo3SnXabb9PZb3P1fVCC5S3wjGNsD/LoG7CtI27AUOp3uWg+buhQ==",
+ "version": "1.168.5",
+ "resolved": "https://registry.npmjs.org/zarro/-/zarro-1.168.5.tgz",
+ "integrity": "sha512-MPW/cBPUNnL4+JK+43/+xjlBMLKuJJn6n7X32JdAf7QoY6KkHA4vdqKtla1kX0mPSlEICPEqtHHRA2VQ+d/+9w==",
"dev": true,
"requires": {
"@octokit/rest": "^20.0.1",
diff --git a/package.json b/package.json
index a3aa9a9aa..b4217cc3b 100644
--- a/package.json
+++ b/package.json
@@ -16,6 +16,7 @@
"prepare-build-artifacts": "zarro @",
"dump-env": "node -e \"console.log(process.env);\"",
"release": "run-s update-version-info build-release prepare-build-artifacts build-site",
+ "release-beta": "cross-env VERSION_INCREMENT_STRATEGY=prerelease BUILD_CONFIGURATION=Release zarro pack",
"zarro": "zarro",
"update-version-info": "zarro @",
"this-is-an-example": "zarro @"
@@ -41,6 +42,6 @@
"typescript": "^5.3.3",
"which": "^2.0.2",
"yafs": "^1.36.0",
- "zarro": "^1.169.0"
+ "zarro": "^1.168.5"
}
}
diff --git a/pom.xml b/pom.xml
index c7f190585..96d4cdc79 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,4 +1,5 @@