]
George Gastaldi moved FORGE-2318 to FORGEPLUGINS-211:
-----------------------------------------------------
Project: Forge Plugins/Addons (was: Forge)
Key: FORGEPLUGINS-211 (was: FORGE-2318)
Component/s: (was: Java EE)
Affects Version/s: (was: 2.16.0.Final)
Fix Version/s: (was: 2.x Future)
Being able to setup a logger
----------------------------
Key: FORGEPLUGINS-211
URL:
https://issues.jboss.org/browse/FORGEPLUGINS-211
Project: Forge Plugins/Addons
Issue Type: Feature Request
Reporter: Antonio Goncalves
It would be good to have a few commands to setup a logger and inject it into bean. And
because logs are a pain (too many frameworks) it would help to have a {{logger-setup}}
command. It will create the needed dependency (in the {{pom.xml}}) and add some basic
configuration (eg. {{logback.xml}}) and why not, create a producer method so it can be
injected.
A basic logger would use JUL :
{code}
logger-setup
{code}
Or we could choose a provider and a version
{code}
logger-setup --provider LOG4J --version 4.1
{code}
The different logging frameworks are :
* JUL (out of the box, no need to have a dependency)
* LOG4J2 :
http://logging.apache.org/log4j/2.x/
* LOG4J1 :
http://logging.apache.org/log4j/2.x/manual/migration.html
* SLF4J :
http://www.slf4j.org/
* COMMONS_LOGGING :
http://commons.apache.org/proper/commons-logging/
* LOGBACK :
http://logback.qos.ch/
Setting up a logger would add the right dependency but also generate a producer that
would look like that, and therefore could be injected :
{code}
public class LoggingProducer {
@Produces
public Logger produceLogger(InjectionPoint injectionPoint) {
return
Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName());
}
}
{code}