[
https://issues.jboss.org/browse/FORGE-2318?page=com.atlassian.jira.plugin...
]
Antonio Goncalves commented on FORGE-2318:
------------------------------------------
agoncal The idea is when you setup a logger, you also generate the appropriate producer
method... but that means the project relies on CDI
16:35:05 gastaldi Interesting
16:35:36 gastaldi Maybe this could be a separate addon
16:35:53 agoncal gastaldi Yes, I think so
16:36:09 gastaldi We could start by creating it outside of core
16:36:09 agoncal And what about the producer method and the CDI dependency ?
16:36:24 gastaldi Roaster can generate that
16:36:51 gastaldi It should depend on javaee facet
16:36:55 agoncal yes, I know, I'm just wondering if it's a good idea to always
depend on CDI
16:36:57 gastaldi CDIFacet
16:37:04 agoncal (Spring projects for example)
16:37:21 gastaldi That depends on the facets installed in the project
16:37:23 agoncal I like CDI and would love to see it used everywhere... but it's not
the case yet
16:37:36 agoncal or maybe :
16:37:40 agoncal logger-setup
16:37:49 agoncal logger-new-producer
16:37:51 agoncal or
16:37:54 agoncal logger-new-factory
16:38:12 gastaldi Yeah thats a good idea too
16:38:14 agoncal One uses CDI, the other doesn't.... but is that really useful ?
16:38:37 agoncal logger-new-producer would install the CDIFacet, the other no
16:38:39 gastaldi New factory could do the same as new producer
16:38:52 agoncal ok
16:39:01 gastaldi Hm. I think that it wouldnt need to install the CDIFacet
16:39:27 gastaldi Just enable the commands if the facet is already installed should be
enough
16:40:28 agoncal Hum.... When we create a backing bean, the command faces-new-bean is
enabled without or without CDI... and then, it installs it
16:40:47 agoncal I think the behevior should stay the same
16:40:57 gastaldi Ah right
16:41:05 gastaldi Yeah makes sense
Being able to setup a logger
----------------------------
Key: FORGE-2318
URL:
https://issues.jboss.org/browse/FORGE-2318
Project: Forge
Issue Type: Sub-task
Components: Java EE
Affects Versions: 2.16.0.Final
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}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)