From 0f4a2d2e974863bc6493e0b9d831a232f7fba05d Mon Sep 17 00:00:00 2001 From: nik Date: Fri, 15 Apr 2016 17:04:00 +0300 Subject: [PATCH] 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) --- .../intellij/diagnostic/DebugLogManager.kt | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/diagnostic/DebugLogManager.kt b/platform/platform-impl/src/com/intellij/diagnostic/DebugLogManager.kt index a8bc7612aa6c..e6c879898208 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/DebugLogManager.kt +++ b/platform/platform-impl/src/com/intellij/diagnostic/DebugLogManager.kt @@ -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> { - 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"