[ 
https://issues.apache.org/jira/browse/LOG4J2-1171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14970428#comment-14970428
 ] 

Remko Popma commented on LOG4J2-1171:
-------------------------------------

Would it be okay to add a method to the ContextSelector interface? 

Something like
{code}
LoggerContext getContext(String fqcn, ClassLoader loader, boolean 
currentContext, URI configLocation, String name);
// where name is passed to the LoggerContext constructor
{code}

One alternative is to set/modify the LoggerContext name after it is 
constructed. (It is currently a final field without a setter.)

Another alternative would be to create a new interface that subclasses 
ContextSelector and add the above new method to this interface. 
{{Log4jContextFactory.getContext}} would check the type of the selector and 
cast to the new interface to call the new method where possible.


> LoggerContext names are cryptic
> -------------------------------
>
>                 Key: LOG4J2-1171
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1171
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Configurators, JMX
>    Affects Versions: 2.3, 2.4, 2.4.1
>            Reporter: Remko Popma
>            Priority: Minor
>
> LoggerContext names currently look like "5e90b76c", or 
> "AsyncContext@5e90b76c". Originally the LoggerContext name was 
> ClassLoader.toString(), but this had issues for very long multi-line 
> classloader descriptions (LOG4J2-666).
> The problem with the current naming is that a web container with multiple web 
> applications deployed will not be able to determine which of the Log4j2 JMX 
> MBeans maps to which web application. Similarly, debug-level status messages 
> at startup cannot be mapped to the correct web app.
> The place to address this is probably {{Log4jContextFactory.getContext(String 
> fqcn, ClassLoader loader, Object externalContext, boolean currentContext, URI 
> configLocation, String name)}}. 
> The specified name is currently ignored.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to