log4j:WARN No appenders could be found for logger

这个问题很多小伙伴都出现了,造成这种问题的原因很多,所以网上的解决方案也五花八门,这里我提供一个解决方法,供大家参考。

我是在看视频学习springboot,照着敲的时候出现的这个问题,我不知道为什么视频上没事,反正我是出现了。


log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.StandardServletEnvironment).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.9.RELEASE)

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (file:/D:/maven/myrepository-3.5.0/org/springframework/spring-core/4.3.13.RELEASE/spring-core-4.3.13.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1
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
2月 25, 2019 8:55:28 上午 org.apache.catalina.core.StandardService startInternal
信息: Starting service [Tomcat]
2月 25, 2019 8:55:28 上午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/8.5.23
2月 25, 2019 8:55:28 上午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring embedded WebApplicationContext
2月 25, 2019 8:55:28 上午 org.apache.catalina.core.StandardService stopInternal
信息: Stopping service [Tomcat]

Process finished with exit code 1

解决

首先 No appenders could be found for logger   翻译:没有为logger找到附件。

意思是:没有找到log4j.properties文件;

如果你整合了mybatis,并且使用的是xml的方式,那么这个方法因该可以解决你的问题

在pom.xml中增加

<build>
  <resources>
    <!-- mybaties:当使用xml方式时,需要配置  又称 资源拷贝插件-->
    <resource>
      <directory>src/main/java</directory>
      <includes>
        <include>**/*.xml</include>
      </includes>
    </resource>
      <resource>
          <directory>src/main/resources</directory>
          <includes>
              <include>**/*.*</include>
          </includes>
      </resource>
  </resources>
<build>

  

 

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值