You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by dp...@apache.org on 2017/04/26 09:12:00 UTC
[16/50] [abbrv] logging-log4net git commit: Added sample extension
that returns logger wrappers that are MarshalByRef
Added sample extension that returns logger wrappers that are MarshalByRef
Project: http://git-wip-us.apache.org/repos/asf/logging-log4net/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4net/commit/9930fffe
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4net/tree/9930fffe
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4net/diff/9930fffe
Branch: refs/heads/origin/trunk
Commit: 9930fffe162776b31aed27f3b37e00d4d55e93ed
Parents: 341a28c
Author: Nicko Cadell <ni...@apache.org>
Authored: Wed Feb 16 22:13:50 2005 +0000
Committer: Nicko Cadell <ni...@apache.org>
Committed: Wed Feb 16 22:13:50 2005 +0000
----------------------------------------------------------------------
.../1.0/log4net.Ext.MarshalByRef/cs/.cvsignore | 4 +
.../1.0/log4net.Ext.MarshalByRef/cs/nant.build | 36 +++
.../1.0/log4net.Ext.MarshalByRef/cs/nant.config | 7 +
.../log4net.Ext.MarshalByRef/cs/src/.cvsignore | 6 +
.../cs/src/AssemblyInfo.cs | 62 ++++
.../cs/src/MarshalByRefLogImpl.cs | 226 ++++++++++++++
.../cs/src/MarshalByRefLogManager.cs | 291 +++++++++++++++++++
.../cs/src/log4net.Ext.MarshalByRef.csproj | 111 +++++++
.../net/1.0/log4net.Ext.MarshalByRef/nant.build | 13 +
.../1.0/log4net.Ext.MarshalByRef/nant.config | 5 +
10 files changed, 761 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/9930fffe/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/.cvsignore
----------------------------------------------------------------------
diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/.cvsignore b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/.cvsignore
new file mode 100755
index 0000000..1c2c992
--- /dev/null
+++ b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/.cvsignore
@@ -0,0 +1,4 @@
+bin
+doc
+build
+
http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/9930fffe/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/nant.build
----------------------------------------------------------------------
diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/nant.build b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/nant.build
new file mode 100755
index 0000000..ed01836
--- /dev/null
+++ b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/nant.build
@@ -0,0 +1,36 @@
+<?xml version="1.0" ?>
+<project name="log4net-samples" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
+ <!-- Include configuration file -->
+ <include buildfile="nant.config" />
+ <!-- Include log4net helpers -->
+ <include buildfile="${log4net.basedir}/log4net.include" />
+ <!-- Targets that should always be executed -->
+ <call target="set-build-configuration" />
+ <call target="set-${project.runtime.config}-${project.runtime.version}-runtime-configuration" />
+ <!-- Target for compiling the example -->
+ <target name="compile" description="Builds the example" depends="check-current-bin-dir, clean-current-bin-dir, check-current-build-defines, check-current-build-config, check-current-build-debug, check-log4net-assembly">
+ <!-- make sure the log4net key file is available to the compiler in a release build -->
+ <if test="${current.build.config.release}">
+ <!-- check if the log4net key file is available -->
+ <if test="${not file::exists(log4net.basedir + '/log4net.snk')}">
+ <echo message="Key file not found. You can generate a key file by running 'sn -k log4net.snk'." />
+ <echo message="The generated key file should be stored in the log4net base directory." />
+ <fail message="The release build could not be built." />
+ </if>
+ <if test="${file::exists(log4net.basedir + '/log4net.snk')}">
+ <!-- copy the log4net key file to the location where the compiler expects it to be -->
+ <copy file="${log4net.basedir}/log4net.snk" todir="${current.bin.dir}/../../../" />
+ </if>
+ </if>
+ <!-- compile the example -->
+ <csc noconfig="true" target="library" warnaserror="true" debug="${current.build.debug}" define="${current.build.defines.csc}" output="${current.bin.dir}/log4net.Ext.MarshalByRef.dll">
+ <sources>
+ <include name="src/**/*.cs" />
+ <include name="${log4net.basedir}/src/AssemblyVersionInfo.cs" />
+ </sources>
+ <references basedir="${log4net.output.dir}">
+ <include name="log4net.dll" />
+ </references>
+ </csc>
+ </target>
+</project>
http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/9930fffe/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/nant.config
----------------------------------------------------------------------
diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/nant.config b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/nant.config
new file mode 100755
index 0000000..a6e7363
--- /dev/null
+++ b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/nant.config
@@ -0,0 +1,7 @@
+<?xml version="1.0" ?>
+<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
+ <!-- Include parent configuration file -->
+ <include buildfile="../nant.config" />
+ <!-- Set log4net base directory -->
+ <property name="log4net.basedir" value="../../../../../" />
+</project>
http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/9930fffe/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/.cvsignore
----------------------------------------------------------------------
diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/.cvsignore b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/.cvsignore
new file mode 100755
index 0000000..c74ea63
--- /dev/null
+++ b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/.cvsignore
@@ -0,0 +1,6 @@
+bin
+obj
+log4net.xml
+*.csproj.user
+*.suo
+
http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/9930fffe/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/AssemblyInfo.cs b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/AssemblyInfo.cs
new file mode 100755
index 0000000..68cc4e5
--- /dev/null
+++ b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/AssemblyInfo.cs
@@ -0,0 +1,62 @@
+#region Copyright & License
+//
+// Copyright 2001-2005 The Apache Software Foundation
+//
+// Licensed 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.
+//
+#endregion
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly: AssemblyTitle("log4net.Ext.MarshalByRef")]
+[assembly: AssemblyDescription("log4net MarshalByRef Extension")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyProduct("log4net.Ext.MarshalByRef")]
+[assembly: AssemblyCulture("")]
+
+//
+// In order to sign your assembly you must specify a key to use. Refer to the
+// Microsoft .NET Framework documentation for more information on assembly signing.
+//
+// Use the attributes below to control which key is used for signing.
+//
+// Notes:
+// (*) If no key is specified, the assembly is not signed.
+// (*) KeyName refers to a key that has been installed in the Crypto Service
+// Provider (CSP) on your machine. KeyFile refers to a file which contains
+// a key.
+// (*) If the KeyFile and the KeyName values are both specified, the
+// following processing occurs:
+// (1) If the KeyName can be found in the CSP, that key is used.
+// (2) If the KeyName does not exist and the KeyFile does exist, the key
+// in the KeyFile is installed into the CSP and used.
+// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
+// When specifying the KeyFile, the location of the KeyFile should be
+// relative to the project output directory which is
+// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
+// located in the project directory, you would specify the AssemblyKeyFile
+// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
+// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+// documentation for more information on this.
+//
+#if STRONG
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile(@"..\..\..\..\log4net.snk")]
+[assembly: AssemblyKeyName("")]
+#endif
http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/9930fffe/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/MarshalByRefLogImpl.cs
----------------------------------------------------------------------
diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/MarshalByRefLogImpl.cs b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/MarshalByRefLogImpl.cs
new file mode 100755
index 0000000..f3ff189
--- /dev/null
+++ b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/MarshalByRefLogImpl.cs
@@ -0,0 +1,226 @@
+#region Copyright & License
+//
+// Copyright 2001-2005 The Apache Software Foundation
+//
+// Licensed 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.
+//
+#endregion
+
+using System;
+using log4net.Core;
+using log4net.Repository;
+
+namespace log4net.Ext.MarshalByRef
+{
+ /// <summary>
+ /// Marshal By Reference implementation of <see cref="ILog"/>
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// Logger wrapper that is <see cref="MarshalByRefObject"/>. These objects
+ /// can be passed by reference across a remoting boundary.
+ /// </para>
+ /// </remarks>
+ public sealed class MarshalByRefLogImpl : MarshalByRefObject, ILog
+ {
+ private readonly static Type ThisDeclaringType = typeof(MarshalByRefLogImpl);
+ private readonly ILogger m_logger;
+ private Level m_levelDebug;
+ private Level m_levelInfo;
+ private Level m_levelWarn;
+ private Level m_levelError;
+ private Level m_levelFatal;
+
+ #region Public Instance Constructors
+
+ public MarshalByRefLogImpl(ILogger logger)
+ {
+ m_logger = logger;
+
+ // Listen for changes to the repository
+ logger.Repository.ConfigurationChanged += new LoggerRepositoryConfigurationChangedEventHandler(LoggerRepositoryConfigurationChanged);
+
+ // load the current levels
+ ReloadLevels(logger.Repository);
+ }
+
+ #endregion Public Instance Constructors
+
+ private void ReloadLevels(ILoggerRepository repository)
+ {
+ LevelMap levelMap = repository.LevelMap;
+
+ m_levelDebug = levelMap.LookupWithDefault(Level.Debug);
+ m_levelInfo = levelMap.LookupWithDefault(Level.Info);
+ m_levelWarn = levelMap.LookupWithDefault(Level.Warn);
+ m_levelError = levelMap.LookupWithDefault(Level.Error);
+ m_levelFatal = levelMap.LookupWithDefault(Level.Fatal);
+ }
+
+ private void LoggerRepositoryConfigurationChanged(object sender, EventArgs e)
+ {
+ ILoggerRepository repository = sender as ILoggerRepository;
+ if (repository != null)
+ {
+ ReloadLevels(repository);
+ }
+ }
+
+ #region Implementation of ILog
+
+ public void Debug(object message)
+ {
+ Logger.Log(ThisDeclaringType, m_levelDebug, message, null);
+ }
+
+ public void Debug(object message, Exception t)
+ {
+ Logger.Log(ThisDeclaringType, m_levelDebug, message, t);
+ }
+
+ public void DebugFormat(string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, m_levelDebug, String.Format(format, args), null);
+ }
+
+ public void DebugFormat(IFormatProvider provider, string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, m_levelDebug, String.Format(provider, format, args), null);
+ }
+
+ public void Info(object message)
+ {
+ Logger.Log(ThisDeclaringType, m_levelInfo, message, null);
+ }
+
+ public void Info(object message, Exception t)
+ {
+ Logger.Log(ThisDeclaringType, m_levelInfo, message, t);
+ }
+
+ public void InfoFormat(string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, m_levelInfo, String.Format(format, args), null);
+ }
+
+ public void InfoFormat(IFormatProvider provider, string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, m_levelInfo, String.Format(provider, format, args), null);
+ }
+
+ public void Warn(object message)
+ {
+ Logger.Log(ThisDeclaringType, m_levelWarn, message, null);
+ }
+
+ public void Warn(object message, Exception t)
+ {
+ Logger.Log(ThisDeclaringType, m_levelWarn, message, t);
+ }
+
+ public void WarnFormat(string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, m_levelWarn, String.Format(format, args), null);
+ }
+
+ public void WarnFormat(IFormatProvider provider, string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, m_levelWarn, String.Format(provider, format, args), null);
+ }
+
+ public void Error(object message)
+ {
+ Logger.Log(ThisDeclaringType, m_levelError, message, null);
+ }
+
+ public void Error(object message, Exception t)
+ {
+ Logger.Log(ThisDeclaringType, m_levelError, message, t);
+ }
+
+ public void ErrorFormat(string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, m_levelError, String.Format(format, args), null);
+ }
+
+ public void ErrorFormat(IFormatProvider provider, string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, m_levelError, String.Format(provider, format, args), null);
+ }
+
+ public void Fatal(object message)
+ {
+ Logger.Log(ThisDeclaringType, m_levelFatal, message, null);
+ }
+
+ public void Fatal(object message, Exception t)
+ {
+ Logger.Log(ThisDeclaringType, m_levelFatal, message, t);
+ }
+
+ public void FatalFormat(string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, m_levelFatal, String.Format(format, args), null);
+ }
+
+ public void FatalFormat(IFormatProvider provider, string format, params object[] args)
+ {
+ Logger.Log(ThisDeclaringType, m_levelFatal, String.Format(provider, format, args), null);
+ }
+
+ public bool IsDebugEnabled
+ {
+ get { return Logger.IsEnabledFor(m_levelDebug); }
+ }
+
+ public bool IsInfoEnabled
+ {
+ get { return Logger.IsEnabledFor(m_levelInfo); }
+ }
+
+ public bool IsWarnEnabled
+ {
+ get { return Logger.IsEnabledFor(m_levelWarn); }
+ }
+
+ public bool IsErrorEnabled
+ {
+ get { return Logger.IsEnabledFor(m_levelError); }
+ }
+
+ public bool IsFatalEnabled
+ {
+ get { return Logger.IsEnabledFor(m_levelFatal); }
+ }
+
+ #endregion Implementation of ILog
+
+ #region Implementation of ILoggerWrapper
+
+ public ILogger Logger
+ {
+ get { return m_logger; }
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Live forever
+ /// </summary>
+ /// <returns><c>null</c></returns>
+ public override object InitializeLifetimeService()
+ {
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/9930fffe/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/MarshalByRefLogManager.cs
----------------------------------------------------------------------
diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/MarshalByRefLogManager.cs b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/MarshalByRefLogManager.cs
new file mode 100755
index 0000000..e663d10
--- /dev/null
+++ b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/MarshalByRefLogManager.cs
@@ -0,0 +1,291 @@
+#region Copyright & License
+//
+// Copyright 2001-2005 The Apache Software Foundation
+//
+// Licensed 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.
+//
+#endregion
+
+using System;
+using System.Reflection;
+using System.Collections;
+
+using log4net;
+using log4net.Core;
+using log4net.Repository;
+using log4net.Repository.Hierarchy;
+
+/*
+ * Custom Logging Classes to support Remoting by reference.
+ */
+namespace log4net.Ext.MarshalByRef
+{
+ /// <summary>
+ /// LogManager that returns <see cref="MarshalByRefLogImpl"/> loggers.
+ /// </summary>
+ public class MarshalByRefLogManager
+ {
+ #region Static Member Variables
+
+ /// <summary>
+ /// The wrapper map to use to hold the <see cref="EventIDLogImpl"/> objects
+ /// </summary>
+ private static readonly WrapperMap s_wrapperMap = new WrapperMap(new WrapperCreationHandler(WrapperCreationHandler));
+
+ #endregion
+
+ #region Constructor
+
+ /// <summary>
+ /// Private constructor to prevent object creation
+ /// </summary>
+ private MarshalByRefLogManager() { }
+
+ #endregion
+
+ #region Type Specific Manager Methods
+
+ /// <summary>
+ /// Returns the named logger if it exists
+ /// </summary>
+ /// <remarks>
+ /// <para>If the named logger exists (in the default hierarchy) then it
+ /// returns a reference to the logger, otherwise it returns
+ /// <c>null</c>.</para>
+ /// </remarks>
+ /// <param name="name">The fully qualified logger name to look for</param>
+ /// <returns>The logger found, or null</returns>
+ public static ILog Exists(string name)
+ {
+ return Exists(Assembly.GetCallingAssembly(), name);
+ }
+
+ /// <summary>
+ /// Returns the named logger if it exists
+ /// </summary>
+ /// <remarks>
+ /// <para>If the named logger exists (in the specified domain) then it
+ /// returns a reference to the logger, otherwise it returns
+ /// <c>null</c>.</para>
+ /// </remarks>
+ /// <param name="domain">the domain to lookup in</param>
+ /// <param name="name">The fully qualified logger name to look for</param>
+ /// <returns>The logger found, or null</returns>
+ public static ILog Exists(string domain, string name)
+ {
+ return WrapLogger(LoggerManager.Exists(domain, name));
+ }
+
+ /// <summary>
+ /// Returns the named logger if it exists
+ /// </summary>
+ /// <remarks>
+ /// <para>If the named logger exists (in the specified assembly's domain) then it
+ /// returns a reference to the logger, otherwise it returns
+ /// <c>null</c>.</para>
+ /// </remarks>
+ /// <param name="assembly">the assembly to use to lookup the domain</param>
+ /// <param name="name">The fully qualified logger name to look for</param>
+ /// <returns>The logger found, or null</returns>
+ public static ILog Exists(Assembly assembly, string name)
+ {
+ return WrapLogger(LoggerManager.Exists(assembly, name));
+ }
+
+ /// <summary>
+ /// Returns all the currently defined loggers in the default domain.
+ /// </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 domain.
+ /// </summary>
+ /// <param name="domain">the domain to lookup in</param>
+ /// <remarks>
+ /// The root logger is <b>not</b> included in the returned array.
+ /// </remarks>
+ /// <returns>All the defined loggers</returns>
+ public static ILog[] GetCurrentLoggers(string domain)
+ {
+ return WrapLoggers(LoggerManager.GetCurrentLoggers(domain));
+ }
+
+ /// <summary>
+ /// Returns all the currently defined loggers in the specified assembly's domain.
+ /// </summary>
+ /// <param name="assembly">the assembly to use to lookup the domain</param>
+ /// <remarks>
+ /// The root logger is <b>not</b> included in the returned array.
+ /// </remarks>
+ /// <returns>All the defined loggers</returns>
+ public static ILog[] GetCurrentLoggers(Assembly assembly)
+ {
+ return WrapLoggers(LoggerManager.GetCurrentLoggers(assembly));
+ }
+
+ /// <summary>
+ /// Retrieve or create a named logger.
+ /// </summary>
+ /// <remarks>
+ /// <para>Retrieve 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>
+ /// Retrieve or create a named logger.
+ /// </summary>
+ /// <remarks>
+ /// <para>Retrieve 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="domain">the domain to lookup in</param>
+ /// <param name="name">The name of the logger to retrieve.</param>
+ /// <returns>the logger with the name specified</returns>
+ public static ILog GetLogger(string domain, string name)
+ {
+ return WrapLogger(LoggerManager.GetLogger(domain, name));
+ }
+
+ /// <summary>
+ /// Retrieve or create a named logger.
+ /// </summary>
+ /// <remarks>
+ /// <para>Retrieve 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="assembly">the assembly to use to lookup the domain</param>
+ /// <param name="name">The name of the logger to retrieve.</param>
+ /// <returns>the logger with the name specified</returns>
+ public static ILog GetLogger(Assembly assembly, string name)
+ {
+ return WrapLogger(LoggerManager.GetLogger(assembly, name));
+ }
+
+ /// <summary>
+ /// Shorthand for <see cref="LogManager.GetLogger(string)"/>.
+ /// </summary>
+ /// <remarks>
+ /// Get the logger for the fully qualified name of the type specified.
+ /// </remarks>
+ /// <param name="type">The full name of <paramref name="type"/> will
+ /// be used as the name of the logger to retrieve.</param>
+ /// <returns>the logger with the name specified</returns>
+ public static ILog GetLogger(Type type)
+ {
+ return GetLogger(Assembly.GetCallingAssembly(), type.FullName);
+ }
+
+ /// <summary>
+ /// Shorthand for <see cref="LogManager.GetLogger(string)"/>.
+ /// </summary>
+ /// <remarks>
+ /// Get the logger for the fully qualified name of the type specified.
+ /// </remarks>
+ /// <param name="domain">the domain to lookup in</param>
+ /// <param name="type">The full name of <paramref name="type"/> will
+ /// be used as the name of the logger to retrieve.</param>
+ /// <returns>the logger with the name specified</returns>
+ public static ILog GetLogger(string domain, Type type)
+ {
+ return WrapLogger(LoggerManager.GetLogger(domain, type));
+ }
+
+ /// <summary>
+ /// Shorthand for <see cref="LogManager.GetLogger(string)"/>.
+ /// </summary>
+ /// <remarks>
+ /// Get the logger for the fully qualified name of the type specified.
+ /// </remarks>
+ /// <param name="assembly">the assembly to use to lookup the domain</param>
+ /// <param name="type">The full name of <paramref name="type"/> will
+ /// be used as the name of the logger to retrieve.</param>
+ /// <returns>the logger with the name specified</returns>
+ public static ILog GetLogger(Assembly assembly, Type type)
+ {
+ return WrapLogger(LoggerManager.GetLogger(assembly, type));
+ }
+
+ #endregion
+
+ #region Extension Handlers
+
+ /// <summary>
+ /// Lookup the wrapper object for the logger specified
+ /// </summary>
+ /// <param name="logger">the logger to get the wrapper for</param>
+ /// <returns>the wrapper for the logger specified</returns>
+ public static ILog WrapLogger(ILogger logger)
+ {
+ return (ILog)s_wrapperMap.GetWrapper(logger);
+ }
+
+ /// <summary>
+ /// Lookup the wrapper objects for the loggers specified
+ /// </summary>
+ /// <param name="loggers">the loggers to get the wrappers for</param>
+ /// <returns>Lookup the wrapper objects for the loggers specified</returns>
+ public static ILog[] WrapLoggers(ILogger[] loggers)
+ {
+ ILog[] results = new ILog[loggers.Length];
+ for(int i=0; i<loggers.Length; i++)
+ {
+ results[i] = WrapLogger(loggers[i]);
+ }
+ return results;
+ }
+
+ /// <summary>
+ /// Method to create the <see cref="ILoggerWrapper"/> objects used by
+ /// this manager.
+ /// </summary>
+ /// <param name="logger">The logger to wrap</param>
+ /// <returns>The wrapper for the logger specified</returns>
+ private static ILoggerWrapper WrapperCreationHandler(ILogger logger)
+ {
+ return new MarshalByRefLogImpl(logger);
+ }
+
+ #endregion
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/9930fffe/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/log4net.Ext.MarshalByRef.csproj
----------------------------------------------------------------------
diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/log4net.Ext.MarshalByRef.csproj b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/log4net.Ext.MarshalByRef.csproj
new file mode 100755
index 0000000..7c2ebeb
--- /dev/null
+++ b/extensions/net/1.0/log4net.Ext.MarshalByRef/cs/src/log4net.Ext.MarshalByRef.csproj
@@ -0,0 +1,111 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{CB985027-C009-4C0F-88C1-8CF11912AE4C}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "log4net.Ext.MarshalByRef"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = "log4net.Ext.MarshalByRef"
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "..\build\debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE;STRONG"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "true"
+ OutputPath = "..\build\release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ <Reference
+ Name = "log4net"
+ AssemblyName = "log4net"
+ HintPath = "..\..\..\..\..\..\bin\net\1.0\release\log4net.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssemblyVersionInfo.cs"
+ Link = "..\..\..\..\..\..\src\AssemblyVersionInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MarshalByRefLogImpl.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MarshalByRefLogManager.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/9930fffe/extensions/net/1.0/log4net.Ext.MarshalByRef/nant.build
----------------------------------------------------------------------
diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/nant.build b/extensions/net/1.0/log4net.Ext.MarshalByRef/nant.build
new file mode 100755
index 0000000..504d441
--- /dev/null
+++ b/extensions/net/1.0/log4net.Ext.MarshalByRef/nant.build
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?>
+<project name="trace-extension" default="compile" xmlnds="http://tempuri.org/nant-vs.xsd">
+ <!-- compile Trace extension -->
+ <target name="compile" description="Builds Trace extension">
+ <nant target="compile">
+ <buildfiles>
+ <include name="*/nant.build" />
+ <!-- exclude current build file -->
+ <exclude name="exclude.build" />
+ </buildfiles>
+ </nant>
+ </target>
+</project>
http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/9930fffe/extensions/net/1.0/log4net.Ext.MarshalByRef/nant.config
----------------------------------------------------------------------
diff --git a/extensions/net/1.0/log4net.Ext.MarshalByRef/nant.config b/extensions/net/1.0/log4net.Ext.MarshalByRef/nant.config
new file mode 100755
index 0000000..26e110e
--- /dev/null
+++ b/extensions/net/1.0/log4net.Ext.MarshalByRef/nant.config
@@ -0,0 +1,5 @@
+<?xml version="1.0" ?>
+<project name="configuration" xmlnds="http://tempuri.org/nant-vs.xsd">
+ <!-- Include parent configuration file -->
+ <include buildfile="../nant.config" />
+</project>