重新登录:TimeBasedRollingPolicy无法滚动

时间:2018-08-09 08:36:35

标签: spring-boot logback

我相信我已将日志配置为每天进行回滚,但昨晚没有进行回滚。它已经有一段时间没有工作了。根据文档,我发现我看不到任何错误的配置。日志文件包含预期的日志行和级别,但它不会滚动。

Doc's I have followed

Spring Boot版本:2.0.4.RELEASE

登录版本:1.2.3

Logback.xml:

<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="30 seconds">
<jmxConfigurator />
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
        <pattern>%d | %-5.5p | %-32.32c{0} | %-16.16t | %m%n</pattern>
    </encoder>
</appender>
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>log/${project.artifactId}.log</file>
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <fileNamePattern>log/${project.artifactId}.log.%d{yyyy-MM-dd}.gz</fileNamePattern>
        <maxHistory>14</maxHistory>
    </rollingPolicy>
    <encoder>
        <pattern>%d | %-5.5p | %-32.32c{0} | %-16.16t | %m%n</pattern>
    </encoder>
</appender>
<root level="INFO">
    <appender-ref ref="console"/>
    <appender-ref ref="file"/>
</root>
<logger name="no.something.cool" level="DEBUG"/>

从日志文件中截取

2018-08-07 23:13:42,679 | DEBUG | HandlerService                   | 
ngAgreementRoute | [AOS] No need to update UserToAirlineMap yet
2018-08-07 23:28:42,678 | DEBUG | HandlerService                   | 
ngAgreementRoute | [AOS] No need to update UserToAirlineMap yet
2018-08-07 23:43:42,679 | DEBUG | HandlerService                   | 
ngAgreementRoute | [AOS] No need to update UserToAirlineMap yet
2018-08-07 23:58:42,679 | DEBUG | HandlerService                   | 
ngAgreementRoute | [AOS] No need to update UserToAirlineMap yet
2018-08-08 00:13:42,679 | DEBUG | HandlerService                   | 
ngAgreementRoute | [AOS] No need to update UserToAirlineMap yet
2018-08-08 00:28:42,679 | DEBUG | HandlerService                   | 
ngAgreementRoute | [AOS] No need to update UserToAirlineMap yet

pom.xml:

<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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
    <groupId>no.stuff</groupId>
    <artifactId>javaapp-parent</artifactId>
    <version>1.1.13</version>
</parent>

<groupId>no.stuff.stuff</groupId>
<artifactId>MYAPP</artifactId>
<packaging>jar</packaging>
<version>1.0.0</version>
<name>Stuff :: Random Stuff</name>

<properties>
    <mainClass>no.stuff.Application</mainClass>
    <cxf-xjc-plugin.version>3.0.5</cxf-xjc-plugin.version>
    <cxf.version>3.1.7</cxf.version>
    <jaxb2-fluent-api.version>3.0</jaxb2-fluent-api.version>
    <fisservices.version>2.0.3</fisservices.version>

    <spring-boot>2.0.4.RELEASE</spring-boot>
    <spring.version>5.0.8.RELEASE</spring.version>

    <jolokia.version>1.3.5</jolokia.version>
    <lombok.version>1.16.6</lombok.version>
    <camel.version>2.16.2</camel.version>
    <jaxb.version>2.2.11</jaxb.version>
    <ibm.mq.version>6.0.2.5</ibm.mq.version>
    <geronimo-j2ee-connector.version>1.0</geronimo-j2ee-connector.version>
    <junit.version>4.10</junit.version>
    <mockito.version>1.9.5</mockito.version>
    <fest.assert.version>1.4</fest.assert.version>
    <jasypt.version>1.9.2</jasypt.version>
    <jasypt-spring-boot-starter.version>2.1.0</jasypt-spring-boot-starter.version>
    <joda-time.version>2.4</joda-time.version>
    <jackson-version>2.9.6</jackson-version>
    <logback.version>1.2.3</logback.version>
</properties>

