Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Log4j2中缺少类名-spring boot 1.3.7_Java_Logging_Configuration_Log4j_Log4j2 - Fatal编程技术网

Java Log4j2中缺少类名-spring boot 1.3.7

Java Log4j2中缺少类名-spring boot 1.3.7,java,logging,configuration,log4j,log4j2,Java,Logging,Configuration,Log4j,Log4j2,类名未打印日志。下面是log4j2.xml和pom.xml。请帮忙。我尝试了以下几种选择 使用spring boot starter日志记录-不工作 不使用日志4J2记录spring启动程序-不工作 请检查控制台。前四行包含类名,但之后不提交 Log4j2.xml <?xml version="1.0" encoding="UTF-8"?> <Configuration status="WARN" monitorInterval="30"> <Proper

类名未打印日志。下面是log4j2.xml和pom.xml。请帮忙。我尝试了以下几种选择

  • 使用spring boot starter日志记录-不工作
  • 不使用日志4J2记录spring启动程序-不工作
  • 请检查控制台。前四行包含类名,但之后不提交

    Log4j2.xml

     <?xml version="1.0" encoding="UTF-8"?>
    <Configuration status="WARN" monitorInterval="30">
        <Properties>
            <Property name="logpattern">%d{DATE} [${sys:PID}] [%t] %-5p %c-[%L] %X - %m%n</Property>
        </Properties>
        <Appenders>
            <Console name="Console" target="SYSTEM_OUT" follow="true">
                <PatternLayout pattern="${logpattern}"/>
            </Console>
        </Appenders>
        <Loggers>
            <Root level="info">
                <AppenderRef ref="Console"/>
            </Root>
        </Loggers>
    </Configuration>
    
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>com.sample</groupId>
        <artifactId>Sample</artifactId>
        <version>0.1.0</version>
        <packaging>jar</packaging>
    
        <name>Sample</name>
        <description>Sample Description</description>
    
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.3.7.RELEASE</version>
            <relativePath /> <!-- lookup parent from repository -->
        </parent>
    
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
            <java.version>1.8</java.version>
        </properties>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.restdocs</groupId>
                <artifactId>spring-restdocs-mockmvc</artifactId>
                <scope>test</scope>
            </dependency>
    
            <dependency>
                 <groupId>com.jayway.jsonpath</groupId>
                <artifactId>json-path</artifactId>
                <scope>test</scope>
             </dependency>
    
            <dependency>
                <groupId>com.oracle</groupId>
                <artifactId>ojdbc</artifactId>
                <version>6</version>
            </dependency>
    
            <dependency>
                <groupId>com.valuemomentum</groupId>
                <artifactId>ratingService3X</artifactId>
                <version>1</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-collections4 -->
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-collections4</artifactId>
                <version>4.1</version>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-jpa</artifactId>
                <exclusions>
                    <exclusion>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.apache.tomcat</groupId>
                        <artifactId>tomcat-jdbc</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>3.4</version>
            </dependency>
    
            <dependency>
                <groupId>commons-beanutils</groupId>
                <artifactId>commons-beanutils</artifactId>
            </dependency>
    
            <dependency>
                <groupId>commons-beanutils</groupId>
                <artifactId>commons-beanutils-core</artifactId>
                <version>1.8.0</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/org.apache.xmlbeans/xmlbeans -->
            <dependency>
                <groupId>org.apache.xmlbeans</groupId>
                <artifactId>xmlbeans</artifactId>
                <version>2.6.0</version>
            </dependency>
    
            <dependency>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-core-asl</artifactId>
                <version>1.9.13</version>
            </dependency>
    
            <dependency>
                <groupId>com.fasterxml.jackson.jaxrs</groupId>
                <artifactId>jackson-jaxrs-json-provider</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-mapper-asl</artifactId>
                <version>1.9.13</version>
            </dependency>
    
            <dependency>
                <groupId>com.fasterxml.jackson.dataformat</groupId>
                <artifactId>jackson-dataformat-xml</artifactId>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/org.codehaus.woodstox/woodstox-core-asl -->
            <dependency>
                <groupId>org.codehaus.woodstox</groupId>
                <artifactId>woodstox-core-asl</artifactId>
                <version>4.4.1</version>
            </dependency>
    
            <!-- Calling ifoundry - dependency jars -->
    
            <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2-kernel -->
            <dependency>
                <groupId>org.apache.axis2</groupId>
                <artifactId>axis2-kernel</artifactId>
                <version>1.7.3</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2-adb -->
            <dependency>
                <groupId>org.apache.axis2</groupId>
                <artifactId>axis2-adb</artifactId>
                <version>1.7.3</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2-transport-http -->
            <dependency>
                <groupId>org.apache.axis2</groupId>
                <artifactId>axis2-transport-http</artifactId>
                <version>1.7.3</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2-transport-local -->
            <dependency>
                <groupId>org.apache.axis2</groupId>
                <artifactId>axis2-transport-local</artifactId>
                <version>1.7.3</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2-xmlbeans -->
            <dependency>
                <groupId>org.apache.axis2</groupId>
                <artifactId>axis2-xmlbeans</artifactId>
                <version>1.7.3</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2-jaxws -->
            <dependency>
                <groupId>org.apache.axis2</groupId>
                <artifactId>axis2-jaxws</artifactId>
                <version>1.7.3</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/javax.el/javax.el-api -->
            <!-- <dependency> <groupId>javax.el</groupId> <artifactId>javax.el-api</artifactId> 
                <version>3.0.0</version> <scope>provided</scope> </dependency> -->
    
            <!-- https://mvnrepository.com/artifact/org.glassfish.web/el-impl -->
            <!-- <dependency> <groupId>org.glassfish.web</groupId> <artifactId>el-impl</artifactId> 
                <version>2.2</version> <scope>provided</scope> </dependency> -->
    
            <!-- https://mvnrepository.com/artifact/org.glassfish.web/javax.el -->
            <dependency>
                <groupId>org.glassfish.web</groupId>
                <artifactId>javax.el</artifactId>
                <version>2.2.6</version>
                <scope>provided</scope>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>2.5.0</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>2.5.0</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/org.apache.xmlgraphics/fop -->
            <dependency>
                <groupId>org.apache.xmlgraphics</groupId>
                <artifactId>fop</artifactId>
                <version>2.1</version>
            </dependency>
    
            <dependency>
                <groupId>com.zaxxer</groupId>
                <artifactId>HikariCP</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-jms</artifactId>
            </dependency>
            <dependency>
                <groupId>org.apache.activemq</groupId>
                <artifactId>activemq-broker</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-messaging</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</artifactId>
                <exclusions>
                    <exclusion>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-logging</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-log4j2</artifactId>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/org.graylog2.log4j2/log4j2-gelf -->
            <dependency>
                <groupId>org.graylog2.log4j2</groupId>
                <artifactId>log4j2-gelf</artifactId>
                <version>1.3.0</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/joda-time/joda-time -->
            <dependency>
                <groupId>joda-time</groupId>
                <artifactId>joda-time</artifactId>
                <version>2.9.4</version>
            </dependency>
    
            <dependency>
                <groupId>de.codecentric</groupId>
                <artifactId>spring-boot-admin-starter-client</artifactId>
                <version>1.3.6</version>
            </dependency>
    
    
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>
    
        <repositories>
            <repository>
                <id>internal</id>
                <name>Archiva Managed Internal Repository</name>
                <url>http://10.50.255.230:8888/repository/internal/</url>
            </repository>
        </repositories>
    
    
    </project>
    

    在布局模式中,将小写的
    %c
    (记录器名称)替换为大写的
    %c
    (调用记录器的类)

    那么到底缺少什么呢?类名。请检查控制台这里的前四个日志,类名可用,但之后不可用
    20 Sep 2016 18:58:14,864 [9684] [main] INFO  org.hibernate.cfg.Environment-[346] {} - HHH000021: Bytecode provider name : javassist
    20 Sep 2016 18:58:15,136 [9684] [main] INFO  org.hibernate.annotations.common.Version-[66] {} - HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
    20 Sep 2016 18:58:15,315 [9684] [main] INFO  org.hibernate.dialect.Dialect-[145] {} - HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
    20 Sep 2016 18:58:15,569 [9684] [main] INFO  org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory-[47] {} - HHH000397: Using ASTQueryTranslatorFactory
    20 Sep 2016 18:58:16,195 [9684] [main] INFO  -[45] {} - HibernateJpaSessionFactoryBean called
    20 Sep 2016 18:58:19,573 [9684] [main] INFO  -[99] {} - requestString::: {
      "auth" : {