zoukankan      html  css  js  c++  java
  • ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the clas

    搭建SSM框架运行,打印输出

    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包

    <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>2.11.1</version>
    </dependency>
    

    添加过maven文件后再次启动

    又报错误

    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

    这时需要在classpath中添加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>

    再次运行

  • 相关阅读:
    jquery动画,获取,添加
    javac3p0连接池
    jquery尺寸
    jquery遍历
    jquery删除,停止,获取设置css,设置内容和属性,过滤
    javajdbc(数据库的添加,删除,修改,更新)
    博客开通
    很久每有来空来了,一些最近的想法
    竖线的显示
    一个小问题,c++
  • 原文地址:https://www.cnblogs.com/cosmosray/p/13268803.html
Copyright © 2011-2022 走看看