[
https://issues.apache.org/jira/browse/LOG4NET-136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562182#action_12562182 ]
Tom Crossland commented on LOG4NET-136:
---------------------------------------
Currently, the %logger pattern produces something like this for generic types:
My.App.Package.TypeName`1[[My.App.Generic.ParameterTypeName, My.Assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]
I think the trick here would be to first remove any assembly information (i.e. delete anything to the right hand side of any comma, including the comma itself). The remaining string will be of the following format:
My.App.Package.TypeName`1[[My.App.Generic.ParameterTypeName
The %logger{n} pattern could then be applied both to the generic component class names to come up with something like:
(if n == 2) Package.TypeName<Generic.ParameterTypeName>
(if n == 1) TypeName<ParameterTypeName>
The other (possibly better) option would be to remove the parameter type completely, i.e. delete everything to the right of a "[".
The only remaining issue would be the funny "`1", which I guess represents the number of parameters of the generic type.
Suggestions?
> logger conversionPattern restriction doesn't work correctly for Generic classes
> -------------------------------------------------------------------------------
>
> Key: LOG4NET-136
> URL:
https://issues.apache.org/jira/browse/LOG4NET-136> Project: Log4net
> Issue Type: Bug
> Affects Versions: 1.2.10
> Environment: Windows 2000 Professional, .NET Framework 2.0
> Reporter: Tom Crossland
> Priority: Minor
>
> <conversionPattern value="%date %-5level %logger{1} - %message%newline"/>
> Using the above conversion pattern for a logger of a Generic class (i.e. My.System.MyClass<My.System.MyObject>) will result in the following log output:
> 2008-01-17 21:54:48,968 INFO 0, Culture=neutral, PublicKeyToken=null]] - My error message
> Obviously, in this case it's not appropriate to just take the portion of the class name after the last '.' character.
> Thanks
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.