Skip to content

Commit 3ddb6f6

Browse files
committed
How to migrate a library
1 parent 788e21b commit 3ddb6f6

File tree

5 files changed

+34
-1
lines changed

5 files changed

+34
-1
lines changed

examples/migration-lib/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,20 @@ android {
3636
}
3737

3838
dependencies {
39+
implementation 'io.github.neboskreb:android-log4j2-migration:2.0'
40+
implementation 'org.slf4j:slf4j-api:2.0.17'
41+
implementation 'org.slf4j:slf4j-ext:2.0.17'
3942
implementation 'androidx.core:core-ktx:1.17.0'
4043

4144

45+
testImplementation 'io.github.neboskreb:android-log4j2:2.24'
4246
testImplementation platform('org.junit:junit-bom:5.12.2')
4347
testImplementation 'org.junit.jupiter:junit-jupiter-api'
4448
testImplementation 'org.junit.jupiter:junit-jupiter'
4549
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
4650

4751

52+
androidTestImplementation 'io.github.neboskreb:android-log4j2-junit5:2.24'
4853
androidTestImplementation platform('org.junit:junit-bom:5.12.2')
4954
androidTestImplementation 'org.junit.jupiter:junit-jupiter-api'
5055
androidTestImplementation 'org.junit.jupiter:junit-jupiter'
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Root Logger
2+
rootLogger = OFF, LOGCAT
3+
4+
# Direct log messages to LOGCAT
5+
appender.logcat.type = Logcat
6+
appender.logcat.name = LOGCAT
7+
appender.logcat.layout.type = PatternLayout
8+
appender.logcat.layout.pattern = %m%n
9+
#appender.logcat.stack-trace-rendering = log4j
10+
appender.logcat.stack-trace-rendering = logcat
11+
12+
13+
logger.lib.name = MY_LIBRARY
14+
logger.lib.level = warn

examples/migration-lib/src/androidTest/kotlin/com/github/neboskreb/log4j2/examples/migration/lib/MyLibraryAndroidTest.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package com.github.neboskreb.log4j2.examples.migration.lib
22

33
import org.junit.jupiter.api.Test
4+
import org.junit.jupiter.api.extension.ExtendWith
5+
import com.github.neboskreb.log4j2.android.AndroidLog4jExtension
46

7+
@ExtendWith(AndroidLog4jExtension::class)
58
class MyLibraryAndroidTest {
69
@Test
710
fun logSomething() {

examples/migration-lib/src/main/kotlin/com/github/neboskreb/log4j2/examples/migration/lib/MyLibrary.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.github.neboskreb.log4j2.examples.migration.lib
22

3-
import android.util.Log
3+
import com.github.neboskreb.log4j2.migration.Log
44

55
private const val TAG = "MY_LIBRARY"
66

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Root Logger
2+
rootLogger = OFF, CON
3+
4+
# Direct log messages to CON
5+
appender.console.type = Console
6+
appender.console.name = CON
7+
appender.console.layout.type = PatternLayout
8+
appender.console.layout.pattern = %-5p [%t]: %m%n
9+
10+
logger.lib.name = MY_LIBRARY
11+
logger.lib.level = off

0 commit comments

Comments
 (0)