<build>
    <plugins>
        <plugin> <!-- Compile Java -->
            <artifactId>maven-compiler-plugin</artifactId>
        </plugin>
        <plugin> <!-- Copy and filter all resources -->
            <artifactId>maven-resources-plugin</artifactId>
        </plugin>
        <plugin>
            <artifactId>maven-deploy-plugin</artifactId>
            <configuration>
                <skip>true</skip>
            </configuration>
        </plugin>
        <plugin> <!-- Copy all jar dependencies to /jar -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${project.build.directory}/jars</outputDirectory>
                        <overWriteReleases>false</overWriteReleases>
                        <overWriteSnapshots>false</overWriteSnapshots>
                        <overWriteIfNewer>true</overWriteIfNewer>
                        <includeScope>runtime</includeScope>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <jarName>${project.artifactId}</jarName>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <classpathPrefix>jars</classpathPrefix>
                        <mainClass>${mainClass}</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
        <plugin> <!-- Generate sources -->
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-xjc-plugin</artifactId>
            <version>${cxf-xjc-plugin.version}</version>
        </plugin>
        <plugin> <!-- Generate sources -->
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-codegen-plugin</artifactId>
            <version>${cxf.version}</version>
        </plugin>
    </plugins>
    <pluginManagement>
        <plugins>
            <plugin> <!-- Copy and filter all resources -->
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>prepare-dockerfile</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/docker-filtered</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/docker</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>prepare-compose</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/docker-compose-filtered</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/docker-compose</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>prepare-config</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/config</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/config</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>prepare-logback</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/resources</directory>
                                    <includes>
                                        <include>logback.xml</include>
                                    </includes>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin> <!-- Generate sources -->
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-xjc-plugin</artifactId>
                <configuration>
                    <extensions>
                        <extension>org.apache.cxf.xjcplugins:cxf-xjc-dv:${cxf-xjc-plugin.version}</extension>
                        <extension>org.jvnet.jaxb2_commons:jaxb2-fluent-api:${jaxb2-fluent-api.version}</extension>
                    </extensions>
                </configuration>
                <executions>
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>xsdtojava</goal>
                        </goals>
                        <configuration>
                            <sourceRoot>${basedir}/target/generated-sources</sourceRoot>
                            <xsdOptions>
                                <xsdOption>
                                    <xsd>src/main/resources/schema/data.xsd</xsd>
                                    <packagename>no.package.stuff</packagename>
                                    <extensionArgs>
                                        <extensionArg>-extension</extensionArg>
                                        <extensionArg>-Xfluent-api</extensionArg>
                                    </extensionArgs>
                                    <bindingFile>${basedir}/src/main/resources/schema/bindings.xml</bindingFile>
                                </xsdOption>
                            </xsdOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin> <!-- Generate sources -->
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                        <configuration>
                            <sourceRoot>${basedir}/target/generated-sources</sourceRoot>
                            <wsdlOptions>
                                <wsdlOption>
                                    <wsdl>${basedir}/src/main/resources/schema/something.wsdl</wsdl>
                                    <extraargs>
                                        <extraarg>-verbose</extraarg>
                                        <extraarg>-xjc-Xfluent-api</extraarg>
                                        <extraarg>-xjc-b,${basedir}/src/main/resources/schema/bindings.xml</extraarg>
                                        <extraarg>-p</extraarg>
                                </wsdlOption>
                            </wsdlOptions>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.jvnet.jaxb2_commons</groupId>
                        <artifactId>jaxb2-fluent-api</artifactId>
                        <version>${jaxb2-fluent-api.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </pluginManagement>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
        <resource>
            <directory>src/main/webapp/dist/</directory>
        </resource>
    </resources>
</build>

<dependencies>
    <!-- ============================================================================================ -->
    <!--                        ANYTHING NOT SPRING, CAMEL OR TEST DEPENDENCIES START                 -->
    <!-- ============================================================================================ -->
    <dependency>
        <groupId>com.ibm.eai.fisservices</groupId>
        <artifactId>fisservice-data-definitions</artifactId>
        <version>${fisservices.version}</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.dataformat</groupId>
        <artifactId>jackson-dataformat-yaml</artifactId>
        <version>${jackson-version}</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.datatype</groupId>
        <artifactId>jackson-datatype-jsr310</artifactId>
        <version>${jackson-version}</version>
    </dependency>
    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>${joda-time.version}</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>${jaxb.version}</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-core</artifactId>
        <version>${jaxb.version}</version>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>${lombok.version}</version>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>${logback.version}</version>
    </dependency>
    <dependency>
        <groupId>org.jolokia</groupId>
        <artifactId>jolokia-jvm</artifactId>
        <classifier>agent</classifier>
        <version>${jolokia.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.4</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-core</artifactId>
        <version>${cxf.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>${cxf.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <version>${cxf.version}</version>
    </dependency>
    <!-- ============================================================================================ -->
    <!--                        ANYTHING NOT SPRING, CAMEL OR TEST DEPENDENCIES END                   -->
    <!-- ============================================================================================ -->

    <!-- ============================================================================================ -->
    <!--                        SPRING BOOT STARTER-DEPENDENCIES START                                -->
    <!-- ============================================================================================ -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>${spring-boot}</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
            <exclusion>
                <artifactId>log4j-over-slf4j</artifactId>
                <groupId>org.slf4j</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jetty</artifactId>
        <version>${spring-boot}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-logging</artifactId>
        <exclusions>
            <exclusion>
                <artifactId>log4j-over-slf4j</artifactId>
                <groupId>org.slf4j</groupId>
            </exclusion>
        </exclusions>
        <version>${spring-boot}</version>
    </dependency>
    <!--<dependency>-->
        <!--<groupId>org.springframework.boot</groupId>-->
        <!--<artifactId>spring-boot-starter-log4j2</artifactId>-->
        <!--<version>${spring-boot}</version>-->
    <!--</dependency>-->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <version>${spring-boot}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-mongodb</artifactId>
        <version>${spring-boot}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-configuration-processor</artifactId>
        <optional>true</optional>
        <version>${spring-boot}</version>
    </dependency>
    <dependency>
        <groupId>org.jasypt</groupId>
        <artifactId>jasypt</artifactId>
        <version>${jasypt.version}</version>
    </dependency>
    <dependency>
        <groupId>com.github.ulisesbocchio</groupId>
        <artifactId>jasypt-spring-boot-starter</artifactId>
        <version>${jasypt-spring-boot-starter.version}</version>
    </dependency>
    <!-- ============================================================================================ -->
    <!--                        SPRING BOOT STARTER-DEPENDENCIES END                                  -->
    <!-- ============================================================================================ -->

    <!-- ============================================================================================ -->
    <!--                        OTHER SPRING DEPENDENCIES START                                       -->
    <!-- ============================================================================================ -->
    <!-- We generally don't want to depend explicitly on Spring, there we keep this section to itself
     to be explicit about it -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${spring.version}</version>
    </dependency>
    <!-- ============================================================================================ -->
    <!--                        OTHER SPRING DEPENDENCIES END                                       -->
    <!-- ============================================================================================ -->

    <!-- ============================================================================================ -->
    <!--                        CAMEL DEPENDENCIES START                                              -->
    <!-- ============================================================================================ -->
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-spring-boot</artifactId>
        <version>${camel.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-core</artifactId>
        <version>${camel.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-quartz2</artifactId>
        <version>${camel.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-jasypt</artifactId>
        <version>${camel.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-test</artifactId>
        <version>${camel.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-test-spring</artifactId>
        <version>${camel.version}</version>
    </dependency>
    <!-- ============================================================================================ -->
    <!--                        CAMEL DEPENDENCIES END                                                -->
    <!-- ============================================================================================ -->

    <!-- ============================================================================================ -->
    <!--                        IBM-MQ DEPENDENCIES START                                              -->
    <!-- ============================================================================================ -->
    <dependency>
        <groupId>com.ibm.mq</groupId>
        <artifactId>cl3export</artifactId>
        <version>${ibm.mq.version}</version>
    </dependency>
    <dependency>
        <groupId>com.ibm.mq</groupId>
        <artifactId>cl3nonexport</artifactId>
        <version>${ibm.mq.version}</version>
    </dependency>
    <dependency>
        <groupId>com.ibm.mq</groupId>
        <artifactId>com.ibm.mq</artifactId>
        <version>${ibm.mq.version}</version>
    </dependency>
    <dependency>
        <groupId>com.ibm.mq</groupId>
        <artifactId>com.ibm.mq.jms.nojndi</artifactId>
        <version>${ibm.mq.version}</version>
    </dependency>
    <dependency>
        <groupId>com.ibm.mq</groupId>
        <artifactId>com.ibm.mq.soap</artifactId>
        <version>${ibm.mq.version}</version>
    </dependency>
    <dependency>
        <groupId>com.ibm.mq</groupId>
        <artifactId>com.ibm.mqjms</artifactId>
        <version>${ibm.mq.version}</version>
    </dependency>
    <dependency>
        <groupId>com.ibm.mq</groupId>
        <artifactId>connector</artifactId>
        <version>${ibm.mq.version}</version>
    </dependency>
    <dependency>
        <groupId>com.ibm.mq</groupId>
        <artifactId>dhbcore</artifactId>
        <version>${ibm.mq.version}</version>
    </dependency>
    <dependency>
        <groupId>com.ibm.mq</groupId>
        <artifactId>jms</artifactId>
        <version>${ibm.mq.version}</version>
    </dependency>
    <dependency>
        <groupId>com.ibm.mq</groupId>
        <artifactId>jta</artifactId>
        <version>${ibm.mq.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-j2ee-connector_1.6_spec</artifactId>
        <version>${geronimo-j2ee-connector.version}</version>
    </dependency>
    <!-- ============================================================================================ -->
    <!--                        IBM-MQ DEPENDENCIES END                                                -->
    <!-- ============================================================================================ -->

    <!-- ============================================================================================ -->
    <!--                        TEST DEPENDENCIES START                                              -->
    <!-- ============================================================================================ -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>${mockito.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.easytesting</groupId>
        <artifactId>fest-assert</artifactId>
        <version>${fest.assert.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>${spring.version}</version>
        <scope>test</scope>
    </dependency>
    <!-- ============================================================================================ -->
    <!--                        TEST DEPENDENCIES END                                              -->
    <!-- ============================================================================================ -->
</dependencies>

1 个答案:

答案 0 :(得分:0)

好,所以我认为它现在可以工作了。

最后,我删除了对所有日志记录库的所有依赖关系,并从头开始构建它。最后,我注释了以下依赖项:

 [section2_grey_section] => Array
    (
        [0] => a:3:{i:0;a:3:  {s:14:"bigimg_link_id";i:21;s:11:"bigimg_link";s:76:"http://www.w.xxxxx.com/wp-content/uploads/2017/02/celebrate_icon1.png";s:15:"section_content";s:152:"<h4>Need a <span>Green Lawn for Mehendi</span> ceremony?</h4>
        <p>Use our Grasslands, Palm Grove, Mango Grove, Green Sparkle just the way you want! </p>";}i:1;a:3:{s:14:"bigimg_link_id";i:22;s:11:"bigimg_link";s:76:"http://www.w.xxxxx.com/wp-content/uploads/2017/02/celebrate_icon2.png";s:15:"section_content";s:156:"<h4>Need a cozy 
          <span>banquet room</span> for haldi?</h4>
        <p>Our 2360 sq.ft./ 4000 sq.ft. Banquet rooms stand ready for you and your close knit family.</p>"; }i:2;a:3:{s:14:"bigimg_link_id";i:23;s:11:"bigimg_link";s:76:"http://www.w.xxxxx.com/wp-content/uploads/2017/02/celebrate_icon3.png";s:15:"section_content";s:146:"<h4>Got  <span>Cocktail, Bachelors or Hens</span> in mind?</h4>
        <p>Our hill surrounded outdoor spaces are idyllic for letting yourself loose.</p>";}}
    )

<!--<dependency>-->
        <!--<groupId>org.springframework.boot</groupId>-->
        <!--<artifactId>spring-boot-starter-logging</artifactId>-->
        <!--<version>${spring-boot}</version>-->
        <!--<exclusions>-->
            <!--<exclusion>-->
                <!--<artifactId>log4j-over-slf4j</artifactId>-->
                <!--<groupId>org.slf4j</groupId>-->
            <!--</exclusion>-->
        <!--</exclusions>-->
    <!--</dependency>-->

我仍然不明白为什么删除这些依赖项有效。但是,从头开始并不是一个坏主意。