1
我將log4j添加到我的項目中,以便我可以正確地修改它。但是當我將日誌級別設置爲INFO或更高級別時,它會一直顯示調試級別日誌。在這裏,我創建了記錄類的部分:Log4j級別不按預期方式工作
public abstract class DefaultDaoImpl<T> implements DefaultDao<T> {
private EntityManager em;
private Class<T> classeEntidade;
private static final Logger logger = Logger.getLogger(DefaultDaoImpl.class);
public DefaultDaoImpl(Class<T> classeEntidade) {
this.classeEntidade = classeEntidade;
logger.setLevel(Level.INFO);
BasicConfigurator.configure();
}
這裏生成的日誌的一部分:
2847 [main] DEBUG org.hibernate.engine.jdbc.internal.LogicalConnectionImpl - Releasing JDBC connection
2847 [main] DEBUG org.hibernate.engine.jdbc.internal.LogicalConnectionImpl - Releasing JDBC connection
2847 [main] DEBUG org.hibernate.engine.jdbc.internal.LogicalConnectionImpl - Released JDBC connection
2847 [main] DEBUG org.hibernate.engine.jdbc.internal.LogicalConnectionImpl - Released JDBC connection
2847 [main] DEBUG org.hibernate.engine.jdbc.internal.LogicalConnectionImpl - Released JDBC connection
2847 [main] DEBUG org.hibernate.engine.jdbc.internal.LogicalConnectionImpl - Released JDBC connection
注:調試日誌從休眠狀態來了。也許這是一個休眠配置?