Skip to content

Commit

Permalink
Keep required logger files
Browse files Browse the repository at this point in the history
  • Loading branch information
davidvedvick committed Apr 22, 2023
1 parent c0f6572 commit 6d4def3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion projectBlueWater/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ android {
returnDefaultValues = true
all {
maxHeapSize = "2048m"
maxParallelForks = 2
maxParallelForks = 3
systemProperty 'robolectric.sqliteMode', 'NATIVE'
}
}
Expand Down
2 changes: 2 additions & 0 deletions projectBlueWater/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@
public static final ** CREATOR;
}

-keepclassmembers class ch.qos.logback.core.rolling.helper.* { <init>(); }

# -printseeds /home/david/sandbox/projectBlue/projectBlueWater/release/seeds.txt # print out classes that are kept
# -printusage /home/david/sandbox/projectBlue/projectBlueWater/release/usage.txt # print out classes that are obfuscated
Original file line number Diff line number Diff line change
Expand Up @@ -199,27 +199,30 @@ open class MainApplication : Application() {
if (externalFilesDir != null) {
val logDir = File(externalFilesDir.path + File.separator + "logs")
if (!logDir.exists()) logDir.mkdirs()
val filePle = PatternLayoutEncoder()
filePle.pattern = "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
filePle.context = lc
filePle.start()

val rollingFileAppender = RollingFileAppender<ILoggingEvent>()
rollingFileAppender.lazy = true
rollingFileAppender.isAppend = true
rollingFileAppender.context = lc
rollingFileAppender.encoder = filePle

rollingFileAppender.rollingPolicy = TimeBasedRollingPolicy<ILoggingEvent>().apply {
fileNamePattern = File(logDir, "%d{yyyy-MM-dd}.log").absolutePath
maxHistory = 30
setParent(rollingFileAppender) // parent and context required!
val rollingFileAppender = RollingFileAppender<ILoggingEvent>().apply {
lazy = true
isAppend = true
context = lc
file = File(logDir, "log.log").absolutePath

rollingPolicy = TimeBasedRollingPolicy<ILoggingEvent>()
.also { it.setParent(this) }
.apply {
fileNamePattern = File(logDir, "%d{yyyy-MM-dd}.log").absolutePath
maxHistory = 30
context = lc
start()
}

encoder = PatternLayoutEncoder().apply {
pattern = "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
context = lc
start()
}

start()
}

rollingFileAppender.start()

asyncAppender.addAppender(rollingFileAppender)
}

Expand Down

0 comments on commit 6d4def3

Please sign in to comment.