zoukankan      html  css  js  c++  java
  • 整合SSH遇到的问题

    今天在整合SSH时遇到一个问题,本来同样的项目昨天启动时还好好的,今天启动就出问题了:
    启动时弹出一个提示框:"Starting Tomcat v9.0 Server at localhost' has encountered a problem.。。。提示Tomcat启动超时!!!
    而且还会报错:
    ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
    本来昨天也报这个错误,但程序可以运行啊,今天就不可以了。
    然后我去百度:说是要导入一个log4j-core这个jar包。
    导入jar包后,又报错:
    ERROR StatusLogger No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2
    找不到log4j2的配置文件
    百度后,原来只要在classpath下的目录添加一个log4j2.xml。就可以了
    log4j2.xml中写:

    <?xml version="1.0" encoding="UTF-8"?>
    
    <Configuration status="warn">  
                <Appenders>  
                            <Console name="Console" target="SYSTEM_OUT">  
                                        <PatternLayout pattern="[%-5p] %d %c - %m%n" />  
                            </Console>  
                            <File name="File" fileName="dist/my.log">  
                                        <PatternLayout pattern="%m%n" />  
                            </File>  
                </Appenders>  
      
                <Loggers>  
                            <Logger name="mh.sample2.Log4jTest2" level="INFO">  
                                        <AppenderRef ref="File" />  
                            </Logger>  
                            <Root level="INFO">  
                                        <AppenderRef ref="Console" />  
                            </Root>  
                </Loggers>  
    </Configuration>
    

    这里为什么这样配置就不说了,可以去查阅log4j2的文档。
    这次启动Tomcat,控制台没有错误提示了,项目也可以运行了。
    借鉴的网页:
    ERROR StatusLogger Log4j2 could not find a logging implementation.
    log4j2的配置和使用中遇到的问题

  • 相关阅读:
    SQL 初级教程学习(二)
    QuartzJobs 如何发布服务
    Net 发布网站中遇到的几点问题
    PWBI--Excel 数据源
    微信小程序资源
    加密和解密之非对称加密
    Js 使用小技巧总结(1)
    路径的读取
    json和Jsonp 使用总结(3)
    json和Jsonp 使用总结(2)
  • 原文地址:https://www.cnblogs.com/liu2687479342/p/14524750.html
Copyright © 2011-2022 走看看