IDEA中关于resources下面的log4j.properties文件加载不了的问题(亲测) |
您所在的位置:网站首页 › idea找不到mybatis依赖 › IDEA中关于resources下面的log4j.properties文件加载不了的问题(亲测) |
1.本人的maven项目(pom.xml中加入以下依赖,log4j的依赖) org.bgee.log4jdbc-log4j2 log4jdbc-log4j2-jdbc4.1 1.16 org.slf4j slf4j-api 1.7.13 org.slf4j slf4j-log4j12 1.7.5 log4j log4j 1.2.162.项目log4j.properties的目录结构 3.结果测试代码打印不了加载不了log4j.properties文件打印结果如下: log4j:WARN No appenders could be found for logger (org.apache.ibatis.logging.LogFactory). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.4.原因具体看图设置: 如果有人不知道如何设置resources属性,打开File - Project Structure 左侧选中Project Settings - Modules 右侧选中 你的项目名成,右侧选择第一个Sources选项卡,然后选择需要resources类型的文件夹,选中Resources即可。 5.后来项目log4j.properties的目录结构变成如下面: 6.测试结果正常结果: DEBUG [main] - Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter. DEBUG [main] - PooledDataSource forcefully closed/removed all connections. DEBUG [main] - PooledDataSource forcefully closed/removed all connections. DEBUG [main] - PooledDataSource forcefully closed/removed all connections. DEBUG [main] - PooledDataSource forcefully closed/removed all connections. DEBUG [main] - Opening JDBC Connection DEBUG [main] - Created connection 282828951. DEBUG [main] - Setting autocommit to false on JDBC Connection [com.mysql.jdbc.JDBC4Connection@10dba097] DEBUG [main] - ==> Preparing: SELECT * FROM t_user WHERE tid = ?; DEBUG [main] - ==> Parameters: 1001(Integer) DEBUG [main] - |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |