使用 gradle 为 Android 配置 Log4j

Log4j configure for Android using gradle

我想用log4j把日志写入sdcard。如何专门使用 gradle 配置 log4j?

我看到的许多线程都要求下载 jar 并将其添加为库,但我找不到关于使用 gradle 配置 log4j 的好方法 post。

这个post describes the solution using using the android-logging-log4j.jar.

Gradle 相同的依赖项:

Original code

compile group: 'de.mindpipe.android', name: 'android-logging-log4j', version: '1.0.3'
compile group: 'log4j', name: 'log4j', version: '1.2.17'

Updated : Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.

implementation 'de.mindpipe.android:android-logging-log4j:1.0.3'
implementation 'log4j:log4j:1.2.17'