log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.大家说下这个问题怎么引起的,怎么解决,麻烦帮下忙
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.大家说下这个问题怎么引起的,怎么解决,麻烦帮下忙
解决方案 »
- HQL 中 可以使用 SELECT* 吗?
- hibernate的hbm2ddl能不能自动更新视图?
- 数据流的读取问题。。。
- Struts2中validate(),和 execute() 的问题
- [Microsoft][SQLServer 2000 Driver for JDBC]Connection reset by peer: socket write error
- 关于URI的一个问题
- 请问J2EE的应用服务器是不是就是指的web server?和传统的web server有什么区别呢
- 做邮件系统,javamail是否合适?是否有现成构架?有经验者请进
- [WEBLOGIC8.1]如何用命令重新启动一个WEB项目
- struts是否支持多个properties文件?该怎样配置?在线等待,问题解决立即加分!!!
- flot jquery动态数据问题
- 海量数据架构
加上这个文件放在classpath下
<prop key="hibernate.show_sql">false</prop>(hibernate.cfg.xml或者applicationContext.xml里有)
将false改成true就可以在后台打印出sql语句了
我看junit里面提示这一句是什么意思
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-configuration> <session-factory> <!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost/hibernate</property>
<property name="connection.username">root</property>
<!-- <property name="connection.password">1</property> --> --><!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property> <!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property> <!-- Enable Hibernate's automatic session context management -->
<!-- <property name="current_session_context_class">thread</property>--> <!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> <!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property> <!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">update</property>
<!-- <mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"/>
-->
<mapping class="hfanghao.hibernate.Group"/>
<mapping class="hfanghao.hibernate.User"/> </session-factory></hibernate-configuration>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-configuration> <session-factory> <!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost/hibernate</property>
<property name="connection.username">root</property>
<!-- <property name="connection.password">1</property> --> --><!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property> <!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property> <!-- Enable Hibernate's automatic session context management -->
<!-- <property name="current_session_context_class">thread</property>--> <!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> <!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property> <!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">update</property>
<!-- <mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"/>
-->
<mapping class="hfanghao.hibernate.Group"/>
<mapping class="hfanghao.hibernate.User"/> </session-factory></hibernate-configuration>
2、确保有相关的支持log记录的jar。
3、确保log4j.properties中配置正确。