public BeanCollection selectAll() throws SQLException{
StringBuffer sql = new StringBuffer(SQLBUF_LEN);sql.append("SELECT * FROM " + tableName + " order by roldId");
//System.out.println(sql.toString());log.debug(sql);
}
}
3.3
使用Logger对象的debug,info,fatal...方法log.debug("it is the debug info");
附件1:log4j的一个bug
当这样使用时,DailyRollingFileAppender不能正确使用:
public Class RoleDAO(){
static Logger log = Logger.getLogger("DAO");
//在每一次new RoleDAO对象的时候都执行一次configure()操作
public RoleDAO(TransactionManager transMgr) throws SQLException{...PropertyConfigurator.configure("log4j.properties");}
public void select(){...//使用log4j进行log记录log.debug("...");
}
}

