[weld-dev] How to obtain logger in an interceptor?

Marcin Zajączkowski mszpak at wp.pl
Sat May 15 17:33:55 EDT 2010


Hi,


I am working on a Perf4j [1] integration with CDI/Weld (sister project
to Seam-Perf4j [2] which offers integration with Seam 2.2.x). Perf4j
heavy uses logger for its performance statistics.

I would like to ask is there an unified way in CDI to obtain a logger in
an interceptor?


In Seam 2.2.x I could get logger with:
org.jboss.seam.log.Logging.getLog(loggerName)

With Weld I don't want to get Weld logger directly - I would like to be
compatible with other CDI implementations as well.

I have seen Weld's extension for logging, but it's rather for injection
logger into "normal" beans, not to obtain it explicitly in an
interceptor (it's a producer which calls LoggerFactory.getLogger() from
slf4j which I can do directly).


Is it possible to get logger proper for CDI implementation in context
which my code is running? Or the best solution would be to use slf4j
logger with hope it is already using there?


[1] - http://perf4j.codehaus.org/
[2] - http://seam-perf4j.sourceforge.net/


Thanks for your comments
Marcin


More information about the weld-dev mailing list