问题描述
我想在Android项目使用的logback-机器人。这里是我做了什么
I want to use logback-android in Android project. Here is what I have done
我抄在 JAR 文件中的库文件夹
- 的logback-Android的1.1.1-2.jar
- SLF4J的API-1.7.6.jar
在有logback.xml的资产文件夹
and have logback.xml in assets folder
<configuration debug="true">
<property name="LOG_DIR" value="/mnt/sdcard/com.sf.quid/logs" />
<!-- Create a logcat appender -->
<appender name="LOG_CAT" class="ch.qos.logback.classic.android.LogcatAppender">
<encoder>
<pattern>%msg</pattern>
</encoder>
</appender>
<!-- Rolling Appender -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- File location -->
<file>${LOG_DIR}/quidpos.log</file>
<!-- Only log error messages to log file -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>DEBUG</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<!-- Rolling Policy -->
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>${LOG_DIR}/quidpos.%i.log</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>1</maxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>1MB</maxFileSize>
</triggeringPolicy>
<!-- Message encoder -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
</appender>
<!-- Log level - change this to ERROR on release -->
<root level="debug">
<appender-ref ref="LOG_CAT"/>
<appender-ref ref="FILE" />
</root>
</configuration>
和这里是从依赖节的build.gradle 文件
dependencies {
compile 'com.android.support:support-v4:19.+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
我使用的Android 0.6.1工作室和摇篮1.12(Android插件0.11,+),当我尝试清洁工程,运行,等它导致以下错误选项
I am using Android Studio 0.6.1 and Gradle 1.12(Android plugin 0.11.+), and when I try the Clean project, Run, etc options it results in the following error
Error:Execution failed for task ':multipos:mergeDebugResources'.
Unsupported type 'property' in file C:\Users\Jagmohan\AndroidStudioProjects\MultiPOS\multipos\src\main\res\assets\logback.xml
如果任何人都可以找出潜在的问题,请回答。
If anyone can identify the potential problem, please answer.
感谢您!
推荐答案
您的资产的目录是在错误的地方。它应该是的src \\主\\资产
,而不是的src \\主\\资源\\资产
。
Your assets directory is in the wrong place. It should be src\main\assets
, not src\main\res\assets
.
它试图读取XML文件作为资源文件,因为它不是一个有效的Android资源文件是抛出一个错误。
It's trying to read your XML file as a resource file and is throwing an error since it's not a valid Android resource file.
这篇关于在文件logback.xml不支持的类型“财产”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!