I've just started using Seam Solder and their logging module looks interesting http://docs.jboss.org/seam/3/solder/latest/reference/en-US/html/logging.html
See code at bottom of post for my test example.
A few issues that has risen from trying to use it:
- How to inject a normal log4j Logger object? The documentation just has
@Inject Logger log
, which seems simple enough, but it throws an exception at deploy time:org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Logger] with qualifiers [@Default] at i开发者_运维知识库njection point [[field] @Inject com.company.application.controller.SessionController.log]
- Besides from injecting a normal logger, Typed loggers also seemed pretty nifty. The documentation claims you should use the
@LogMessage
annotation, which does not exist. My guess is that it was renamed to@Log
since this seems to work. To enable use of all normal methods (info, warning, error, etc), letting the log interface extendBasicLogger
seemed easy enough, but this interface doesn't seem to be annotated correctly, so nothing is actually logged when these methods are called (the invocation handler checks for@Message
annotation and finds none). Am I doing something wrong or is the framework just really unfinished? Should I perhaps stick with normal log4j when developing a system going into prod in a few months?
Interface
@MessageLogger
public interface SessionLogger extends BasicLogger{
@Message("User %s logged in. Redirecting to %s.")
@Log(level= Level.INFO)
void login(String username, String to);
@Message("User %s logged out.")
void logout(String username);
}
Usage
@Inject SessionLogger log
...
log.login("username", "url");
Be sure that the Annotations you are doing are the Solder Annotations, and not the generic ones.
Your problem looks like a dependency problen on classes included in Seam Solder. Are you sure the dependency is satisfied ?
<dependency>
<groupId>org.jboss.seam.solder</groupId>
<artifactId>seam-solder</artifactId>
<version>${version.seam}</version>
</dependency>
精彩评论