[ 
https://issues.apache.org/jira/browse/LOG4NET-307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Bodewig updated LOG4NET-307:
-----------------------------------

    Fix Version/s: 1.2 Maintenance Release

> New pattern AssemblyLocationPatternConverter
> --------------------------------------------
>
>                 Key: LOG4NET-307
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-307
>             Project: Log4net
>          Issue Type: New Feature
>          Components: Other
>    Affects Versions: 1.2.9, 1.2.10
>            Reporter: Jon Abaunza
>             Fix For: 1.2 Maintenance Release
>
>
> It would be really easy and nice, to hace the 
> AssemblyLocationPatternConverter that would allow to retrieve the assembly of 
> the Caller.
> using System;
> using System.Text;
> using System.IO;
> using log4net.Core;
> namespace log4net.Layout.Pattern
> {     internal sealed class AssemblyLocationPatternConverter : 
> PatternLayoutConverter 
>       {               override protected void Convert(TextWriter writer, 
> LoggingEvent loggingEvent)
>               {
>                       
> writer.Write(loggingEvent.LocationInformation.AssemblyName);
>               }       
>                 }
> }     
> It just would need the retrieval of the Assembly Name in the LocationInfo 
> (new property AssemblyName and the retrieval in the constructor)
> ...Retrieval....
> m_assembly = method.Module.Assembly.FullName;
> ... 
> After this... it just would be needed to register the new pattern so that it 
> would be recognized. (Added in the static constructor of PatternLayout)
> ....
> s_globalRulesRegistry.Add("assembly", 
> typeof(AssemblyLocationPatternConverter));
> ....
> With a conversion pattern like the following
> <conversionPattern value="%assembly"/>
> We could get the following log:
> WindowsFormsApplication3, Version=1.0.0.0, Culture=neutral, 
> PublicKeyToken=null

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to