对spring和hibernate的bean单独设置为debug.
例如log包下checkServiceImp设置为debug级别:
在代码中加入:
Logger log=Logger.getLogger(this.getClass().getName());
if(log.isInfoEnabled()){log.info("This is debug.");} 在log4j.properties中加入:
log4j.logger.log.checkServiceImp=DEBUG, stdout不知道能否帮到LZ

解决方案 »

  1.   

    谢谢楼上的,不过这样的话,每个类都要设一次,我想,应该有一种办法是一次过设置,就应用所有spring或hibernate的类的. 
      

  2.   

    我拿 Appfuse 的 log4j.properties 来献给搂主了。
    这个是设置 hibernate 的# All hibernate log output of "info" level or higher goes to stdout.
    # For more verbose logging, change the "info" to "debug" on the last line.
    log4j.logger.org.hibernate.ps.PreparedStatementCache=WARN
    log4j.logger.org.hibernate=WARN# Changing the log level to DEBUG will result in Hibernate generated
    # SQL to be logged.
    log4j.logger.org.hibernate.SQL=ERROR# Changing the log level to DEBUG will result in the PreparedStatement
    # bound variable values to be logged.
    log4j.logger.org.hibernate.type=ERROR
    这个是 Spring 的:
    log4j.logger.org.springframework=WARN