[jboss-user] [Beginners Corner] - Re: The static method getLogger(class) from the class Logger
jaikiran
do-not-reply at jboss.com
Fri Nov 23 00:11:26 EST 2007
anonymous wrote : private static Logger logger;
|
|
| public MasterSessionBean() {
|
| logger = logger.getLogger("org.apache");
|
| log("SessionMaster()");
| }
Even if you ignored that warning and deployed this bean, i would expect a NullpointerException at logger.getLogger, since the logger object is never instantiated. The right way to do this (and also get rid of the warning) is:
| private static Logger logger = Logger.getLogger(MasterSessionBean.class.getName());
|
|
| public MasterSessionBean() {
|
| log("SessionMaster()");
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4107234#4107234
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4107234
More information about the jboss-user
mailing list