现象:
在运行一个Hibernate相关的DEMO时没有成功,并且出现警告:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
原因:
检查在该工程src目录下面名为log4j.properties的文件是否配置,或该文件路径是否正确。【互联网纳】
方案:
1、路径:log4j.properties文件应该是在src目录下;
2、配置:如果忘记配置该文件,在src下面新建file名为log4j.properties,内容如下:
### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### root logger option ###
log4j.rootLogger=warn, stdout
### Hibernate logging options ###
log4j.logger.net.sf.hibernate=info
### log JDBC bind parameters ###
log4j.logger.net.sf.hibernate.type=info
### log PreparedStatement cache activity ###
log4j.logger.net.sf.hibernate.ps.PreparedStatementCache=info
分享到:
相关推荐
NULL 博文链接:https://wait7758521.iteye.com/blog/1933964
首先,错误信息"log4j:WARN No appenders could be found for logger"表明Log4j找不到任何日志输出的目标,也就是没有设置日志appender。日志appender是Log4j用来定义日志输出目的地的组件,比如控制台、文件、邮件...
1.log4j:WARNNoappenderscouldbefoundforlogger(org.apache.hadoop.util.Shell). 2.log4j:WARNPleaseinitializethelog4jsystemproperly. 3.log4j:WARNSeehttp://logging.apache.org/log4j/1.2/faq....
log4j:WARN No appenders could be found for logger org apache commons beanutils ConvertUtils 出现这个错误 在web inf classes路径下加了log4j properties文件还是这个错误log4j:WARN Please initialize the ...
log4j:WARN No appenders could be found for logger (com.mchange.v2.log.MLog). log4j:WARN Please initialize the log4j system properly.
1. 引入依赖:在项目的pom.xml或build.gradle文件中,添加log4j的相关依赖,包括log4j核心库和log4j的异步日志库(如log4j2-async-appender)。 2. 配置日志属性:在log4j.properties或log4j.xml配置文件中,声明...
报错WARN No appenders could be found for logger 或 WARN Please initialize the log4j system properly时需要引入的包。用法可以参考https://blog.csdn.net/u010912188/article/details/79761894
例如,在Spring框架的应用中,如果没有正确配置log4j,就可能出现“log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext)”这类警告信息。...
模式爬虫配置单元 不幸的是,到目前为止, 似乎是不切实际的。 从hive-1.1.0(CDH5.4)开始,...log4j:WARN No appenders could be found for logger (org.apache.hive.jdbc.Utils). log4j:WARN Please initialize the
clj-hbase 这是一个用于 hbase 0.98.3 的小型且仍然不完整的 clojure 包装器 用法 假设我们有一个带有列族“byte-data...log4j:WARN No appenders could be found for logger ( org.apache.hadoop.metrics2.lib.Mutabl
log4j:WARN No appenders could be found for logger (org.apache.hadoop.metrics2.lib.MutableMetricsFactory). log4j:WARN Please initialize the log4j system properly. log4j:WARN See ...
玩具应用程序可证明参加动物园管理员领导者选举食谱的多个客户可以随时认为自己是领导者。 建造 建立: $ ../gradlew jar 这将在build / libs中创建...log4j:WARN No appenders could be found for logger (org
log4j:WARN No appenders could be found for logger (org.apache.mons.digester.Digester). log4j:WARN Please initialize the log4j system properly. 2009-11-06 21:39:17 org.apache.catalina.core....
当出现"log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader)"这样的警告时,这意味着log4j没有找到任何日志输出目标。这通常是因为日志配置文件未被正确加载。解决...
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. 2009-8-29 14:02:12 org.apache.catalina.core....