log4j日志问题

Scaarf 2018-03-30 12:39:45
为啥我加了log4j的jar包和log4j.properties控制台还是没打印日志,还是我的方法不对。。。。。。
...全文
482 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_45328645 2020-04-19
  • 打赏
  • 举报
回复
Illegal reflective access by org.apache.ibatis.reflection.Reflector 请问这个警告得到解决了吗? 答案:以及解决,版本换成MyBatis的3.5.3就可以了。 具体参见:https://github.com/mybatis/mybatis-3/issues/1156
Scaarf 2018-04-01
  • 打赏
  • 举报
回复
引用 3 楼 rabbitbug 的回复:
加载的时候没有任何错误?
像这样

log4j:ERROR Could not find value for key log4j.appender.console
log4j:ERROR Could not instantiate appender named "console".
log4j:ERROR Could not find value for key log4j.appender.info
log4j:ERROR Could not instantiate appender named "info".
06:53:44,371 [ main ] [ DEBUG ]:135 - Logging initialized using 'class org.apache.ibatis.logging.log4j.Log4jImpl' adapter.
  WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.ibatis.reflection.Reflector (file:/D:/eclipse-workspace/MybatisTest/lib/mybatis-3.4.6.jar) to method java.lang.Class.checkPackageAccess(java.lang.SecurityManager,java.lang.ClassLoader,boolean)
WARNING: Please consider reporting this to the maintainers of org.apache.ibatis.reflection.Reflector
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
06:53:44,478 [ main ] [ DEBUG ]:335 - PooledDataSource forcefully closed/removed all connections.
  06:53:44,478 [ main ] [ DEBUG ]:335 - PooledDataSource forcefully closed/removed all connections.
  06:53:44,478 [ main ] [ DEBUG ]:335 - PooledDataSource forcefully closed/removed all connections.
  06:53:44,479 [ main ] [ DEBUG ]:335 - PooledDataSource forcefully closed/removed all connections.
  06:53:44,563 [ main ] [ DEBUG ]:137 - Opening JDBC Connection
  Sun Apr 01 06:53:44 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
06:53:44,856 [ main ] [ DEBUG ]:406 - Created connection 1967355409.
  06:53:44,856 [ main ] [ DEBUG ]:101 - Setting autocommit to false on JDBC Connection [com.mysql.jdbc.JDBC4Connection@75437611]
  06:53:44,858 [ main ] [ DEBUG ]:159 - ==>  Preparing: select * from person 
  06:53:44,922 [ main ] [ DEBUG ]:159 - ==> Parameters: 
  06:53:44,968 [ main ] [ DEBUG ]:159 - <==      Total: 11
  11    王五1号11    24    男
12    王五2号22    25    男
13    王五3号33    23    男
14    王五4号44    22    男
15    张三1号    26    男
16    张三2号    24    男
17    张三3号    26    男
18    张三4号    24    男
19    张三5号    26    男
20    张三6号    24    男
21    张三7号    24    男
query completed...
06:53:44,992 [ main ] [ DEBUG ]:159 - ==>  Preparing: delete from person where id in ( ? , ? , ? ) 
  06:53:44,993 [ main ] [ DEBUG ]:159 - ==> Parameters: 8(Integer), 9(Integer), 10(Integer)
  06:53:44,995 [ main ] [ DEBUG ]:159 - <==    Updates: 0
  06:53:44,996 [ main ] [ DEBUG ]:70 - Committing JDBC Connection [com.mysql.jdbc.JDBC4Connection@75437611]
  deleteBatch compleleted...
Scaarf 2018-04-01
  • 打赏
  • 举报
回复
引用 3 楼 rabbitbug 的回复:
加载的时候没有任何错误?
没有错误,在log4j.properties中的log4j.rootLogger=info, stdout, log, errorlog 后加上了debug和console后现在倒是能在控制台打印执行的SQL,但感觉控制台打印的日志还是很少
rabbitbug 2018-03-30
  • 打赏
  • 举报
回复
加载的时候没有任何错误?
IT_XiaoYong 2018-03-30
  • 打赏
  • 举报
回复
debug模式,添加 log4j-web jar包

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