logback-android:用于Android的可靠,通用,快速和灵活的日志记录框架

网友投稿 1446 2022-11-04

logback-android:用于Android的可靠,通用,快速和灵活的日志记录框架

logback-android:用于Android的可靠,通用,快速和灵活的日志记录框架

v2.0.0

Overview

logback-android brings the power of logback to Android. This library provides a highly configurable logging framework for Android apps, supporting multiple log destinations simultaneously:

filesSQLite databaseslogcatsocketssyslogemail

Runs on Android 2.3 (SDK 9) or higher. See Wiki for documentation.

For v1.x, see the 1.x branch.

Quick Start

Create a new "Basic Activity" app in Android Studio. In app/build.gradle, add the following dependencies:dependencies { compile 'org.slf4j:slf4j-api:1.7.25' compile 'com.github.tony19:logback-android:2.0.0'} Create app/src/main/assets/logback.xml containing: %logger{12} [%-20thread] %msg In MainActivity.java, add the following imports:import org.slf4j.Logger;import org.slf4j.LoggerFactory; ...and modify onOptionsItemSelected() to log "hello world":@Overridepublic boolean onOptionsItemSelected(MenuItem item) { Logger log = LoggerFactory.getLogger(MainActivity.class); log.info("hello world"); // ...} Build and start the app. Open logcat for your device (via the Android Monitor tab in Android Studio). Click the app menu, and select the menu-option. You should see "hello world" in logcat.

Download

Gradle release

dependencies { compile 'org.slf4j:slf4j-api:1.7.25' compile 'com.github.tony19:logback-android:2.0.0'}

Gradle snapshot (unstable)

repositories { maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }}dependencies { compile 'org.slf4j:slf4j-api:1.7.25' compile 'com.github.tony19:logback-android:2.0.1-SNAPSHOT'}

Build

Use these commands to create the AAR:

git clone git://github.com/tony19/logback-android.gitcd logback-androidscripts/makejar.sh

The file is output to: ./build/logback-android-2.0.0-debug.aar

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Day09-递归
下一篇:生动形象的理解什么是装饰器!
相关文章

 发表评论

暂时没有评论,来抢沙发吧~