[jboss-jira] [JBoss JIRA] (WFCORE-1512) DelegatingBasicLogger could delegate to a Logger provider

Jean-Francois Denise (JIRA) issues at jboss.org
Wed Apr 27 04:36:00 EDT 2016


Jean-Francois Denise created WFCORE-1512:
--------------------------------------------

             Summary: 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