-
1. Re: log.info
chawax Oct 9, 2008 9:56 AM (in response to bartdp)How do you inject log in your component ?
What did you write in log config file ?
It would be nice to post the entire class, not only the line where you have the NPE ;) -
2. Re: log.info
asiandub Oct 9, 2008 9:57 AM (in response to bartdp)why? because the variable
log
is null...a rough guess: the logger has not been injected by Seam.
- do you use the logger in the constructor? this is called before @In is executedyou call always fall back to
conventional
loggingprivate static final Logger LOGGER = Logger.getLogger(MyClass.class);
btw:
class and method-name are in the standard logging output of the appender, no need to log that...hope that helps,
pls post more code otherwise,cheers,
Jan -
3. Re: log.info
bartdp Oct 9, 2008 10:42 AM (in response to bartdp)Ok, more information sounds logical.
I used the annotation @Logger in my class, so the code is:
@Entity @Table(name = "users") public class User implements Serializable { @Logger private Log log; private static final long serialVersionUID = 1L; private int id; private String username; @Column(name = "userid") public int getId() { log.info("...User...getId..."); return id; } public void setId(int id) { log.info("...User...setId..."); this.id = id; } @Column(name = "username") public String getUsername() { log.info("...User...getUsername..."); return username; } public void setUsername(String username) { log.info("...User...setUsername..."); this.username = username; }
And regarding the book, Seam in action, injecting a @Logger instance, seam can automatically create an instance of a logger that is configured exclusively for the component into which it is injected.
-
4. Re: log.info
asiandub Oct 9, 2008 11:15 AM (in response to bartdp)code looks good :-)
one possible explanation is that the seam interceptor is not registered at all.
- do you have ejb-jar.xml in the META-INF directory of your EAR-Project?
- do other @In-annotations of EJB-components work?
cheers,
jan