com.baskit.android,Logback-Android:将FixedWindowRollingPolicy与SizeBasedTriggeringPolicy一起使用时出现“无适用操作”...

我在我的

Android应用程序中使用

logback-android将消息记录到文件,只要启用了日志记录(在app中配置).

它似乎工作正常,但当我有以下情况

>当大小达到50MB时旋转日志

>创建日志轮换时的备份文件.例如. testFile.1.log.zip

为此,我有以下logback.xml文件:

/sdcard/dappLog.log

true

%-4relative [%thread] %-5level %logger{35} - %msg%n

/sdcard/dappLog.%i.log.zip

1

2

50MB

根据this答案,因为SizeBasedTriggerPolicy中有一个bug(src),所以我有以下实现:

`

package com.dapp.utilities;

import java.io.File;

import ch.qos.logback.core.util.FileSize;

public class SizeBasedTriggeringPolicy extends ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy {

@Override

public boolean isTriggeringEvent(final File activeFile,final E event) {

return (activeFile.length() >= FileSize.valueOf(getMaxFileSize()).getSize());

}

}

`

但是,当我运行它时,我收到以下错误:

I/System.out( 2346): 16:14:20,750 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@8:85 - no applicable action for [rollingPolicy],current pattern is [[configuration][appender][rollingPolicy]]

I/System.out( 2346): 16:14:20,757 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@9:30 - no applicable action for [fileNamePattern],current pattern is [[configuration][appender][rollingPolicy][fileNamePattern]]

I/System.out( 2346): 16:14:20,763 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@10:23 - no applicable action for [minIndex],current pattern is [[configuration][appender][rollingPolicy][minIndex]]

I/System.out( 2346): 16:14:20,770 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@11:23 - no applicable action for [maxIndex],current pattern is [[configuration][appender][rollingPolicy][maxIndex]]

I/System.out( 2346): 16:14:20,777 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@14:90 - no applicable action for [triggeringPolicy],current pattern is [[configuration][appender][triggeringPolicy]]

I/System.out( 2346): 16:14:20,820 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@15:26 - no applicable action for [maxFileSize],current pattern is [[configuration][appender][triggeringPolicy][maxFileSize]]

PS:我不熟悉logback.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值