Index: src/Core/CompactRepositorySelector.cs =================================================================== --- src/Core/CompactRepositorySelector.cs (revision 505391) +++ src/Core/CompactRepositorySelector.cs (working copy) @@ -186,6 +186,8 @@ { // Must create the repository rep = CreateRepository(DefaultRepositoryName, repositoryType); + // set assembly + rep.Assembly = assembly; } return rep; Index: src/Core/DefaultRepositorySelector.cs =================================================================== --- src/Core/DefaultRepositorySelector.cs (revision 505391) +++ src/Core/DefaultRepositorySelector.cs (working copy) @@ -292,6 +292,8 @@ { // Create the repository rep = CreateRepository(actualRepositoryName, actualRepositoryType); + // set assembly + rep.Assembly = repositoryAssembly; if (readAssemblyAttributes) { Index: src/Layout/Pattern/AsmDescPatternConverter.cs =================================================================== --- src/Layout/Pattern/AsmDescPatternConverter.cs (revision 0) +++ src/Layout/Pattern/AsmDescPatternConverter.cs (revision 0) @@ -0,0 +1,73 @@ +#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.Text; +using System.IO; + +using log4net.Core; +using log4net.Util; + +namespace log4net.Layout.Pattern +{ + /// + /// Write the assembly's description attribute to the output + /// + /// + /// + /// Writes the to the output writer. + /// + /// + /// Mark Mitchell + internal sealed class AsmDescPatternConverter : PatternLayoutConverter + { + /// + /// Write the assembly description attribute to the output + /// + /// that will receive the formatted result. + /// the event being logged + /// + /// + /// Writes the to the output . + /// + /// + override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + { + if (loggingEvent.Repository != null) + { + Assembly asm = loggingEvent.Repository.Assembly; + if (asm != null) + { + object[] attrs = asm.GetCustomAttributes(typeof (AssemblyDescriptionAttribute), true); + if (attrs != null && attrs.Length == 1 && attrs[0] is AssemblyDescriptionAttribute) + { + AssemblyDescriptionAttribute desc = (AssemblyDescriptionAttribute)attrs[0]; + writer.Write(desc.Description); + } else + { + writer.Write(SystemInfo.NotAvailableText); + } + } + } else + { + writer.Write(SystemInfo.NotAvailableText); + } + } + } +} Index: src/Layout/Pattern/AsmVersionPatternConverter.cs =================================================================== --- src/Layout/Pattern/AsmVersionPatternConverter.cs (revision 0) +++ src/Layout/Pattern/AsmVersionPatternConverter.cs (revision 0) @@ -0,0 +1,66 @@ +#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.Text; +using System.IO; + +using log4net.Core; +using log4net.Util; + +namespace log4net.Layout.Pattern +{ + /// + /// Write the assembly's version to the output + /// + /// + /// + /// Writes the to the output writer. + /// + /// + /// Mark Mitchell + internal sealed class AsmVersionPatternConverter : PatternLayoutConverter + { + /// + /// Write the assembly's version to the output + /// + /// that will receive the formatted result. + /// the event being logged + /// + /// + /// Writes the to the output . + /// + /// + override protected void Convert(TextWriter writer, LoggingEvent loggingEvent) + { + if (loggingEvent.Repository != null) + { + Assembly asm = loggingEvent.Repository.Assembly; + if (asm != null) + { + writer.Write(asm.GetName().Version); + } writer.Write(SystemInfo.NotAvailableText); + + } else + { + writer.Write(SystemInfo.NotAvailableText); + } + } + } +} \ No newline at end of file Index: src/Layout/PatternLayout.cs =================================================================== --- src/Layout/PatternLayout.cs (revision 505391) +++ src/Layout/PatternLayout.cs (working copy) @@ -796,7 +796,7 @@ /// static PatternLayout() { - s_globalRulesRegistry = new Hashtable(45); + s_globalRulesRegistry = new Hashtable(47); s_globalRulesRegistry.Add("literal", typeof(LiteralPatternConverter)); s_globalRulesRegistry.Add("newline", typeof(NewLinePatternConverter)); @@ -871,6 +871,9 @@ s_globalRulesRegistry.Add("w", typeof(UserNamePatternConverter)); s_globalRulesRegistry.Add("username", typeof(UserNamePatternConverter)); + + s_globalRulesRegistry.Add("asm-desc", typeof(AsmDescPatternConverter)); + s_globalRulesRegistry.Add("asm-ver", typeof(AsmVersionPatternConverter)); } #endregion Static Constructor Index: src/Repository/ILoggerRepository.cs =================================================================== --- src/Repository/ILoggerRepository.cs (revision 505391) +++ src/Repository/ILoggerRepository.cs (working copy) @@ -17,7 +17,7 @@ #endregion using System; - +using System.Reflection; using log4net; using log4net.ObjectRenderer; using log4net.Core; @@ -104,6 +104,15 @@ /// string Name { get; set; } + + /// + /// The assembly from which this logger repository was based on (if applicable) + /// + /// Returns null if this logger repository is based on a name instead + /// + Assembly Assembly { get; set; } + + /// /// RendererMap accesses the object renderer map for this repository. /// Index: src/Repository/LoggerRepositorySkeleton.cs =================================================================== --- src/Repository/LoggerRepositorySkeleton.cs (revision 505391) +++ src/Repository/LoggerRepositorySkeleton.cs (working copy) @@ -17,7 +17,7 @@ #endregion using System; - +using System.Reflection; using log4net.ObjectRenderer; using log4net.Core; using log4net.Util; @@ -53,6 +53,7 @@ private event LoggerRepositoryConfigurationResetEventHandler m_configurationResetEvent; private event LoggerRepositoryConfigurationChangedEventHandler m_configurationChangedEvent; private PropertiesDictionary m_properties; + private Assembly m_assembly; #endregion @@ -115,6 +116,15 @@ get { return m_name; } set { m_name = value; } } + + /// + /// Assembly on which this repository is based + /// + virtual public Assembly Assembly + { + get { return m_assembly; } + set { m_assembly = value; } + } /// /// The threshold for all events in this repository