You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by bo...@apache.org on 2016/08/13 12:47:26 UTC
svn commit: r1756257 [2/2] - in /logging/log4net/trunk: ./ netstandard/
netstandard/log4net.tests/ netstandard/log4net/ src/ src/Appender/
src/Config/ src/Core/ src/Filter/ src/Layout/ src/Layout/Pattern/
src/ObjectRenderer/ src/Plugin/ src/Repository/...
Modified: logging/log4net/trunk/src/Core/LoggingEvent.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Core/LoggingEvent.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Core/LoggingEvent.cs (original)
+++ logging/log4net/trunk/src/Core/LoggingEvent.cs Sat Aug 13 12:47:25 2016
@@ -22,8 +22,10 @@ using System.Collections;
using System.IO;
#if (!NETCF)
using System.Runtime.Serialization;
+#if !NETSTANDARD1_3
using System.Security.Principal;
#endif
+#endif
using log4net.Util;
using log4net.Repository;
@@ -426,7 +428,7 @@ namespace log4net.Core
#region Protected Instance Constructors
-#if !NETCF
+#if !(NETCF || NETSTANDARD1_3)
/// <summary>
/// Serialization constructor
@@ -745,7 +747,7 @@ namespace log4net.Core
{
if (m_data.ThreadName == null && this.m_cacheUpdatable)
{
-#if NETCF
+#if NETCF || NETSTANDARD1_3
// Get thread ID only
m_data.ThreadName = SystemInfo.CurrentThreadId.ToString(System.Globalization.NumberFormatInfo.InvariantInfo);
#else
@@ -828,7 +830,7 @@ namespace log4net.Core
{
if (m_data.UserName == null && this.m_cacheUpdatable)
{
-#if (NETCF || SSCLI)
+#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
@@ -876,7 +878,7 @@ namespace log4net.Core
{
if (m_data.Identity == null && this.m_cacheUpdatable)
{
-#if (NETCF || SSCLI)
+#if (NETCF || SSCLI || NETSTANDARD1_3)
// On compact framework there's no notion of current thread principals
m_data.Identity = SystemInfo.NotAvailableText;
#else
@@ -1022,7 +1024,7 @@ namespace log4net.Core
/// is to be used outside that method.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0
+#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3
[System.Security.SecurityCritical]
#else
[System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter=true)]
@@ -1320,7 +1322,7 @@ namespace log4net.Core
{
m_compositeProperties.Add(m_eventProperties);
}
-#if !NETCF
+#if !(NETCF || NETSTANDARD1_3)
PropertiesDictionary logicalThreadProperties = LogicalThreadContext.Properties.GetProperties(false);
if (logicalThreadProperties != null)
{
Modified: logging/log4net/trunk/src/Filter/StringMatchFilter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Filter/StringMatchFilter.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Filter/StringMatchFilter.cs (original)
+++ logging/log4net/trunk/src/Filter/StringMatchFilter.cs Sat Aug 13 12:47:25 2016
@@ -95,7 +95,11 @@ namespace log4net.Filter
{
if (m_stringRegexToMatch != null)
{
+#if NETSTANDARD1_3
+ m_regexToMatch = new Regex(m_stringRegexToMatch);
+#else
m_regexToMatch = new Regex(m_stringRegexToMatch, RegexOptions.Compiled);
+#endif
}
}
Modified: logging/log4net/trunk/src/Layout/Pattern/DatePatternConverter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Layout/Pattern/DatePatternConverter.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Layout/Pattern/DatePatternConverter.cs (original)
+++ logging/log4net/trunk/src/Layout/Pattern/DatePatternConverter.cs Sat Aug 13 12:47:25 2016
@@ -18,6 +18,7 @@
#endregion
using System;
+using System.Globalization;
using System.Text;
using System.IO;
@@ -119,20 +120,34 @@ namespace log4net.Layout.Pattern
{
dateFormatStr = AbsoluteTimeDateFormatter.Iso8601TimeDateFormat;
}
-
- if (string.Compare(dateFormatStr, AbsoluteTimeDateFormatter.Iso8601TimeDateFormat, true, System.Globalization.CultureInfo.InvariantCulture) == 0)
+#if NETSTANDARD1_3
+ if (CultureInfo.InvariantCulture.CompareInfo.Compare(dateFormatStr, AbsoluteTimeDateFormatter.Iso8601TimeDateFormat, CompareOptions.IgnoreCase) == 0)
{
m_dateFormatter = new Iso8601DateFormatter();
}
- else if (string.Compare(dateFormatStr, AbsoluteTimeDateFormatter.AbsoluteTimeDateFormat, true, System.Globalization.CultureInfo.InvariantCulture) == 0)
+ else if (CultureInfo.InvariantCulture.CompareInfo.Compare(dateFormatStr, AbsoluteTimeDateFormatter.AbsoluteTimeDateFormat, CompareOptions.IgnoreCase) == 0)
{
m_dateFormatter = new AbsoluteTimeDateFormatter();
}
- else if (string.Compare(dateFormatStr, AbsoluteTimeDateFormatter.DateAndTimeDateFormat, true, System.Globalization.CultureInfo.InvariantCulture) == 0)
+ else if (CultureInfo.InvariantCulture.CompareInfo.Compare(dateFormatStr, AbsoluteTimeDateFormatter.DateAndTimeDateFormat, CompareOptions.IgnoreCase) == 0)
{
m_dateFormatter = new DateTimeDateFormatter();
}
- else
+#else
+ if (string.Compare(dateFormatStr, AbsoluteTimeDateFormatter.Iso8601TimeDateFormat, true, CultureInfo.InvariantCulture) == 0)
+ {
+ m_dateFormatter = new Iso8601DateFormatter();
+ }
+ else if (string.Compare(dateFormatStr, AbsoluteTimeDateFormatter.AbsoluteTimeDateFormat, true, CultureInfo.InvariantCulture) == 0)
+ {
+ m_dateFormatter = new AbsoluteTimeDateFormatter();
+ }
+ else if (string.Compare(dateFormatStr, AbsoluteTimeDateFormatter.DateAndTimeDateFormat, true, CultureInfo.InvariantCulture) == 0)
+ {
+ m_dateFormatter = new DateTimeDateFormatter();
+ }
+#endif
+ else
{
try
{
Modified: logging/log4net/trunk/src/Layout/Pattern/ExceptionPatternConverter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Layout/Pattern/ExceptionPatternConverter.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Layout/Pattern/ExceptionPatternConverter.cs (original)
+++ logging/log4net/trunk/src/Layout/Pattern/ExceptionPatternConverter.cs Sat Aug 13 12:47:25 2016
@@ -106,9 +106,11 @@ namespace log4net.Layout.Pattern
case "stacktrace":
WriteObject(writer, loggingEvent.Repository, loggingEvent.ExceptionObject.StackTrace);
break;
+#if !NETSTANDARD1_3
case "targetsite":
WriteObject(writer, loggingEvent.Repository, loggingEvent.ExceptionObject.TargetSite);
break;
+#endif
case "helplink":
WriteObject(writer, loggingEvent.Repository, loggingEvent.ExceptionObject.HelpLink);
break;
Modified: logging/log4net/trunk/src/Layout/PatternLayout.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Layout/PatternLayout.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Layout/PatternLayout.cs (original)
+++ logging/log4net/trunk/src/Layout/PatternLayout.cs Sat Aug 13 12:47:25 2016
@@ -20,6 +20,9 @@
using System;
using System.Collections;
using System.IO;
+#if NETSTANDARD1_3
+using System.Reflection;
+#endif
using log4net.Core;
using log4net.Layout.Pattern;
@@ -861,7 +864,7 @@ namespace log4net.Layout
// .NET Compact Framework 1.0 has no support for ASP.NET
// SSCLI 1.0 has no support for ASP.NET
-#if !NETCF && !SSCLI && !CLIENT_PROFILE
+#if !NETCF && !SSCLI && !CLIENT_PROFILE && !NETSTANDARD1_3
s_globalRulesRegistry.Add("aspnet-cache", typeof(AspNetCachePatternConverter));
s_globalRulesRegistry.Add("aspnet-context", typeof(AspNetContextPatternConverter));
s_globalRulesRegistry.Add("aspnet-request", typeof(AspNetRequestPatternConverter));
@@ -905,7 +908,7 @@ namespace log4net.Layout
s_globalRulesRegistry.Add("r", typeof(RelativeTimePatternConverter));
s_globalRulesRegistry.Add("timestamp", typeof(RelativeTimePatternConverter));
-#if !NETCF
+#if !(NETCF || NETSTANDARD1_3)
s_globalRulesRegistry.Add("stacktrace", typeof(StackTracePatternConverter));
s_globalRulesRegistry.Add("stacktracedetail", typeof(StackTraceDetailPatternConverter));
#endif
Modified: logging/log4net/trunk/src/Layout/RawLayoutConverter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Layout/RawLayoutConverter.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Layout/RawLayoutConverter.cs (original)
+++ logging/log4net/trunk/src/Layout/RawLayoutConverter.cs Sat Aug 13 12:47:25 2016
@@ -18,6 +18,9 @@
#endregion
using System;
+#if NETSTANDARD1_3
+using System.Reflection;
+#endif
using log4net;
using log4net.Core;
Modified: logging/log4net/trunk/src/Layout/XmlLayout.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Layout/XmlLayout.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Layout/XmlLayout.cs (original)
+++ logging/log4net/trunk/src/Layout/XmlLayout.cs Sat Aug 13 12:47:25 2016
@@ -220,7 +220,7 @@ namespace log4net.Layout
writer.WriteStartElement(m_elmEvent);
writer.WriteAttributeString(ATTR_LOGGER, loggingEvent.LoggerName);
-#if NET_2_0 || NETCF_2_0 || MONO_2_0
+#if NET_2_0 || NETCF_2_0 || MONO_2_0 || NETSTANDARD1_3
writer.WriteAttributeString(ATTR_TIMESTAMP, XmlConvert.ToString(loggingEvent.TimeStamp, XmlDateTimeSerializationMode.Local));
#else
writer.WriteAttributeString(ATTR_TIMESTAMP, XmlConvert.ToString(loggingEvent.TimeStamp));
Modified: logging/log4net/trunk/src/Layout/XmlLayoutBase.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Layout/XmlLayoutBase.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Layout/XmlLayoutBase.cs (original)
+++ logging/log4net/trunk/src/Layout/XmlLayoutBase.cs Sat Aug 13 12:47:25 2016
@@ -196,11 +196,18 @@ namespace log4net.Layout
{
throw new ArgumentNullException("loggingEvent");
}
-
+#if NETSTANDARD1_3
+ var settings = new XmlWriterSettings
+ {
+ Indent = false,
+ OmitXmlDeclaration = true
+ };
+ var xmlWriter = XmlWriter.Create(new ProtectCloseTextWriter(writer), settings);
+#else
XmlTextWriter xmlWriter = new XmlTextWriter(new ProtectCloseTextWriter(writer));
xmlWriter.Formatting = Formatting.None;
xmlWriter.Namespaces = false;
-
+#endif
// Write the event to the writer
FormatXml(xmlWriter, loggingEvent);
Modified: logging/log4net/trunk/src/LogManager.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/LogManager.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/LogManager.cs (original)
+++ logging/log4net/trunk/src/LogManager.cs Sat Aug 13 12:47:25 2016
@@ -73,6 +73,7 @@ namespace log4net
#region Type Specific Manager Methods
+#if !NETSTANDARD1_3 // Excluded because GetCallingAssembly() is not available in CoreFX (https://github.com/dotnet/corefx/issues/2221).
/// <overloads>Returns the named logger if it exists.</overloads>
/// <summary>
/// Returns the named logger if it exists.
@@ -89,24 +90,61 @@ namespace log4net
{
return Exists(Assembly.GetCallingAssembly(), name);
}
-
+
+ /// <overloads>Get the currently defined loggers.</overloads>
/// <summary>
- /// Returns the named logger if it exists.
+ /// Returns all the currently defined loggers in the default repository.
+ /// </summary>
+ /// <remarks>
+ /// <para>The root logger is <b>not</b> included in the returned array.</para>
+ /// </remarks>
+ /// <returns>All the defined loggers.</returns>
+ public static ILog[] GetCurrentLoggers()
+ {
+ return GetCurrentLoggers(Assembly.GetCallingAssembly());
+ }
+
+ /// <overloads>Get or create a logger.</overloads>
+ /// <summary>
+ /// Retrieves or creates a named logger.
/// </summary>
/// <remarks>
/// <para>
- /// If the named logger exists (in the specified repository) then it
- /// returns a reference to the logger, otherwise it returns
- /// <c>null</c>.
+ /// Retrieves a logger named as the <paramref name="name"/>
+ /// parameter. If the named logger already exists, then the
+ /// existing instance will be returned. Otherwise, a new instance is
+ /// created.
+ /// </para>
+ /// <para>By default, loggers do not have a set level but inherit
+ /// it from the hierarchy. This is one of the central features of
+ /// log4net.
/// </para>
/// </remarks>
- /// <param name="repository">The repository to lookup in.</param>
- /// <param name="name">The fully qualified logger name to look for.</param>
- /// <returns>
- /// The logger found, or <c>null</c> if the logger doesn't exist in the specified
- /// repository.
- /// </returns>
- public static ILog Exists(string repository, string name)
+ /// <param name="name">The name of the logger to retrieve.</param>
+ /// <returns>The logger with the name specified.</returns>
+ public static ILog GetLogger(string name)
+ {
+ return GetLogger(Assembly.GetCallingAssembly(), name);
+ }
+#endif // !NETSTANDARD1_3
+
+ /// <summary>
+ /// Returns the named logger if it exists.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If the named logger exists (in the specified repository) then it
+ /// returns a reference to the logger, otherwise it returns
+ /// <c>null</c>.
+ /// </para>
+ /// </remarks>
+ /// <param name="repository">The repository to lookup in.</param>
+ /// <param name="name">The fully qualified logger name to look for.</param>
+ /// <returns>
+ /// The logger found, or <c>null</c> if the logger doesn't exist in the specified
+ /// repository.
+ /// </returns>
+ public static ILog Exists(string repository, string name)
{
return WrapLogger(LoggerManager.Exists(repository, name));
}
@@ -132,19 +170,6 @@ namespace log4net
return WrapLogger(LoggerManager.Exists(repositoryAssembly, name));
}
- /// <overloads>Get the currently defined loggers.</overloads>
- /// <summary>
- /// Returns all the currently defined loggers in the default repository.
- /// </summary>
- /// <remarks>
- /// <para>The root logger is <b>not</b> included in the returned array.</para>
- /// </remarks>
- /// <returns>All the defined loggers.</returns>
- public static ILog[] GetCurrentLoggers()
- {
- return GetCurrentLoggers(Assembly.GetCallingAssembly());
- }
-
/// <summary>
/// Returns all the currently defined loggers in the specified repository.
/// </summary>
@@ -171,29 +196,6 @@ namespace log4net
return WrapLoggers(LoggerManager.GetCurrentLoggers(repositoryAssembly));
}
- /// <overloads>Get or create a logger.</overloads>
- /// <summary>
- /// Retrieves or creates a named logger.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Retrieves a logger named as the <paramref name="name"/>
- /// parameter. If the named logger already exists, then the
- /// existing instance will be returned. Otherwise, a new instance is
- /// created.
- /// </para>
- /// <para>By default, loggers do not have a set level but inherit
- /// it from the hierarchy. This is one of the central features of
- /// log4net.
- /// </para>
- /// </remarks>
- /// <param name="name">The name of the logger to retrieve.</param>
- /// <returns>The logger with the name specified.</returns>
- public static ILog GetLogger(string name)
- {
- return GetLogger(Assembly.GetCallingAssembly(), name);
- }
-
/// <summary>
/// Retrieves or creates a named logger.
/// </summary>
@@ -252,7 +254,11 @@ namespace log4net
/// <returns>The logger with the name specified.</returns>
public static ILog GetLogger(Type type)
{
+#if NETSTANDARD1_3
+ return GetLogger(type.GetTypeInfo().Assembly, type.FullName);
+#else
return GetLogger(Assembly.GetCallingAssembly(), type.FullName);
+#endif
}
/// <summary>
@@ -311,6 +317,7 @@ namespace log4net
LoggerManager.Shutdown();
}
+#if !NETSTANDARD1_3
/// <overloads>Shutdown a logger repository.</overloads>
/// <summary>
/// Shuts down the default repository.
@@ -335,6 +342,7 @@ namespace log4net
ShutdownRepository(Assembly.GetCallingAssembly());
}
+#endif
/// <summary>
/// Shuts down the repository for the repository specified.
/// </summary>
@@ -387,6 +395,7 @@ namespace log4net
LoggerManager.ShutdownRepository(repositoryAssembly);
}
+#if !NETSTANDARD1_3
/// <overloads>Reset the configuration of a repository</overloads>
/// <summary>
/// Resets all values contained in this repository instance to their defaults.
@@ -405,6 +414,7 @@ namespace log4net
{
ResetConfiguration(Assembly.GetCallingAssembly());
}
+#endif
/// <summary>
/// Resets all values contained in this repository instance to their defaults.
@@ -444,6 +454,7 @@ namespace log4net
LoggerManager.ResetConfiguration(repositoryAssembly);
}
+#if !NETSTANDARD1_3
/// <overloads>Get the logger repository.</overloads>
/// <summary>
/// Returns the default <see cref="ILoggerRepository"/> instance.
@@ -460,6 +471,7 @@ namespace log4net
{
return GetRepository(Assembly.GetCallingAssembly());
}
+#endif
/// <summary>
/// Returns the default <see cref="ILoggerRepository"/> instance.
@@ -495,6 +507,7 @@ namespace log4net
return GetRepository(repositoryAssembly);
}
+#if !NETSTANDARD1_3
/// <overloads>Get a logger repository.</overloads>
/// <summary>
/// Returns the default <see cref="ILoggerRepository"/> instance.
@@ -510,6 +523,7 @@ namespace log4net
{
return GetRepository(Assembly.GetCallingAssembly());
}
+#endif
/// <summary>
/// Returns the default <see cref="ILoggerRepository"/> instance.
@@ -543,6 +557,7 @@ namespace log4net
return LoggerManager.GetRepository(repositoryAssembly);
}
+#if !NETSTANDARD1_3
/// <overloads>Create a domain</overloads>
/// <summary>
/// Creates a repository with the specified repository type.
@@ -586,6 +601,7 @@ namespace log4net
{
return CreateRepository(Assembly.GetCallingAssembly(), repositoryType);
}
+#endif
/// <summary>
/// Creates a repository with the specified name.
Modified: logging/log4net/trunk/src/ObjectRenderer/RendererMap.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/ObjectRenderer/RendererMap.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/ObjectRenderer/RendererMap.cs (original)
+++ logging/log4net/trunk/src/ObjectRenderer/RendererMap.cs Sat Aug 13 12:47:25 2016
@@ -19,6 +19,10 @@
using System;
using System.IO;
+#if NETSTANDARD1_3
+using System.Reflection;
+#endif
+
using log4net.Util;
namespace log4net.ObjectRenderer
@@ -216,7 +220,11 @@ namespace log4net.ObjectRenderer
if (result == null)
{
+#if NETSTANDARD1_3
+ for (Type cur = type; cur != null; cur = cur.GetTypeInfo().BaseType)
+#else
for(Type cur = type; cur != null; cur = cur.BaseType)
+#endif
{
// Search the type's interfaces
result = SearchTypeAndInterfaces(cur);
Modified: logging/log4net/trunk/src/Plugin/PluginCollection.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Plugin/PluginCollection.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Plugin/PluginCollection.cs (original)
+++ logging/log4net/trunk/src/Plugin/PluginCollection.cs Sat Aug 13 12:47:25 2016
@@ -26,7 +26,10 @@ namespace log4net.Plugin
/// A strongly-typed collection of <see cref="IPlugin"/> objects.
/// </summary>
/// <author>Nicko Cadell</author>
- public class PluginCollection : ICollection, IList, IEnumerable, ICloneable
+ public class PluginCollection : ICollection, IList, IEnumerable
+#if !NETSTANDARD1_3
+ , ICloneable
+#endif
{
#region Interfaces
@@ -209,10 +212,10 @@ namespace log4net.Plugin
/// <summary>
/// Gets a value indicating whether access to the collection is synchronized (thread-safe).
/// </summary>
- /// <returns>true if access to the ICollection is synchronized (thread-safe); otherwise, false.</returns>
+ /// <returns>false, because the backing type is an array, which is never thread-safe.</returns>
public virtual bool IsSynchronized
{
- get { return m_array.IsSynchronized; }
+ get { return false; }
}
/// <summary>
@@ -223,7 +226,7 @@ namespace log4net.Plugin
/// </value>
public virtual object SyncRoot
{
- get { return m_array.SyncRoot; }
+ get { return m_array; }
}
#endregion
Modified: logging/log4net/trunk/src/Repository/Hierarchy/Logger.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Repository/Hierarchy/Logger.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Repository/Hierarchy/Logger.cs (original)
+++ logging/log4net/trunk/src/Repository/Hierarchy/Logger.cs Sat Aug 13 12:47:25 2016
@@ -73,7 +73,7 @@ namespace log4net.Repository.Hierarchy
/// </remarks>
protected Logger(string name)
{
-#if NETCF
+#if NETCF || NETSTANDARD1_3
// NETCF: String.Intern causes Native Exception
m_name = name;
#else
@@ -432,7 +432,7 @@ namespace log4net.Repository.Hierarchy
{
log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex);
}
-#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0
+#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0 && !NETSTANDARD1_3
catch
{
log4net.Util.LogLog.Error(declaringType, "Exception while logging");
@@ -469,7 +469,7 @@ namespace log4net.Repository.Hierarchy
{
log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex);
}
-#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0
+#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0 && !NETSTANDARD1_3
catch
{
log4net.Util.LogLog.Error(declaringType, "Exception while logging");
@@ -509,7 +509,7 @@ namespace log4net.Repository.Hierarchy
{
log4net.Util.LogLog.Error(declaringType, "Exception while logging", ex);
}
-#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0
+#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0 && !NETSTANDARD1_3
catch
{
log4net.Util.LogLog.Error(declaringType, "Exception while logging");
@@ -606,7 +606,7 @@ namespace log4net.Repository.Hierarchy
{
LogLog.Debug(declaringType, " Current AppDomain context information: ");
LogLog.Debug(declaringType, " BaseDirectory : " + SystemInfo.ApplicationBaseDirectory);
-#if !NETCF
+#if !(NETCF || NETSTANDARD1_3)
LogLog.Debug(declaringType, " FriendlyName : " + AppDomain.CurrentDomain.FriendlyName);
LogLog.Debug(declaringType, " DynamicDirectory: " + AppDomain.CurrentDomain.DynamicDirectory);
#endif
Modified: logging/log4net/trunk/src/Repository/Hierarchy/LoggerKey.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Repository/Hierarchy/LoggerKey.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Repository/Hierarchy/LoggerKey.cs (original)
+++ logging/log4net/trunk/src/Repository/Hierarchy/LoggerKey.cs Sat Aug 13 12:47:25 2016
@@ -64,7 +64,7 @@ namespace log4net.Repository.Hierarchy
/// <param name="name">The name of the logger.</param>
internal LoggerKey(string name)
{
-#if NETCF
+#if NETCF || NETSTANDARD1_3
// NETCF: String.Intern causes Native Exception
m_name = name;
#else
@@ -115,7 +115,7 @@ namespace log4net.Repository.Hierarchy
LoggerKey objKey = obj as LoggerKey;
if (objKey != null)
{
-#if NETCF
+#if NETCF || NETSTANDARD1_3
return ( m_name == objKey.m_name );
#else
// Compare reference types rather than string's overloaded ==
Modified: logging/log4net/trunk/src/Repository/Hierarchy/XmlHierarchyConfigurator.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Repository/Hierarchy/XmlHierarchyConfigurator.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Repository/Hierarchy/XmlHierarchyConfigurator.cs (original)
+++ logging/log4net/trunk/src/Repository/Hierarchy/XmlHierarchyConfigurator.cs Sat Aug 13 12:47:25 2016
@@ -300,7 +300,11 @@ namespace log4net.Repository.Hierarchy
LogLog.Debug(declaringType, "Loading Appender [" + appenderName + "] type: [" + typeName + "]");
try
{
+#if NETSTANDARD1_3
+ IAppender appender = (IAppender)Activator.CreateInstance(SystemInfo.GetTypeFromString(this.GetType().GetTypeInfo().Assembly, typeName, true, true));
+#else
IAppender appender = (IAppender)Activator.CreateInstance(SystemInfo.GetTypeFromString(typeName, true, true));
+#endif
appender.Name = appenderName;
foreach (XmlNode currentNode in appenderElement.ChildNodes)
@@ -486,7 +490,11 @@ namespace log4net.Repository.Hierarchy
{
try
{
+#if NETSTANDARD1_3
+ m_hierarchy.RendererMap.Put(SystemInfo.GetTypeFromString(this.GetType().GetTypeInfo().Assembly, renderedClassName, true, true), renderer);
+#else
m_hierarchy.RendererMap.Put(SystemInfo.GetTypeFromString(renderedClassName, true, true), renderer);
+#endif
}
catch(Exception e)
{
@@ -630,7 +638,7 @@ namespace log4net.Repository.Hierarchy
if(propertyValue != null)
{
-#if !NETCF
+#if !(NETCF || NETSTANDARD1_3) // NETSTANDARD1_3: System.Runtime.InteropServices.RuntimeInformation not available on desktop 4.6
try
{
// Expand environment variables in the string.
@@ -658,7 +666,11 @@ namespace log4net.Repository.Hierarchy
// Read the explicit subtype
try
{
+#if NETSTANDARD1_3
+ Type subType = SystemInfo.GetTypeFromString(this.GetType().GetTypeInfo().Assembly, subTypeString, true, true);
+#else
Type subType = SystemInfo.GetTypeFromString(subTypeString, true, true);
+#endif
LogLog.Debug(declaringType, "Parameter ["+name+"] specified subtype ["+subType.FullName+"]");
@@ -713,7 +725,11 @@ namespace log4net.Repository.Hierarchy
try
{
// Pass to the property
+#if NETSTANDARD1_3 // TODO BindingFlags is available for netstandard1.5
+ propInfo.SetValue(target, convertedValue, null);
+#else
propInfo.SetValue(target, convertedValue, BindingFlags.SetProperty, null, null, CultureInfo.InvariantCulture);
+#endif
}
catch(TargetInvocationException targetInvocationEx)
{
@@ -728,7 +744,11 @@ namespace log4net.Repository.Hierarchy
try
{
// Pass to the property
+#if NETSTANDARD1_3 // TODO BindingFlags is available for netstandard1.5
+ methInfo.Invoke(target, new[] { convertedValue });
+#else
methInfo.Invoke(target, BindingFlags.InvokeMethod, null, new object[] {convertedValue}, CultureInfo.InvariantCulture);
+#endif
}
catch(TargetInvocationException targetInvocationEx)
{
@@ -780,7 +800,11 @@ namespace log4net.Repository.Hierarchy
try
{
// Pass to the property
+#if NETSTANDARD1_3 // TODO BindingFlags is available for netstandard1.5
+ propInfo.SetValue(target, createdObject, null);
+#else
propInfo.SetValue(target, createdObject, BindingFlags.SetProperty, null, null, CultureInfo.InvariantCulture);
+#endif
}
catch(TargetInvocationException targetInvocationEx)
{
@@ -795,7 +819,11 @@ namespace log4net.Repository.Hierarchy
try
{
// Pass to the property
+#if NETSTANDARD1_3 // TODO BindingFlags is available for netstandard1.5
+ methInfo.Invoke(target, new[] { createdObject });
+#else
methInfo.Invoke(target, BindingFlags.InvokeMethod, null, new object[] {createdObject}, CultureInfo.InvariantCulture);
+#endif
}
catch(TargetInvocationException targetInvocationEx)
{
@@ -831,7 +859,12 @@ namespace log4net.Repository.Hierarchy
/// <returns><c>true</c> if the type is creatable using a default constructor, <c>false</c> otherwise</returns>
private static bool IsTypeConstructible(Type type)
{
+#if NETSTANDARD1_3
+ TypeInfo typeInfo = type.GetTypeInfo();
+ if (typeInfo.IsClass && !typeInfo.IsAbstract)
+#else
if (type.IsClass && !type.IsAbstract)
+#endif
{
ConstructorInfo defaultConstructor = type.GetConstructor(new Type[0]);
if (defaultConstructor != null && !defaultConstructor.IsAbstract && !defaultConstructor.IsPrivate)
@@ -866,8 +899,13 @@ namespace log4net.Repository.Hierarchy
{
if (!methInfo.IsStatic)
{
+#if NETSTANDARD1_3
+ if (CultureInfo.InvariantCulture.CompareInfo.Compare(methInfo.Name, requiredMethodNameA, CompareOptions.IgnoreCase) == 0 ||
+ CultureInfo.InvariantCulture.CompareInfo.Compare(methInfo.Name, requiredMethodNameB, CompareOptions.IgnoreCase) == 0)
+#else
if (string.Compare(methInfo.Name, requiredMethodNameA, true, System.Globalization.CultureInfo.InvariantCulture) == 0 ||
string.Compare(methInfo.Name, requiredMethodNameB, true, System.Globalization.CultureInfo.InvariantCulture) == 0)
+#endif
{
// Found matching method name
@@ -955,7 +993,11 @@ namespace log4net.Repository.Hierarchy
// Read the explicit object type
try
{
+#if NETSTANDARD1_3
+ objectType = SystemInfo.GetTypeFromString(this.GetType().GetTypeInfo().Assembly, objectTypeString, true, true);
+#else
objectType = SystemInfo.GetTypeFromString(objectTypeString, true, true);
+#endif
}
catch(Exception ex)
{
@@ -1027,7 +1069,7 @@ namespace log4net.Repository.Hierarchy
#endregion Protected Instance Methods
-#if !NETCF
+#if !(NETCF || NETSTANDARD1_3) // NETSTANDARD1_3: System.Runtime.InteropServices.RuntimeInformation not available on desktop 4.6
private bool HasCaseInsensitiveEnvironment
{
get
Modified: logging/log4net/trunk/src/Util/ILogExtensions.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/ILogExtensions.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/ILogExtensions.cs (original)
+++ logging/log4net/trunk/src/Util/ILogExtensions.cs Sat Aug 13 12:47:25 2016
@@ -17,7 +17,7 @@
//
#endregion
-#if NET_3_5 || NET_4_0 || MONO_3_5 || MONO_4_0
+#if NET_3_5 || NET_4_0 || MONO_3_5 || MONO_4_0 || NETSTANDARD1_3
using System;
Modified: logging/log4net/trunk/src/Util/LogLog.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/LogLog.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/LogLog.cs (original)
+++ logging/log4net/trunk/src/Util/LogLog.cs Sat Aug 13 12:47:25 2016
@@ -19,7 +19,9 @@
using System;
using System.Collections;
+#if !NETSTANDARD1_3
using System.Configuration;
+#endif
using System.Diagnostics;
namespace log4net.Util
Modified: logging/log4net/trunk/src/Util/NativeError.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/NativeError.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/NativeError.cs (original)
+++ logging/log4net/trunk/src/Util/NativeError.cs Sat Aug 13 12:47:25 2016
@@ -114,7 +114,7 @@ namespace log4net.Util
/// native Win32 <c>FormatMessage</c> function.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0
+#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3
[System.Security.SecuritySafeCritical]
#elif !NETCF
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode=true)]
@@ -157,7 +157,7 @@ namespace log4net.Util
/// using the native <c>FormatMessage</c> function.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0
+#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3
[System.Security.SecuritySafeCritical]
#elif !NETCF
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, UnmanagedCode = true)]
Modified: logging/log4net/trunk/src/Util/OptionConverter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/OptionConverter.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/OptionConverter.cs (original)
+++ logging/log4net/trunk/src/Util/OptionConverter.cs Sat Aug 13 12:47:25 2016
@@ -286,7 +286,11 @@ namespace log4net.Util
}
else
{
+#if NETSTANDARD1_3
+ if (target.GetTypeInfo().IsEnum)
+#else
if (target.IsEnum)
+#endif
{
// Target type is an enum.
@@ -303,7 +307,11 @@ namespace log4net.Util
if (meth != null)
{
// Call the Parse method
+#if NETSTANDARD1_3
+ return meth.Invoke(target, new[] { txt });
+#else
return meth.Invoke(null, BindingFlags.InvokeMethod, null, new object[] {txt}, CultureInfo.InvariantCulture);
+#endif
}
else
{
@@ -475,7 +483,11 @@ namespace log4net.Util
{
try
{
+#if NETSTANDARD1_3
+ Type classObj = SystemInfo.GetTypeFromString(superClass.GetTypeInfo().Assembly, className, true, true);
+#else
Type classObj = SystemInfo.GetTypeFromString(className, true, true);
+#endif
if (!superClass.IsAssignableFrom(classObj))
{
LogLog.Error(declaringType, "OptionConverter: A [" + className + "] object is not assignable to a [" + superClass.FullName + "] variable.");
Modified: logging/log4net/trunk/src/Util/PatternParser.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/PatternParser.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/PatternParser.cs (original)
+++ logging/log4net/trunk/src/Util/PatternParser.cs Sat Aug 13 12:47:25 2016
@@ -232,7 +232,11 @@ namespace log4net.Util
{
formattingInfo.Min = 0;
}
+#if NETSTANDARD1_3
+ formattingInfo.Min = (formattingInfo.Min * 10) + int.Parse(pattern[offset].ToString(), System.Globalization.NumberFormatInfo.InvariantInfo);
+#else
formattingInfo.Min = (formattingInfo.Min * 10) + int.Parse(pattern[offset].ToString(CultureInfo.InvariantCulture), System.Globalization.NumberFormatInfo.InvariantInfo);
+#endif
offset++;
}
// Look for the separator between min and max
@@ -252,7 +256,11 @@ namespace log4net.Util
{
formattingInfo.Max = 0;
}
+#if NETSTANDARD1_3
+ formattingInfo.Max = (formattingInfo.Max * 10) + int.Parse(pattern[offset].ToString(), System.Globalization.NumberFormatInfo.InvariantInfo);
+#else
formattingInfo.Max = (formattingInfo.Max * 10) + int.Parse(pattern[offset].ToString(CultureInfo.InvariantCulture), System.Globalization.NumberFormatInfo.InvariantInfo);
+#endif
offset++;
}
@@ -263,7 +271,11 @@ namespace log4net.Util
{
if (matches[m].Length <= remainingStringLength)
{
+#if NETSTANDARD1_3
+ if (CultureInfo.InvariantCulture.CompareInfo.Compare(pattern, offset, matches[m].Length, matches[m], 0, matches[m].Length) == 0)
+#else
if (String.Compare(pattern, offset, matches[m], 0, matches[m].Length, false, System.Globalization.CultureInfo.InvariantCulture) == 0)
+#endif
{
// Found match
offset = offset + matches[m].Length;
Modified: logging/log4net/trunk/src/Util/PatternString.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/PatternString.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/PatternString.cs (original)
+++ logging/log4net/trunk/src/Util/PatternString.cs Sat Aug 13 12:47:25 2016
@@ -20,6 +20,9 @@
using System;
using System.Collections;
using System.IO;
+#if NETSTANDARD1_3
+using System.Reflection;
+#endif
using log4net.Util;
using log4net.Util.PatternStringConverters;
@@ -288,7 +291,9 @@ namespace log4net.Util
s_globalRulesRegistry.Add("date", typeof(DatePatternConverter));
#if !NETCF
s_globalRulesRegistry.Add("env", typeof(EnvironmentPatternConverter));
- s_globalRulesRegistry.Add("envFolderPath", typeof(EnvironmentFolderPathPatternConverter));
+#if !NETSTANDARD1_3 // EnvironmentFolderPathPatternConverter not yet supported
+ s_globalRulesRegistry.Add("envFolderPath", typeof(EnvironmentFolderPathPatternConverter));
+#endif
#endif
s_globalRulesRegistry.Add("identity", typeof(IdentityPatternConverter));
s_globalRulesRegistry.Add("literal", typeof(LiteralPatternConverter));
Modified: logging/log4net/trunk/src/Util/PatternStringConverters/DatePatternConverter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/PatternStringConverters/DatePatternConverter.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/PatternStringConverters/DatePatternConverter.cs (original)
+++ logging/log4net/trunk/src/Util/PatternStringConverters/DatePatternConverter.cs Sat Aug 13 12:47:25 2016
@@ -18,6 +18,7 @@
#endregion
using System;
+using System.Globalization;
using System.Text;
using System.IO;
@@ -119,20 +120,34 @@ namespace log4net.Util.PatternStringConv
{
dateFormatStr = AbsoluteTimeDateFormatter.Iso8601TimeDateFormat;
}
-
- if (string.Compare(dateFormatStr, AbsoluteTimeDateFormatter.Iso8601TimeDateFormat, true, System.Globalization.CultureInfo.InvariantCulture) == 0)
+#if NETSTANDARD1_3
+ if (CultureInfo.InvariantCulture.CompareInfo.Compare(dateFormatStr, AbsoluteTimeDateFormatter.Iso8601TimeDateFormat, CompareOptions.IgnoreCase) == 0)
{
m_dateFormatter = new Iso8601DateFormatter();
}
- else if (string.Compare(dateFormatStr, AbsoluteTimeDateFormatter.AbsoluteTimeDateFormat, true, System.Globalization.CultureInfo.InvariantCulture) == 0)
+ else if (CultureInfo.InvariantCulture.CompareInfo.Compare(dateFormatStr, AbsoluteTimeDateFormatter.AbsoluteTimeDateFormat, CompareOptions.IgnoreCase) == 0)
{
m_dateFormatter = new AbsoluteTimeDateFormatter();
}
- else if (string.Compare(dateFormatStr, AbsoluteTimeDateFormatter.DateAndTimeDateFormat, true, System.Globalization.CultureInfo.InvariantCulture) == 0)
+ else if (CultureInfo.InvariantCulture.CompareInfo.Compare(dateFormatStr, AbsoluteTimeDateFormatter.DateAndTimeDateFormat, CompareOptions.IgnoreCase) == 0)
{
m_dateFormatter = new DateTimeDateFormatter();
}
- else
+#else
+ if (string.Compare(dateFormatStr, AbsoluteTimeDateFormatter.Iso8601TimeDateFormat, true, CultureInfo.InvariantCulture) == 0)
+ {
+ m_dateFormatter = new Iso8601DateFormatter();
+ }
+ else if (string.Compare(dateFormatStr, AbsoluteTimeDateFormatter.AbsoluteTimeDateFormat, true, CultureInfo.InvariantCulture) == 0)
+ {
+ m_dateFormatter = new AbsoluteTimeDateFormatter();
+ }
+ else if (string.Compare(dateFormatStr, AbsoluteTimeDateFormatter.DateAndTimeDateFormat, true, CultureInfo.InvariantCulture) == 0)
+ {
+ m_dateFormatter = new DateTimeDateFormatter();
+ }
+#endif
+ else
{
try
{
Modified: logging/log4net/trunk/src/Util/PatternStringConverters/IdentityPatternConverter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/PatternStringConverters/IdentityPatternConverter.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/PatternStringConverters/IdentityPatternConverter.cs (original)
+++ logging/log4net/trunk/src/Util/PatternStringConverters/IdentityPatternConverter.cs Sat Aug 13 12:47:25 2016
@@ -48,7 +48,7 @@ namespace log4net.Util.PatternStringConv
/// </remarks>
override protected void Convert(TextWriter writer, object state)
{
-#if (NETCF || SSCLI)
+#if (NETCF || SSCLI || NETSTANDARD1_3)
// On compact framework there's no notion of current thread principals
writer.Write( SystemInfo.NotAvailableText );
#else
Modified: logging/log4net/trunk/src/Util/PatternStringConverters/NewLinePatternConverter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/PatternStringConverters/NewLinePatternConverter.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/PatternStringConverters/NewLinePatternConverter.cs (original)
+++ logging/log4net/trunk/src/Util/PatternStringConverters/NewLinePatternConverter.cs Sat Aug 13 12:47:25 2016
@@ -17,6 +17,9 @@
//
#endregion
+#if NETSTANDARD1_3
+using System.Globalization;
+#endif
using System;
using System.Text;
using System.IO;
@@ -72,6 +75,16 @@ namespace log4net.Util.PatternStringConv
/// </remarks>
public void ActivateOptions()
{
+#if NETSTANDARD1_3
+ if (CultureInfo.InvariantCulture.CompareInfo.Compare(Option, "DOS", CompareOptions.IgnoreCase) == 0)
+ {
+ Option = "\r\n";
+ }
+ else if (CultureInfo.InvariantCulture.CompareInfo.Compare(Option, "UNIX", CompareOptions.IgnoreCase) == 0)
+ {
+ Option = "\n";
+ }
+#else
if (string.Compare(Option, "DOS", true, System.Globalization.CultureInfo.InvariantCulture) == 0)
{
Option = "\r\n";
@@ -80,6 +93,7 @@ namespace log4net.Util.PatternStringConv
{
Option = "\n";
}
+#endif
else
{
Option = SystemInfo.NewLine;
Modified: logging/log4net/trunk/src/Util/PatternStringConverters/ProcessIdPatternConverter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/PatternStringConverters/ProcessIdPatternConverter.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/PatternStringConverters/ProcessIdPatternConverter.cs (original)
+++ logging/log4net/trunk/src/Util/PatternStringConverters/ProcessIdPatternConverter.cs Sat Aug 13 12:47:25 2016
@@ -46,7 +46,7 @@ namespace log4net.Util.PatternStringConv
/// Write the current process ID to the output <paramref name="writer"/>.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0
+#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3
[System.Security.SecuritySafeCritical]
#endif
override protected void Convert(TextWriter writer, object state)
Modified: logging/log4net/trunk/src/Util/PatternStringConverters/PropertyPatternConverter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/PatternStringConverters/PropertyPatternConverter.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/PatternStringConverters/PropertyPatternConverter.cs (original)
+++ logging/log4net/trunk/src/Util/PatternStringConverters/PropertyPatternConverter.cs Sat Aug 13 12:47:25 2016
@@ -68,7 +68,7 @@ namespace log4net.Util.PatternStringConv
{
CompositeProperties compositeProperties = new CompositeProperties();
-#if !NETCF
+#if !(NETCF || NETSTANDARD1_3)
PropertiesDictionary logicalThreadProperties = LogicalThreadContext.Properties.GetProperties(false);
if (logicalThreadProperties != null)
{
Modified: logging/log4net/trunk/src/Util/PatternStringConverters/UserNamePatternConverter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/PatternStringConverters/UserNamePatternConverter.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/PatternStringConverters/UserNamePatternConverter.cs (original)
+++ logging/log4net/trunk/src/Util/PatternStringConverters/UserNamePatternConverter.cs Sat Aug 13 12:47:25 2016
@@ -48,7 +48,7 @@ namespace log4net.Util.PatternStringConv
/// </remarks>
override protected void Convert(TextWriter writer, object state)
{
-#if (NETCF || SSCLI)
+#if (NETCF || SSCLI || NETSTANDARD1_3)
// On compact framework there's no notion of current Windows user
writer.Write( SystemInfo.NotAvailableText );
#else
Modified: logging/log4net/trunk/src/Util/PropertiesDictionary.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/PropertiesDictionary.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/PropertiesDictionary.cs (original)
+++ logging/log4net/trunk/src/Util/PropertiesDictionary.cs Sat Aug 13 12:47:25 2016
@@ -75,7 +75,7 @@ namespace log4net.Util
#region Private Instance Constructors
-#if !NETCF
+#if !(NETCF || NETSTANDARD1_3)
/// <summary>
/// Initializes a new instance of the <see cref="PropertiesDictionary" /> class
/// with serialized data.
Modified: logging/log4net/trunk/src/Util/ReadOnlyPropertiesDictionary.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/ReadOnlyPropertiesDictionary.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/ReadOnlyPropertiesDictionary.cs (original)
+++ logging/log4net/trunk/src/Util/ReadOnlyPropertiesDictionary.cs Sat Aug 13 12:47:25 2016
@@ -19,6 +19,7 @@
using System;
using System.Collections;
+using System.Reflection;
#if !NETCF
using System.Runtime.Serialization;
using System.Xml;
@@ -91,7 +92,7 @@ namespace log4net.Util
#region Private Instance Constructors
-#if !NETCF
+#if !(NETCF || NETSTANDARD1_3)
/// <summary>
/// Deserialization constructor
/// </summary>
@@ -203,7 +204,7 @@ namespace log4net.Util
/// Serializes this object into the <see cref="SerializationInfo" /> provided.
/// </para>
/// </remarks>
-#if NET_4_0 || MONO_4_0
+#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3
[System.Security.SecurityCritical]
#else
[System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter=true)]
@@ -215,8 +216,13 @@ namespace log4net.Util
string entryKey = entry.Key as string;
object entryValue = entry.Value;
- // If value is serializable then we add it to the list
- if (entryKey != null && entryValue != null && entryValue.GetType().IsSerializable)
+ // If value is serializable then we add it to the list
+#if NETSTANDARD1_3
+ bool isSerializable = entryValue.GetType().GetTypeInfo().IsSerializable;
+#else
+ bool isSerializable = entryValue.GetType().IsSerializable;
+#endif
+ if (entryKey != null && entryValue != null && isSerializable)
{
// Store the keys as an Xml encoded local name as it may contain colons (':')
// which are NOT escaped by the Xml Serialization framework.
Modified: logging/log4net/trunk/src/Util/SystemInfo.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/SystemInfo.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/SystemInfo.cs (original)
+++ logging/log4net/trunk/src/Util/SystemInfo.cs Sat Aug 13 12:47:25 2016
@@ -18,7 +18,9 @@
#endregion
using System;
+#if !NETSTANDARD1_3
using System.Configuration;
+#endif
using System.Reflection;
using System.Text;
using System.IO;
@@ -143,7 +145,9 @@ namespace log4net.Util
get
{
#if NETCF
- return System.IO.Path.GetDirectoryName(SystemInfo.EntryAssemblyLocation) + System.IO.Path.DirectorySeparatorChar;
+- return System.IO.Path.GetDirectoryName(SystemInfo.EntryAssemblyLocation) + System.IO.Path.DirectorySeparatorChar;
+#elif NETSTANDARD1_3
+ return Directory.GetCurrentDirectory();
#else
return AppDomain.CurrentDomain.BaseDirectory;
#endif
@@ -168,7 +172,7 @@ namespace log4net.Util
{
get
{
-#if NETCF
+#if NETCF || NETSTANDARD1_3
return SystemInfo.EntryAssemblyLocation+".config";
#else
return System.AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
@@ -191,6 +195,8 @@ namespace log4net.Util
{
#if NETCF
return SystemInfo.NativeEntryAssemblyLocation;
+#elif NETSTANDARD1_3 // TODO GetEntryAssembly is available for netstandard1.5
+ return AppContext.BaseDirectory;
#else
return System.Reflection.Assembly.GetEntryAssembly().Location;
#endif
@@ -225,7 +231,7 @@ namespace log4net.Util
{
#if NETCF_1_0
return System.Threading.Thread.CurrentThread.GetHashCode();
-#elif NET_2_0 || NETCF_2_0 || MONO_2_0 || MONO_3_5 || MONO_4_0
+#elif NET_2_0 || NETCF_2_0 || MONO_2_0 || MONO_3_5 || MONO_4_0 || NETSTANDARD1_3
return System.Threading.Thread.CurrentThread.ManagedThreadId;
#else
return AppDomain.GetCurrentThreadId();
@@ -283,7 +289,9 @@ namespace log4net.Util
{
try
{
-#if (!SSCLI && !NETCF)
+#if NETSTANDARD1_3
+ s_hostName = Environment.GetEnvironmentVariable("COMPUTERNAME");
+#elif (!SSCLI && !NETCF)
s_hostName = Environment.MachineName;
#endif
}
@@ -331,7 +339,7 @@ namespace log4net.Util
{
try
{
-#if !NETCF
+#if !(NETCF || NETSTANDARD1_3)
s_appFriendlyName = AppDomain.CurrentDomain.FriendlyName;
#endif
}
@@ -448,6 +456,8 @@ namespace log4net.Util
{
#if NETCF
return "Not supported on Microsoft .NET Compact Framework";
+#elif NETSTANDARD1_3 // TODO Assembly.Location available in netstandard1.5
+ return "Not supported on .NET Core";
#else
if (myAssembly.GlobalAssemblyCache)
{
@@ -518,7 +528,12 @@ namespace log4net.Util
/// </remarks>
public static string AssemblyQualifiedName(Type type)
{
- return type.FullName + ", " + type.Assembly.FullName;
+ return type.FullName + ", "
+#if NETSTANDARD1_3
+ + type.GetTypeInfo().Assembly.FullName;
+#else
+ + type.Assembly.FullName;
+#endif
}
/// <summary>
@@ -570,7 +585,7 @@ namespace log4net.Util
/// </remarks>
public static string AssemblyFileName(Assembly myAssembly)
{
-#if NETCF
+#if NETCF || NETSTANDARD1_3 // TODO Assembly.Location is in netstandard1.5 System.Reflection
// This is not very good because it assumes that only
// the entry assembly can be an EXE. In fact multiple
// EXEs can be loaded in to a process.
@@ -615,9 +630,14 @@ namespace log4net.Util
/// </remarks>
public static Type GetTypeFromString(Type relativeType, string typeName, bool throwOnError, bool ignoreCase)
{
+#if NETSTANDARD1_3
+ return GetTypeFromString(relativeType.GetTypeInfo().Assembly, typeName, throwOnError, ignoreCase);
+#else
return GetTypeFromString(relativeType.Assembly, typeName, throwOnError, ignoreCase);
+#endif
}
+#if !NETSTANDARD1_3
/// <summary>
/// Loads the type specified in the type string.
/// </summary>
@@ -641,6 +661,7 @@ namespace log4net.Util
{
return GetTypeFromString(Assembly.GetCallingAssembly(), typeName, throwOnError, ignoreCase);
}
+#endif
/// <summary>
/// Loads the type specified in the type string.
@@ -668,7 +689,9 @@ namespace log4net.Util
if(typeName.IndexOf(',') == -1)
{
//LogLog.Debug(declaringType, "SystemInfo: Loading type ["+typeName+"] from assembly ["+relativeAssembly.FullName+"]");
-#if NETCF
+#if NETSTANDARD1_3
+ return relativeAssembly.GetType(typeName, throwOnError, ignoreCase);
+#elif NETCF
return relativeAssembly.GetType(typeName, throwOnError);
#else
// Attempt to lookup the type from the relativeAssembly
@@ -948,7 +971,7 @@ namespace log4net.Util
{
try
{
-#if NETCF
+#if NETCF || NETSTANDARD1_3
// Configuration APIs are not suported under the Compact Framework
#elif NET_2_0
return ConfigurationManager.AppSettings[key];
Modified: logging/log4net/trunk/src/Util/SystemStringFormat.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/SystemStringFormat.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/SystemStringFormat.cs (original)
+++ logging/log4net/trunk/src/Util/SystemStringFormat.cs Sat Aug 13 12:47:25 2016
@@ -109,7 +109,7 @@ namespace log4net.Util
log4net.Util.LogLog.Warn(declaringType, "Exception while rendering format ["+format+"]", ex);
return StringFormatError(ex, format, args);
}
-#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0
+#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0 && !NETSTANDARD1_3
catch
{
log4net.Util.LogLog.Warn(declaringType, "Exception while rendering format ["+format+"]");
@@ -148,7 +148,7 @@ namespace log4net.Util
log4net.Util.LogLog.Error(declaringType, "INTERNAL ERROR during StringFormat error handling", ex);
return "<log4net.Error>Exception during StringFormat. See Internal Log.</log4net.Error>";
}
-#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0
+#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0 && !NETSTANDARD1_3
catch
{
log4net.Util.LogLog.Error(declaringType, "INTERNAL ERROR during StringFormat error handling");
@@ -210,7 +210,7 @@ namespace log4net.Util
{
buffer.Append("<Exception: ").Append(ex.Message).Append(">");
}
-#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0
+#if !NET_2_0 && !MONO_2_0 && !MONO_3_5 && !MONO_4_0 && !NETSTANDARD1_3
catch
{
buffer.Append("<Exception>");
Modified: logging/log4net/trunk/src/Util/TextWriterAdapter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/TextWriterAdapter.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/TextWriterAdapter.cs (original)
+++ logging/log4net/trunk/src/Util/TextWriterAdapter.cs Sat Aug 13 12:47:25 2016
@@ -149,10 +149,17 @@ namespace log4net.Util
/// <para>
/// </para>
/// </remarks>
+#if NETSTANDARD1_3
+ virtual public void Close()
+ {
+ m_writer.Dispose();
+ }
+#else
override public void Close()
{
m_writer.Close();
}
+#endif
/// <summary>
/// Dispose this writer
Modified: logging/log4net/trunk/src/Util/TypeConverters/ConversionNotSupportedException.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/TypeConverters/ConversionNotSupportedException.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/TypeConverters/ConversionNotSupportedException.cs (original)
+++ logging/log4net/trunk/src/Util/TypeConverters/ConversionNotSupportedException.cs Sat Aug 13 12:47:25 2016
@@ -18,7 +18,7 @@
#endregion
using System;
-#if !NETCF
+#if !(NETCF || NETSTANDARD1_3)
using System.Runtime.Serialization;
#endif
@@ -39,7 +39,11 @@ namespace log4net.Util.TypeConverters
#if !NETCF
[Serializable]
#endif
+#if NETSTANDARD1_3
+ public class ConversionNotSupportedException : Exception
+#else
public class ConversionNotSupportedException : ApplicationException
+#endif
{
#region Public Instance Constructors
@@ -88,7 +92,7 @@ namespace log4net.Util.TypeConverters
#region Protected Instance Constructors
-#if !NETCF
+#if !(NETCF || NETSTANDARD1_3)
/// <summary>
/// Serialization constructor
/// </summary>
Modified: logging/log4net/trunk/src/Util/TypeConverters/ConverterRegistry.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/TypeConverters/ConverterRegistry.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/TypeConverters/ConverterRegistry.cs (original)
+++ logging/log4net/trunk/src/Util/TypeConverters/ConverterRegistry.cs Sat Aug 13 12:47:25 2016
@@ -19,6 +19,9 @@
using System;
using System.Globalization;
+#if NETSTANDARD1_3
+using System.Linq;
+#endif
using System.Reflection;
using System.Collections;
Modified: logging/log4net/trunk/src/Util/TypeConverters/IPAddressConverter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/TypeConverters/IPAddressConverter.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/TypeConverters/IPAddressConverter.cs (original)
+++ logging/log4net/trunk/src/Util/TypeConverters/IPAddressConverter.cs Sat Aug 13 12:47:25 2016
@@ -116,7 +116,11 @@ namespace log4net.Util.TypeConverters
}
// Try to resolve via DNS. This is a blocking call.
+#if NETSTANDARD1_3
+ IPHostEntry host = Dns.GetHostEntryAsync(str).GetAwaiter().GetResult();
+#else
IPHostEntry host = Dns.GetHostByName(str);
+#endif
if (host != null &&
host.AddressList != null &&
host.AddressList.Length > 0 &&
Modified: logging/log4net/trunk/src/Util/TypeConverters/PatternStringConverter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/TypeConverters/PatternStringConverter.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/TypeConverters/PatternStringConverter.cs (original)
+++ logging/log4net/trunk/src/Util/TypeConverters/PatternStringConverter.cs Sat Aug 13 12:47:25 2016
@@ -18,6 +18,9 @@
#endregion
using System;
+#if NETSTANDARD1_3
+using System.Reflection;
+#endif
using System.Text;
using log4net.Util;
Modified: logging/log4net/trunk/src/Util/TypeConverters/TypeConverter.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/TypeConverters/TypeConverter.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/TypeConverters/TypeConverter.cs (original)
+++ logging/log4net/trunk/src/Util/TypeConverters/TypeConverter.cs Sat Aug 13 12:47:25 2016
@@ -19,6 +19,9 @@
using System;
using System.Text;
+#if NETSTANDARD1_3
+using System.Reflection;
+#endif
namespace log4net.Util.TypeConverters
{
@@ -77,7 +80,11 @@ namespace log4net.Util.TypeConverters
string str = source as string;
if (str != null)
{
+#if NETSTANDARD1_3 // TODO can we use ComponentModel here?
+ return SystemInfo.GetTypeFromString(GetType().GetTypeInfo().Assembly, str, true, true);
+#else
return SystemInfo.GetTypeFromString(str, true, true);
+#endif
}
throw ConversionNotSupportedException.Create(typeof(Type), source);
}
Modified: logging/log4net/trunk/tests/src/Appender/RollingFileAppenderTest.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Appender/RollingFileAppenderTest.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/tests/src/Appender/RollingFileAppenderTest.cs (original)
+++ logging/log4net/trunk/tests/src/Appender/RollingFileAppenderTest.cs Sat Aug 13 12:47:25 2016
@@ -51,9 +51,10 @@ namespace log4net.Tests.Appender
private int _MaxSizeRollBackups = 3;
private CountingAppender _caRoot;
private Logger _root;
+#if !NETSTANDARD1_3
private CultureInfo _currentCulture;
private CultureInfo _currentUICulture;
-
+#endif
private class SilentErrorHandler : IErrorHandler
{
private StringBuilder m_buffer = new StringBuilder();
@@ -98,9 +99,9 @@ namespace log4net.Tests.Appender
private static void ResetAndDeleteTestFiles()
{
// Regular users should not use the clear method lightly!
- LogManager.GetRepository().ResetConfiguration();
- LogManager.GetRepository().Shutdown();
- ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Clear();
+ Utils.GetRepository().ResetConfiguration();
+ Utils.GetRepository().Shutdown();
+ ((Repository.Hierarchy.Hierarchy)Utils.GetRepository()).Clear();
DeleteTestFiles();
}
@@ -115,10 +116,12 @@ namespace log4net.Tests.Appender
ResetAndDeleteTestFiles();
InitializeVariables();
+#if !NETSTANDARD1_3
// set correct thread culture
_currentCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
_currentUICulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.InvariantCulture;
+#endif
}
/// <summary>
@@ -128,10 +131,12 @@ namespace log4net.Tests.Appender
public void TearDown()
{
ResetAndDeleteTestFiles();
-
+
+#if !NETSTANDARD1_3
// restore previous culture
System.Threading.Thread.CurrentThread.CurrentCulture = _currentCulture;
System.Threading.Thread.CurrentThread.CurrentUICulture = _currentUICulture;
+#endif
}
/// <summary>
@@ -1107,7 +1112,7 @@ namespace log4net.Tests.Appender
/// </summary>
private void ConfigureRootAppender()
{
- _root = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
+ _root = ((Repository.Hierarchy.Hierarchy)Utils.GetRepository()).Root;
_root.Level = Level.Debug;
_caRoot = new CountingAppender();
_root.AddAppender(_caRoot);
@@ -1454,7 +1459,11 @@ namespace log4net.Tests.Appender
private static void AssertFileEquals(string filename, string contents)
{
+#if NETSTANDARD1_3
+ StreamReader sr = new StreamReader(new FileStream(filename, FileMode.Open));
+#else
StreamReader sr = new StreamReader(filename);
+#endif
string logcont = sr.ReadToEnd();
sr.Close();
@@ -1709,7 +1718,6 @@ namespace log4net.Tests.Appender
public void TestInterProcessLockRoll()
{
String filename = "test.log";
- bool locked;
SilentErrorHandler sh = new SilentErrorHandler();
ILogger log = CreateLogger(filename, new FileAppender.InterProcessLock(), sh, 1, 2);
Modified: logging/log4net/trunk/tests/src/Appender/SmtpPickupDirAppenderTest.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Appender/SmtpPickupDirAppenderTest.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/tests/src/Appender/SmtpPickupDirAppenderTest.cs (original)
+++ logging/log4net/trunk/tests/src/Appender/SmtpPickupDirAppenderTest.cs Sat Aug 13 12:47:25 2016
@@ -84,9 +84,9 @@ namespace log4net.Tests.Appender
private void ResetLogger()
{
// Regular users should not use the clear method lightly!
- LogManager.GetRepository().ResetConfiguration();
- LogManager.GetRepository().Shutdown();
- ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Clear();
+ Utils.GetRepository().ResetConfiguration();
+ Utils.GetRepository().Shutdown();
+ ((Repository.Hierarchy.Hierarchy)Utils.GetRepository()).Clear();
}
/// <summary>
Modified: logging/log4net/trunk/tests/src/Appender/TraceAppenderTest.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Appender/TraceAppenderTest.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/tests/src/Appender/TraceAppenderTest.cs (original)
+++ logging/log4net/trunk/tests/src/Appender/TraceAppenderTest.cs Sat Aug 13 12:47:25 2016
@@ -55,6 +55,7 @@ namespace log4net.Tests.Appender
categoryTraceListener.Category);
}
+#if !NETSTANDARD1_3 // "LocationInfo can't get method names on NETSTANDARD1_3 due to unavailable stack frame APIs"
[Test]
public void MethodNameCategoryTest()
{
@@ -80,6 +81,7 @@ namespace log4net.Tests.Appender
System.Reflection.MethodInfo.GetCurrentMethod().Name,
categoryTraceListener.Category);
}
+#endif
}
public class CategoryTraceListener : TraceListener
Modified: logging/log4net/trunk/tests/src/Core/FixingTest.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Core/FixingTest.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/tests/src/Core/FixingTest.cs (original)
+++ logging/log4net/trunk/tests/src/Core/FixingTest.cs Sat Aug 13 12:47:25 2016
@@ -33,7 +33,11 @@ namespace log4net.Tests.Core
{
const string TEST_REPOSITORY = "Test Repository";
+#if NETSTANDARD1_3
+ [OneTimeSetUp]
+#else
[TestFixtureSetUp]
+#endif
public void CreateRepository()
{
bool exists = false;
@@ -139,7 +143,9 @@ namespace log4net.Tests.Core
Assert.AreEqual("System.Exception: This is the exception", loggingEvent.GetExceptionString(), "Exception is incorrect");
Assert.AreEqual(null, loggingEventData.Identity, "Identity is incorrect");
Assert.AreEqual(Level.Warn, loggingEventData.Level, "Level is incorrect");
+#if !NETSTANDARD1_3 // NETSTANDARD1_3: LocationInfo can't get method names
Assert.AreEqual("get_LocationInformation", loggingEvent.LocationInformation.MethodName, "Location Info is incorrect");
+#endif
Assert.AreEqual("log4net.Tests.Core.FixingTest", loggingEventData.LoggerName, "LoggerName is incorrect");
Assert.AreEqual(LogManager.GetRepository(TEST_REPOSITORY), loggingEvent.Repository, "Repository is incorrect");
Assert.AreEqual(Thread.CurrentThread.Name, loggingEventData.ThreadName, "ThreadName is incorrect");
Modified: logging/log4net/trunk/tests/src/Core/StringFormatTest.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Core/StringFormatTest.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/tests/src/Core/StringFormatTest.cs (original)
+++ logging/log4net/trunk/tests/src/Core/StringFormatTest.cs Sat Aug 13 12:47:25 2016
@@ -40,6 +40,7 @@ namespace log4net.Tests.Core
[TestFixture]
public class StringFormatTest
{
+#if !NETSTANDARD1_3
private CultureInfo _currentCulture;
private CultureInfo _currentUICulture;
@@ -59,6 +60,7 @@ namespace log4net.Tests.Core
System.Threading.Thread.CurrentThread.CurrentCulture = _currentCulture;
System.Threading.Thread.CurrentThread.CurrentUICulture = _currentUICulture;
}
+#endif
[Test]
public void TestFormatString()
Modified: logging/log4net/trunk/tests/src/Hierarchy/Hierarchy.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Hierarchy/Hierarchy.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/tests/src/Hierarchy/Hierarchy.cs (original)
+++ logging/log4net/trunk/tests/src/Hierarchy/Hierarchy.cs Sat Aug 13 12:47:25 2016
@@ -67,7 +67,8 @@ namespace log4net.Tests.Hierarchy
CountingAppender beta = new CountingAppender();
Repository.Hierarchy.Hierarchy hierarchy =
- (Repository.Hierarchy.Hierarchy)LogManager.GetRepository();
+ (Repository.Hierarchy.Hierarchy)Utils.GetRepository();
+
hierarchy.Root.AddAppender(alpha);
hierarchy.Root.AddAppender(beta);
hierarchy.Configured = true;
@@ -85,7 +86,11 @@ namespace log4net.Tests.Hierarchy
CountingAppender alpha = new CountingAppender();
CountingAppender beta = new CountingAppender();
+#if NETSTANDARD1_3
+ BasicConfigurator.Configure(Utils.GetRepository(), alpha, beta);
+#else
BasicConfigurator.Configure(alpha, beta);
+#endif
ILog log = LogManager.GetLogger(GetType());
log.Debug("Hello World");
Modified: logging/log4net/trunk/tests/src/Hierarchy/Logger.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Hierarchy/Logger.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/tests/src/Hierarchy/Logger.cs (original)
+++ logging/log4net/trunk/tests/src/Hierarchy/Logger.cs Sat Aug 13 12:47:25 2016
@@ -25,6 +25,10 @@ using log4net.Tests.Appender;
using NUnit.Framework;
+#if NETSTANDARD1_3
+using System.Reflection;
+#endif
+
namespace log4net.Tests.Hierarchy
{
/// <summary>
@@ -57,9 +61,9 @@ namespace log4net.Tests.Hierarchy
public void TearDown()
{
// Regular users should not use the clear method lightly!
- LogManager.GetRepository().ResetConfiguration();
- LogManager.GetRepository().Shutdown();
- ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Clear();
+ Utils.GetRepository().ResetConfiguration();
+ Utils.GetRepository().Shutdown();
+ ((Repository.Hierarchy.Hierarchy)Utils.GetRepository()).Clear();
}
/// <summary>
@@ -68,7 +72,7 @@ namespace log4net.Tests.Hierarchy
[Test]
public void TestAppender1()
{
- log = (Logger)LogManager.GetLogger("test").Logger;
+ log = (Logger)Utils.GetLogger("test").Logger;
CountingAppender a1 = new CountingAppender();
a1.Name = "testAppender1";
log.AddAppender(a1);
@@ -91,7 +95,7 @@ namespace log4net.Tests.Hierarchy
CountingAppender a2 = new CountingAppender();
a2.Name = "testAppender2.2";
- log = (Logger)LogManager.GetLogger("test").Logger;
+ log = (Logger)Utils.GetLogger("test").Logger;
log.AddAppender(a1);
log.AddAppender(a2);
@@ -119,8 +123,8 @@ namespace log4net.Tests.Hierarchy
[Test]
public void TestAdditivity1()
{
- Logger a = (Logger)LogManager.GetLogger("a").Logger;
- Logger ab = (Logger)LogManager.GetLogger("a.b").Logger;
+ Logger a = (Logger)Utils.GetLogger("a").Logger;
+ Logger ab = (Logger)Utils.GetLogger("a.b").Logger;
CountingAppender ca = new CountingAppender();
a.AddAppender(ca);
@@ -143,10 +147,10 @@ namespace log4net.Tests.Hierarchy
[Test]
public void TestAdditivity2()
{
- Logger a = (Logger)LogManager.GetLogger("a").Logger;
- Logger ab = (Logger)LogManager.GetLogger("a.b").Logger;
- Logger abc = (Logger)LogManager.GetLogger("a.b.c").Logger;
- Logger x = (Logger)LogManager.GetLogger("x").Logger;
+ Logger a = (Logger)Utils.GetLogger("a").Logger;
+ Logger ab = (Logger)Utils.GetLogger("a.b").Logger;
+ Logger abc = (Logger)Utils.GetLogger("a.b.c").Logger;
+ Logger x = (Logger)Utils.GetLogger("x").Logger;
CountingAppender ca1 = new CountingAppender();
CountingAppender ca2 = new CountingAppender();
@@ -177,10 +181,10 @@ namespace log4net.Tests.Hierarchy
[Test]
public void TestAdditivity3()
{
- Logger root = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
- Logger a = (Logger)LogManager.GetLogger("a").Logger;
- Logger ab = (Logger)LogManager.GetLogger("a.b").Logger;
- Logger abc = (Logger)LogManager.GetLogger("a.b.c").Logger;
+ Logger root = ((Repository.Hierarchy.Hierarchy)Utils.GetRepository()).Root;
+ Logger a = (Logger)Utils.GetLogger("a").Logger;
+ Logger ab = (Logger)Utils.GetLogger("a.b").Logger;
+ Logger abc = (Logger)Utils.GetLogger("a.b.c").Logger;
CountingAppender caRoot = new CountingAppender();
CountingAppender caA = new CountingAppender();
@@ -220,10 +224,10 @@ namespace log4net.Tests.Hierarchy
public void TestDisable1()
{
CountingAppender caRoot = new CountingAppender();
- Logger root = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root;
+ Logger root = ((Repository.Hierarchy.Hierarchy)Utils.GetRepository()).Root;
root.AddAppender(caRoot);
- Repository.Hierarchy.Hierarchy h = ((Repository.Hierarchy.Hierarchy)LogManager.GetRepository());
+ Repository.Hierarchy.Hierarchy h = ((Repository.Hierarchy.Hierarchy)Utils.GetRepository());
h.Threshold = Level.Info;
h.Configured = true;
@@ -271,11 +275,20 @@ namespace log4net.Tests.Hierarchy
[Test]
public void TestExists()
{
- object a = LogManager.GetLogger("a");
- object a_b = LogManager.GetLogger("a.b");
- object a_b_c = LogManager.GetLogger("a.b.c");
+ object a = Utils.GetLogger("a");
+ object a_b = Utils.GetLogger("a.b");
+ object a_b_c = Utils.GetLogger("a.b.c");
object t;
+#if NETSTANDARD1_3
+ Assert.IsNull(LogManager.Exists(GetType().GetTypeInfo().Assembly, "xx"));
+ t = LogManager.Exists(GetType().GetTypeInfo().Assembly, "a");
+ Assert.AreSame(a, t);
+ t = LogManager.Exists(GetType().GetTypeInfo().Assembly, "a.b");
+ Assert.AreSame(a_b, t);
+ t = LogManager.Exists(GetType().GetTypeInfo().Assembly, "a.b.c");
+ Assert.AreSame(a_b_c, t);
+#else
t = LogManager.Exists("xx");
Assert.IsNull(t);
t = LogManager.Exists("a");
@@ -284,6 +297,7 @@ namespace log4net.Tests.Hierarchy
Assert.AreSame(a_b, t);
t = LogManager.Exists("a.b.c");
Assert.AreSame(a_b_c, t);
+#endif
}
/// <summary>
Modified: logging/log4net/trunk/tests/src/Hierarchy/XmlHierarchyConfiguratorTest.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Hierarchy/XmlHierarchyConfiguratorTest.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/tests/src/Hierarchy/XmlHierarchyConfiguratorTest.cs (original)
+++ logging/log4net/trunk/tests/src/Hierarchy/XmlHierarchyConfiguratorTest.cs Sat Aug 13 12:47:25 2016
@@ -45,6 +45,7 @@ namespace log4net.Tests.Hierarchy
}
}
+#if !NETSTANDARD1_3 // TODO write replacement test
[Test][Platform(Include="Win")]
public void EnvironmentOnWindowsIsCaseInsensitive()
{
@@ -58,6 +59,7 @@ namespace log4net.Tests.Hierarchy
SetTestPropWithPath();
Assert.AreEqual("Path=", TestProp);
}
+#endif
private void SetTestPropWithPath()
{
Modified: logging/log4net/trunk/tests/src/Layout/PatternLayoutTest.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Layout/PatternLayoutTest.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/tests/src/Layout/PatternLayoutTest.cs (original)
+++ logging/log4net/trunk/tests/src/Layout/PatternLayoutTest.cs Sat Aug 13 12:47:25 2016
@@ -42,6 +42,7 @@ namespace log4net.Tests.Layout
[TestFixture]
public class PatternLayoutTest
{
+#if !NETSTANDARD1_3
private CultureInfo _currentCulture;
private CultureInfo _currentUICulture;
@@ -62,6 +63,7 @@ namespace log4net.Tests.Layout
System.Threading.Thread.CurrentThread.CurrentCulture = _currentCulture;
System.Threading.Thread.CurrentThread.CurrentUICulture = _currentUICulture;
}
+#endif
protected virtual PatternLayout NewPatternLayout() {
return new PatternLayout();
@@ -99,7 +101,11 @@ namespace log4net.Tests.Layout
stringAppender.Reset();
}
+#if NETSTANDARD1_3
+ [Test, Ignore("System.Diagnostics.StackTrace isn't fully implemented on NETSTANDARD1_3")]
+#else
[Test]
+#endif
public void TestStackTracePattern()
{
StringAppender stringAppender = new StringAppender();
Modified: logging/log4net/trunk/tests/src/Layout/XmlLayoutTest.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Layout/XmlLayoutTest.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/tests/src/Layout/XmlLayoutTest.cs (original)
+++ logging/log4net/trunk/tests/src/Layout/XmlLayoutTest.cs Sat Aug 13 12:47:25 2016
@@ -36,6 +36,7 @@ namespace log4net.Tests.Layout
[TestFixture]
public class XmlLayoutTest
{
+#if !NETSTANDARD1_3
private CultureInfo _currentCulture;
private CultureInfo _currentUICulture;
@@ -55,6 +56,7 @@ namespace log4net.Tests.Layout
System.Threading.Thread.CurrentThread.CurrentCulture = _currentCulture;
System.Threading.Thread.CurrentThread.CurrentUICulture = _currentUICulture;
}
+#endif
/// <summary>
/// Build a basic <see cref="LoggingEventData"/> object with some default values.
@@ -81,7 +83,7 @@ namespace log4net.Tests.Layout
private static string CreateEventNode(string message)
{
return String.Format("<event logger=\"TestLogger\" timestamp=\"{0}\" level=\"INFO\" thread=\"TestThread\" domain=\"Tests\" identity=\"TestRunner\" username=\"TestRunner\"><message>{1}</message></event>" + Environment.NewLine,
-#if NET_2_0 || MONO_2_0 || MONO_3_5 || MONO_4_0
+#if NET_2_0 || MONO_2_0 || MONO_3_5 || MONO_4_0 || NETSTANDARD1_3
XmlConvert.ToString(DateTime.Today, XmlDateTimeSerializationMode.Local),
#else
XmlConvert.ToString(DateTime.Today),
@@ -92,7 +94,7 @@ namespace log4net.Tests.Layout
private static string CreateEventNode(string key, string value)
{
return String.Format("<event logger=\"TestLogger\" timestamp=\"{0}\" level=\"INFO\" thread=\"TestThread\" domain=\"Tests\" identity=\"TestRunner\" username=\"TestRunner\"><message>Test message</message><properties><data name=\"{1}\" value=\"{2}\" /></properties></event>" + Environment.NewLine,
-#if NET_2_0 || MONO_2_0 || MONO_3_5 || MONO_4_0
+#if NET_2_0 || MONO_2_0 || MONO_3_5 || MONO_4_0 || NETSTANDARD1_3
XmlConvert.ToString(DateTime.Today, XmlDateTimeSerializationMode.Local),
#else
XmlConvert.ToString(DateTime.Today),
@@ -303,7 +305,7 @@ namespace log4net.Tests.Layout
Assert.AreEqual(expected, stringAppender.GetString());
}
-#if NET_4_0 || MONO_4_0
+#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3
[Test]
public void BracketsInStackTracesKeepLogWellFormed() {
XmlLayout layout = new XmlLayout();
@@ -347,8 +349,13 @@ namespace log4net.Tests.Layout
bar(42);
var log = stringAppender.GetString();
+#if NETSTANDARD1_3
+ var startOfExceptionText = log.IndexOf("<exception>", StringComparison.Ordinal) + 11;
+ var endOfExceptionText = log.IndexOf("</exception>", StringComparison.Ordinal);
+#else
var startOfExceptionText = log.IndexOf("<exception>", StringComparison.InvariantCulture) + 11;
var endOfExceptionText = log.IndexOf("</exception>", StringComparison.InvariantCulture);
+#endif
var sub = log.Substring(startOfExceptionText, endOfExceptionText - startOfExceptionText);
if (sub.StartsWith("<![CDATA["))
{
Modified: logging/log4net/trunk/tests/src/Util/SystemInfoTest.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Util/SystemInfoTest.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/tests/src/Util/SystemInfoTest.cs (original)
+++ logging/log4net/trunk/tests/src/Util/SystemInfoTest.cs Sat Aug 13 12:47:25 2016
@@ -23,7 +23,7 @@ using log4net.Util;
using NUnit.Framework;
-#if NET_4_0 || MONO_4_0
+#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3
using System.Linq.Expressions;
using System.Reflection;
#endif
@@ -37,7 +37,7 @@ namespace log4net.Tests.Util
public class SystemInfoTest
{
-#if NET_4_0 || MONO_4_0
+#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3
/// <summary>
/// It's "does not throw not supported exception" NOT
/// "returns 'Dynamic Assembly' string for dynamic assemblies" by purpose.
@@ -65,7 +65,11 @@ namespace log4net.Tests.Util
public static string TestAssemblyLocationInfoMethod()
{
+#if NETSTANDARD1_3
+ return SystemInfo.AssemblyLocationInfo(typeof(SystemInfoTest).GetTypeInfo().Assembly);
+#else
return SystemInfo.AssemblyLocationInfo(Assembly.GetCallingAssembly());
+#endif
}
#endif
@@ -74,57 +78,62 @@ namespace log4net.Tests.Util
{
Type t;
- t = SystemInfo.GetTypeFromString("log4net.Tests.Util.SystemInfoTest,log4net.Tests", false, false);
+ t = GetTypeFromString("log4net.Tests.Util.SystemInfoTest,log4net.Tests", false, false);
Assert.AreSame(typeof(SystemInfoTest), t, "Test explicit case sensitive type load");
- t = SystemInfo.GetTypeFromString("LOG4NET.TESTS.UTIL.SYSTEMINFOTEST,log4net.Tests", false, true);
+ t = GetTypeFromString("LOG4NET.TESTS.UTIL.SYSTEMINFOTEST,log4net.Tests", false, true);
Assert.AreSame(typeof(SystemInfoTest), t, "Test explicit case in-sensitive type load caps");
- t = SystemInfo.GetTypeFromString("log4net.tests.util.systeminfotest,log4net.Tests", false, true);
+ t = GetTypeFromString("log4net.tests.util.systeminfotest,log4net.Tests", false, true);
Assert.AreSame(typeof(SystemInfoTest), t, "Test explicit case in-sensitive type load lower");
}
- [Test][Platform(Include="Win")]
+#if !NETSTANDARD1_3
+ [Test][Platform(Include="Win")]
public void TestGetTypeFromStringCaseInsensitiveOnAssemblyName()
{
Type t;
- t = SystemInfo.GetTypeFromString("LOG4NET.TESTS.UTIL.SYSTEMINFOTEST,LOG4NET.TESTS", false, true);
+ t = GetTypeFromString("LOG4NET.TESTS.UTIL.SYSTEMINFOTEST,LOG4NET.TESTS", false, true);
Assert.AreSame(typeof(SystemInfoTest), t, "Test explicit case in-sensitive type load caps");
- t = SystemInfo.GetTypeFromString("log4net.tests.util.systeminfotest,log4net.tests", false, true);
+ t = GetTypeFromString("log4net.tests.util.systeminfotest,log4net.tests", false, true);
Assert.AreSame(typeof(SystemInfoTest), t, "Test explicit case in-sensitive type load lower");
}
+#endif
[Test]
public void TestGetTypeFromStringRelative()
{
Type t;
- t = SystemInfo.GetTypeFromString("log4net.Tests.Util.SystemInfoTest", false, false);
+ t = GetTypeFromString("log4net.Tests.Util.SystemInfoTest", false, false);
Assert.AreSame(typeof(SystemInfoTest), t, "Test explicit case sensitive type load");
- t = SystemInfo.GetTypeFromString("LOG4NET.TESTS.UTIL.SYSTEMINFOTEST", false, true);
+ t = GetTypeFromString("LOG4NET.TESTS.UTIL.SYSTEMINFOTEST", false, true);
Assert.AreSame(typeof(SystemInfoTest), t, "Test explicit case in-sensitive type load caps");
- t = SystemInfo.GetTypeFromString("log4net.tests.util.systeminfotest", false, true);
+ t = GetTypeFromString("log4net.tests.util.systeminfotest", false, true);
Assert.AreSame(typeof(SystemInfoTest), t, "Test explicit case in-sensitive type load lower");
}
+#if NETSTANDARD1_3
+ [Ignore("This test relies on enumerating loaded assemblies, which is presently impossible in CoreFX (https://github.com/dotnet/corefx/issues/1784).")]
+#endif
[Test]
public void TestGetTypeFromStringSearch()
{
Type t;
- t = SystemInfo.GetTypeFromString("log4net.Util.SystemInfo", false, false);
+ t = GetTypeFromString("log4net.Util.SystemInfo", false, false);
Assert.AreSame(typeof(SystemInfo), t,
string.Format("Test explicit case sensitive type load found {0} rather than {1}",
t.AssemblyQualifiedName, typeof(SystemInfo).AssemblyQualifiedName));
- t = SystemInfo.GetTypeFromString("LOG4NET.UTIL.SYSTEMINFO", false, true);
+ t = GetTypeFromString("LOG4NET.UTIL.SYSTEMINFO", false, true);
Assert.AreSame(typeof(SystemInfo), t, "Test explicit case in-sensitive type load caps");
- t = SystemInfo.GetTypeFromString("log4net.util.systeminfo", false, true);
+ t = GetTypeFromString("log4net.util.systeminfo", false, true);
Assert.AreSame(typeof(SystemInfo), t, "Test explicit case in-sensitive type load lower");
}
@@ -133,10 +142,10 @@ namespace log4net.Tests.Util
{
Type t;
- t = SystemInfo.GetTypeFromString("LOG4NET.TESTS.UTIL.SYSTEMINFOTEST,LOG4NET.TESTS", false, false);
+ t = GetTypeFromString("LOG4NET.TESTS.UTIL.SYSTEMINFOTEST,LOG4NET.TESTS", false, false);
Assert.AreSame(null, t, "Test explicit case sensitive fails type load");
- t = SystemInfo.GetTypeFromString("LOG4NET.TESTS.UTIL.SYSTEMINFOTEST,LOG4NET.TESTS", true, false);
+ t = GetTypeFromString("LOG4NET.TESTS.UTIL.SYSTEMINFOTEST,LOG4NET.TESTS", true, false);
}
[Test, ExpectedException(typeof(TypeLoadException))]
@@ -144,10 +153,22 @@ namespace log4net.Tests.Util
{
Type t;
- t = SystemInfo.GetTypeFromString("LOG4NET.TESTS.UTIL.SYSTEMINFOTEST", false, false);
+ t = GetTypeFromString("LOG4NET.TESTS.UTIL.SYSTEMINFOTEST", false, false);
Assert.AreSame(null, t, "Test explicit case sensitive fails type load");
- t = SystemInfo.GetTypeFromString("LOG4NET.TESTS.UTIL.SYSTEMINFOTEST", true, false);
+ t = GetTypeFromString("LOG4NET.TESTS.UTIL.SYSTEMINFOTEST", true, false);
+ }
+
+ // Wraps SystemInfo.GetTypeFromString because the method relies on GetCallingAssembly, which is
+ // unavailable in CoreFX. As a workaround, only overloads which explicitly take a Type or Assembly
+ // are exposed for NETSTANDARD1_3.
+ private Type GetTypeFromString(string typeName, bool throwOnError, bool ignoreCase)
+ {
+#if NETSTANDARD1_3
+ return SystemInfo.GetTypeFromString(GetType().GetTypeInfo().Assembly, typeName, throwOnError, ignoreCase);
+#else
+ return SystemInfo.GetTypeFromString(typeName, throwOnError, ignoreCase);
+#endif
}
}
}
Modified: logging/log4net/trunk/tests/src/Utils.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Utils.cs?rev=1756257&r1=1756256&r2=1756257&view=diff
==============================================================================
--- logging/log4net/trunk/tests/src/Utils.cs (original)
+++ logging/log4net/trunk/tests/src/Utils.cs Sat Aug 13 12:47:25 2016
@@ -17,6 +17,7 @@
//
#endregion
+using log4net.Repository;
using System;
using System.Reflection;
@@ -43,12 +44,20 @@ namespace log4net.Tests
public static object InvokeMethod(object target, string name, params object[] args)
{
+#if NETSTANDARD1_3
+ return target.GetType().GetTypeInfo().GetDeclaredMethod(name).Invoke(target, args);
+#else
return target.GetType().GetMethod(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance, null, GetTypesArray(args), null).Invoke(target, args);
+#endif
}
public static object InvokeMethod(Type target, string name, params object[] args)
{
+#if NETSTANDARD1_3
+ return target.GetTypeInfo().GetDeclaredMethod(name).Invoke(null, args);
+#else
return target.GetMethod(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static, null, GetTypesArray(args), null).Invoke(null, args);
+#endif
}
public static object GetField(object target, string name)
@@ -105,7 +114,28 @@ namespace log4net.Tests
internal static void RemovePropertyFromAllContexts() {
GlobalContext.Properties.Remove(PROPERTY_KEY);
ThreadContext.Properties.Remove(PROPERTY_KEY);
+#if !(NETCF || NETSTANDARD1_3)
LogicalThreadContext.Properties.Remove(PROPERTY_KEY);
+#endif
}
- }
+
+ // Wrappers because repository/logger retrieval APIs require an Assembly argument on NETSTANDARD1_3
+ internal static ILog GetLogger(string name)
+ {
+#if NETSTANDARD1_3
+ return LogManager.GetLogger(typeof(Utils).GetTypeInfo().Assembly, name);
+#else
+ return LogManager.GetLogger(name);
+#endif
+ }
+
+ internal static ILoggerRepository GetRepository()
+ {
+#if NETSTANDARD1_3
+ return LogManager.GetRepository(typeof(Utils).GetTypeInfo().Assembly);
+#else
+ return LogManager.GetRepository();
+#endif
+ }
+ }
}
\ No newline at end of file