]
George Gastaldi updated FORGE-2318:
-----------------------------------
Parent: (was: FORGE-1926)
Issue Type: Feature Request (was: Sub-task)
Being able to setup a logger
----------------------------
Key: FORGE-2318
URL:
https://issues.jboss.org/browse/FORGE-2318
Project: Forge
Issue Type: Feature Request
Components: Java EE
Reporter: Antonio Goncalves
Fix For: 2.x Future
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}