简体   繁体   English

在Groovy中将Logback与RollingFilePolicy一起使用

[英]Using Logback with RollingFilePolicy in groovy

I'm trying to configure logback(in groovy) with a daily rollover policy. 我正在尝试使用每日过渡策略配置logback(常规)。 This is the configuration for my appender 这是我的appender的配置

appender("FILE", RollingFileAppender) {

    encoder(PatternLayoutEncoder) {
        pattern = "%d{HH:mm:ssZ} [%thread] %-5level %logger{100} - %msg%n"
    }

    /* Today's log file */
    file = "./logs/log.log"
    append = true

    /* Rollover policy */
    rollingFilePolicy(TimeBasedRollingPolicy) {
        fileNamePattern = "./logs/archived/%d{yyyy, aux}/%d{MM, aux}/log_%d{yyyy-MM-dd}.zip"
        maxHistory = 180
    }

    filter(ThresholdFilter) {
        level = INFO
    }
}

When I try to run the application, however, I see the following problem and the log files are not created. 但是,当我尝试运行该应用程序时,出现以下问题,并且未创建日志文件。

Appender [FILE] of type [ch.qos.logback.core.rolling.RollingFileAppender] has no appplicable [rollingFilePolicy] property

Can someone help me out here? 有人可以帮我吗? I guess there's a configuration problem. 我想这是一个配置问题。 I would have used the translator program on the logback site, but it's down. 我本可以在登录站点上使用翻译器程序,但是它关闭了。

也许问题出在它具有rollingPolicy而不是rollingFilePolicy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM