[xwiki-devs] [Proposal] Switch to injecting Loggers
Hi, I'd like to commit @Inject injection of Loggers at the same time as I do the switch to SLF4J/Logback (I have it mostly done on my machine). The idea is to move from: public MyComponent implements LogEnabled, MyComponentRole { ... } to: public MyComponent implements MyComponentRole { @Inject private Logger logger; ... } Rationale: * More consistent with how we inject dependencies * Makes it easier to move to another DI framework later on (CDI, Guice, etc) since the way to implement this with them is to use the JSR299 @Producer annotation on a class that produces Loggers. * Allows to keep the current logging behavior unchanged for backward compatibility (we juste deprecate it). WDYT? Thanks -Vincent
On 05/10/2011 05:03 PM, Vincent Massol wrote:
Hi,
I'd like to commit @Inject injection of Loggers at the same time as I do the switch to SLF4J/Logback (I have it mostly done on my machine).
The idea is to move from:
public MyComponent implements LogEnabled, MyComponentRole { ... }
to:
public MyComponent implements MyComponentRole { @Inject private Logger logger; ... }
Rationale: * More consistent with how we inject dependencies * Makes it easier to move to another DI framework later on (CDI, Guice, etc) since the way to implement this with them is to use the JSR299 @Producer annotation on a class that produces Loggers. * Allows to keep the current logging behavior unchanged for backward compatibility (we juste deprecate it).
WDYT?
+1 if it works. I didn't like LogEnabled from the start. -- Sergiu Dumitriu http://purl.org/net/sergiu/
+100 If you have any trouble just ask, you can detect the name calling class by extending SecurityManager. Caleb On 05/10/2011 11:42 AM, Sergiu Dumitriu wrote:
On 05/10/2011 05:03 PM, Vincent Massol wrote:
Hi,
I'd like to commit @Inject injection of Loggers at the same time as I do the switch to SLF4J/Logback (I have it mostly done on my machine).
The idea is to move from:
public MyComponent implements LogEnabled, MyComponentRole { ... }
to:
public MyComponent implements MyComponentRole { @Inject private Logger logger; ... }
Rationale: * More consistent with how we inject dependencies * Makes it easier to move to another DI framework later on (CDI, Guice, etc) since the way to implement this with them is to use the JSR299 @Producer annotation on a class that produces Loggers. * Allows to keep the current logging behavior unchanged for backward compatibility (we juste deprecate it).
WDYT?
+1 if it works. I didn't like LogEnabled from the start.
On May 10, 2011, at 5:03 PM, Vincent Massol wrote:
Hi,
I'd like to commit @Inject injection of Loggers at the same time as I do the switch to SLF4J/Logback (I have it mostly done on my machine).
The idea is to move from:
public MyComponent implements LogEnabled, MyComponentRole { ... }
to:
public MyComponent implements MyComponentRole { @Inject private Logger logger; ... }
Rationale: * More consistent with how we inject dependencies * Makes it easier to move to another DI framework later on (CDI, Guice, etc) since the way to implement this with them is to use the JSR299 @Producer annotation on a class that produces Loggers.
For the record, here's how it's done with our DI fwk: * Guice: http://glauche.de/2009/08/24/logging-with-slf4j-and-guice/ * Weld: http://docs.jboss.org/weld/reference/1.0.0/en-US/html/extensions.html * CDI in general: http://rbergerpa.blogspot.com/2011/02/dependency-injection-and-logging.html To summarize: * Guice: Based on TypeListeners * CDI: Based on @Produces Thanks -Vincent
* Allows to keep the current logging behavior unchanged for backward compatibility (we juste deprecate it).
WDYT?
Thanks -Vincent
+1 Thanks, Marius On 05/10/2011 06:03 PM, Vincent Massol wrote:
Hi,
I'd like to commit @Inject injection of Loggers at the same time as I do the switch to SLF4J/Logback (I have it mostly done on my machine).
The idea is to move from:
public MyComponent implements LogEnabled, MyComponentRole { ... }
to:
public MyComponent implements MyComponentRole { @Inject private Logger logger; ... }
Rationale: * More consistent with how we inject dependencies * Makes it easier to move to another DI framework later on (CDI, Guice, etc) since the way to implement this with them is to use the JSR299 @Producer annotation on a class that produces Loggers. * Allows to keep the current logging behavior unchanged for backward compatibility (we juste deprecate it).
WDYT?
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
+1 Thanks, Denis On Tue, May 10, 2011 at 19:38, Marius Dumitru Florea < [email protected]> wrote:
+1
Thanks, Marius
On 05/10/2011 06:03 PM, Vincent Massol wrote:
Hi,
I'd like to commit @Inject injection of Loggers at the same time as I do the switch to SLF4J/Logback (I have it mostly done on my machine).
The idea is to move from:
public MyComponent implements LogEnabled, MyComponentRole { ... }
to:
public MyComponent implements MyComponentRole { @Inject private Logger logger; ... }
Rationale: * More consistent with how we inject dependencies * Makes it easier to move to another DI framework later on (CDI, Guice, etc) since the way to implement this with them is to use the JSR299 @Producer annotation on a class that produces Loggers. * Allows to keep the current logging behavior unchanged for backward compatibility (we juste deprecate it).
WDYT?
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Denis Gervalle SOFTEC sa - CEO eGuilde sarl - CTO
+1 On Tue, May 10, 2011 at 17:03, Vincent Massol <[email protected]> wrote:
Hi,
I'd like to commit @Inject injection of Loggers at the same time as I do the switch to SLF4J/Logback (I have it mostly done on my machine).
The idea is to move from:
public MyComponent implements LogEnabled, MyComponentRole { ... }
to:
public MyComponent implements MyComponentRole { @Inject private Logger logger; ... }
Rationale: * More consistent with how we inject dependencies * Makes it easier to move to another DI framework later on (CDI, Guice, etc) since the way to implement this with them is to use the JSR299 @Producer annotation on a class that produces Loggers. * Allows to keep the current logging behavior unchanged for backward compatibility (we juste deprecate it).
WDYT?
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
participants (6)
-
Caleb James DeLisle -
Denis Gervalle -
Marius Dumitru Florea -
Sergiu Dumitriu -
Thomas Mortagne -
Vincent Massol