[jboss-jira] [JBoss JIRA] (WFCORE-1512) DelegatingBasicLogger could delegate to a Logger provider
James Perkins (JIRA)
issues at jboss.org
Wed Apr 27 12:28:00 EDT 2016
[ https://issues.jboss.org/browse/WFCORE-1512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13197991#comment-13197991 ]
James Perkins commented on WFCORE-1512:
---------------------------------------
We'd have to add some kind of {{getDelegate()}} method to the {{DelegatingBasicLogger}} that would essentially have to something like {{LoggerProvider.getLogger()}} for every log invocation. That would hit performance fairly heavily I'd think. It would also essentially make a static logger not really static.
> DelegatingBasicLogger could delegate to a Logger provider
> ---------------------------------------------------------
>
> Key: WFCORE-1512
> URL: https://issues.jboss.org/browse/WFCORE-1512
> Project: WildFly Core
> Issue Type: Feature Request
> Components: Logging
> Reporter: Jean-Francois Denise
> Assignee: James Perkins
>
> Today the DelegatingBasicLogger subclass generated from @MessageLogger annotation is bound to a Logger at construction time. It could be of interest (e.g: I ran by accident on WFCORE-1187) to have the logger to be resolved dynamically.
> I didn't evaluate the impact on the logging project/tools/performances of a solution like the following but it captures the idea of a logger provider.
> public class DelegatingBasicLogger {
> public interface LoggerProvider
> { public Logger getLogger(); }
> DelegatingBasicLogger(Logger logger) {
> { this(()->{return logger;})}
> DelegatingBasicLogger(LoggerProvider provider)
> { this.provider = provider; }
> ....
> }
> A subclass could use LogContext to retrieve the right Logger.
> class MyLogger extends DelegatingBasicLogger {
> MyLogger(String category)
> { super(()->LogContext.getLogContext().getLogger()); }
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jboss-jira
mailing list