Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ical4android, specify ical4j log level #946

Merged
merged 2 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ changelog:
- title: Refactoring
labels:
- refactoring
- title: Dependencies
labels:
- dependencies
- title: Other changes
labels:
- "*"
4 changes: 4 additions & 0 deletions app/src/main/assets/logging.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# reduce verbose of some otherwise annoying ical4j messages
net.fortuna.ical4j.data.level = INFO
net.fortuna.ical4j.model.Recur.level = INFO
15 changes: 7 additions & 8 deletions app/src/main/kotlin/at/bitfire/davdroid/log/LogManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch
import java.io.Closeable
import java.util.logging.Level
import java.util.logging.Logger
import javax.inject.Inject
Expand Down Expand Up @@ -71,18 +70,18 @@ class LogManager @Inject constructor(
val logVerbose = logToFile || BuildConfig.DEBUG || Log.isLoggable(logger.name, Log.DEBUG)
logger.info("Verbose logging = $logVerbose; log to file = $logToFile")

// root logger: remove all existing handlers
val rootLogger = Logger.getLogger("")
for (handler in rootLogger.handlers) {
rootLogger.removeHandler(handler)
if (handler is Closeable) // gracefully close previous verbose-logging handlers
handler.close()
// reset existing loggers and initialize from assets/logging.properties
context.assets.open("logging.properties").use {
val javaLogManager = java.util.logging.LogManager.getLogManager()
javaLogManager.readConfiguration(it)
}

// set log level and always log to logcat
// root logger: set default log level and always log to logcat
val rootLogger = Logger.getLogger("")
rootLogger.level = if (logVerbose) Level.ALL else Level.INFO
rootLogger.addHandler(LogcatHandler())

// log to file, if requested
if (logToFile)
rootLogger.addHandler(logFileHandler.get())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import at.bitfire.ical4android.BatchOperation
import at.bitfire.ical4android.DmfsTask
import at.bitfire.ical4android.DmfsTaskFactory
import at.bitfire.ical4android.DmfsTaskList
import at.bitfire.ical4android.Ical4Android
import at.bitfire.ical4android.Task
import org.dmfs.tasks.contract.TaskContract.Tasks
import java.util.UUID
Expand Down Expand Up @@ -79,7 +78,7 @@ class LocalTask: DmfsTask, LocalResource<Task> {

override fun clearDirty(fileName: String?, eTag: String?, scheduleTag: String?) {
if (scheduleTag != null)
Ical4Android.log.fine("Schedule-Tag for tasks not supported yet, won't save")
logger.fine("Schedule-Tag for tasks not supported yet, won't save")

val values = ContentValues(4)
if (fileName != null)
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ androidx-test-junit = "1.2.1"
androidx-work = "2.9.0"
bitfire-cert4android = "f1cc9b9ca3"
bitfire-dav4jvm = "2b414984a8"
bitfire-ical4android = "505f74771e"
bitfire-ical4android = "a36ee480aa"
bitfire-vcard4android = "d5415f20b7"
compose-accompanist = "0.34.0"
compose-bom = "2024.06.00"
Expand Down
Loading