mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
configure debug log settings: do not mix categories configured in log.xml with user-defined categories (otherwise categories removed from log.xml in a new produce version will remain in PropertiesComponent)
This commit is contained in:
@@ -36,13 +36,7 @@ class DebugLogManager : ApplicationComponent.Adapter() {
|
||||
}
|
||||
|
||||
override fun initComponent() {
|
||||
val categories = getSavedCategories()
|
||||
if (categories.isEmpty()) {
|
||||
saveCategories(getCurrentCategories())
|
||||
}
|
||||
else {
|
||||
applyCategories(categories)
|
||||
}
|
||||
applyCategories(getSavedCategories())
|
||||
}
|
||||
|
||||
private fun fromString(text: String?, level: DebugLogLevel) =
|
||||
@@ -72,20 +66,6 @@ class DebugLogManager : ApplicationComponent.Adapter() {
|
||||
val filtered = categories.filter { it.second == level }.map { it.first }
|
||||
return if (filtered.isNotEmpty()) filtered.joinToString("\n") else null
|
||||
}
|
||||
|
||||
private fun getCurrentCategories(): List<Pair<String, DebugLogLevel>> {
|
||||
val currentLoggers = LogManager.getCurrentLoggers().toList().filterIsInstance(org.apache.log4j.Logger::class.java)
|
||||
return currentLoggers.map {
|
||||
val category = it.name
|
||||
val logger = Logger.getInstance(category)
|
||||
when {
|
||||
logger.isTraceEnabled -> Pair(category, DebugLogLevel.TRACE)
|
||||
logger.isDebugEnabled -> Pair(category, DebugLogLevel.DEBUG)
|
||||
else -> null
|
||||
}
|
||||
}.filterNotNull()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private val LOG_DEBUG_CATEGORIES = "log.debug.categories"
|
||||
|
||||
Reference in New Issue
Block a user