Loggers can be initialized statically. Of course you can write a simple producer method for then based on InjectionPoint but I've never bothered.
Check out https://docs.jboss.org/author/display/AS71/Logging+Configuration for configuration.
Thanks for the response. Are there any code samples of calling this logger programmatically? I've been able to find lots of info on how to tweak the built-in loggers, but none on how to call it in Java.
Also, is this logging supported on EAP and likely to be around in future EAP releases?
My rationale is that I hope to use the JBoss logger so our customers can contact RedHat support if they wanted to tune the logs and also have a reasonable chance everything will work in EAP7, 8, etc. I figured this would be more suitable than having them open up my war and look for a log4j.xml file like we used to do.
private static final Logger log = Logger.getLogger(Login.class);
log.infof("Hello %s", user.getName());
That's with JBoss logging. I've lost count on how many "lightweight wrappers around logging abstraction abstractions" there are out there. But on EAP, I'd suggest going with JBoss logging (surprise, surprise).
I will throw my two bob's worth in too.
Like Nicklas, I like the JBoss logging API. You can also use it in conjunction with JBoss Solder Logging which adds the ability to inject loggers with very little code.
Whatever API that you choose, the key point is to ensure that the composition of the complete logging message is deferred until it's really needed. ie. You don't want to be performing string concatenation and/or invoking possibly expensive Object.toString() calls unless the log message is actually rendered.