[ 
https://issues.apache.org/jira/browse/LOG4NET-10?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12625958#action_12625958
 ] 

Mark Mitchell commented on LOG4NET-10:
--------------------------------------

Ron,

You are right -- I added the assembly information about the logging repository. 
 I think adding the assembly information about the calling code is the goal, 
but may not be simple to implement in an efficient way.

The reason I implemented the assembly information about the repository is to 
support the following use case (which I think covers most of the uses of this 
type of feature):

public class X {
    private static final ILog logger = LogManager.getLogger(typeof(X));
   ...
}

Whenever the logger in the example above calls a log method, the assembly 
information I store in the logger repository is the same as the assembly for 
class X, and thus whenever logger outputs log messages, the proper assembly 
information from it is displayed.  The information does not need to be 
dynamically found for every log call, but is properly setup in the 
LogManager.getLogger(typeof(X)) method, only the first time.

The area where this will not work is if users do not use the pattern of one 
logger per class or use named loggers.  However, I think enough people use the 
one logger per class mechanism that it might warrant having two approaches, 
especially since this way is probably going to be *much* faster than 
dynamically determining the calling assembly for *every* logging statement.

Thoughts?

-Mark

> Add %v pattern to output assembly version
> -----------------------------------------
>
>                 Key: LOG4NET-10
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-10
>             Project: Log4net
>          Issue Type: New Feature
>          Components: Core
>    Affects Versions: 1.2.9, 1.2.10
>         Environment: From sourceforege - 775175 - Daniel Cazzulino (kzu) - 
> dcazzulino
>            Reporter: Nicko Cadell
>            Assignee: Ron Grabowski
>            Priority: Minor
>             Fix For: 1.2.11
>
>         Attachments: asm-patterns.patch, asm-ver-desc-patterns.patch, 
> log4net.dll
>
>
> n an environment where multiple versions of the same
> assembly is being used simultaneously by different
> applications, it's very useful to get the version of
> the assembly that is emiting the logging event.
> I'll add this right away. If you want the (rather
> trivial) code, I can post it.
> Daniel Cazzulino
> ---
> Well, the code is not trivial (to implement in a performant
> way), and our project is a little time-constrained. 
> If I can, I'll try to make it, most probably in the
> LogManager.GetLogger method (the usage pattern indicates
> this will probably be a single static call per-class using
> logging)... I don't know.
> Daniel Cazzulino

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to