From b9cfc8c6e66f895e310dca876f01ce4e03d005f3 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud <58596990+nmicoud@users.noreply.github.com> Date: Wed, 9 Oct 2024 17:19:10 +0200 Subject: [PATCH] IDEMPIERE-6248: System Property to avoid cutting log (#2482) * IDEMPIERE-6248: System Property to avoid cutting log * IDEMPIERE-6248: System Property to avoid cutting log Remove SysConfig * IDEMPIERE-6248: System Property to avoid cutting log fix import --- .../oracle/202409231821_IDEMPIERE-6248_DelSysConfig.sql | 8 ++++++++ .../202409231821_IDEMPIERE-6248_DelSysConfig.sql | 5 +++++ org.adempiere.base/src/org/compiere/model/MSysConfig.java | 1 - .../src/org/compiere/model/SystemProperties.java | 8 ++++++++ .../src/org/compiere/util/CLogFormatter.java | 5 +---- 5 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 migration/iD11/oracle/202409231821_IDEMPIERE-6248_DelSysConfig.sql create mode 100644 migration/iD11/postgresql/202409231821_IDEMPIERE-6248_DelSysConfig.sql diff --git a/migration/iD11/oracle/202409231821_IDEMPIERE-6248_DelSysConfig.sql b/migration/iD11/oracle/202409231821_IDEMPIERE-6248_DelSysConfig.sql new file mode 100644 index 0000000000..df393c1950 --- /dev/null +++ b/migration/iD11/oracle/202409231821_IDEMPIERE-6248_DelSysConfig.sql @@ -0,0 +1,8 @@ +-- IDEMPIERE-6248 +SELECT register_migration_script('202409231821_IDEMPIERE-6248_DelSysConfig.sql') FROM dual; + +SET SQLBLANKLINES ON +SET DEFINE OFF + +DELETE FROM AD_SysConfig WHERE AD_SysConfig_ID = 200250 +; diff --git a/migration/iD11/postgresql/202409231821_IDEMPIERE-6248_DelSysConfig.sql b/migration/iD11/postgresql/202409231821_IDEMPIERE-6248_DelSysConfig.sql new file mode 100644 index 0000000000..9146a8de45 --- /dev/null +++ b/migration/iD11/postgresql/202409231821_IDEMPIERE-6248_DelSysConfig.sql @@ -0,0 +1,5 @@ +-- IDEMPIERE-6248 +SELECT register_migration_script('202409231821_IDEMPIERE-6248_DelSysConfig.sql') FROM dual; + +DELETE FROM AD_SysConfig WHERE AD_SysConfig_ID = 200250 +; diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index 63311775d7..82429f272e 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -119,7 +119,6 @@ public class MSysConfig extends X_AD_SysConfig public static final String FORM_SQL_QUERY_LOG_ISSUE = "FORM_SQL_QUERY_LOG_ISSUE"; public static final String FORM_SQL_QUERY_MAX_RECORDS = "FORM_SQL_QUERY_MAX_RECORDS"; public static final String FORM_SQL_QUERY_TIMEOUT_IN_SECONDS = "FORM_SQL_QUERY_TIMEOUT_IN_SECONDS"; - public static final String FULL_EXCEPTION_TRACE_IN_LOG = "FULL_EXCEPTION_TRACE_IN_LOG"; public static final String GLOBAL_MAX_QUERY_RECORDS = "GLOBAL_MAX_QUERY_RECORDS"; public static final String GLOBAL_MAX_REPORT_RECORDS = "GLOBAL_MAX_REPORT_RECORDS"; public static final String GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS = "GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS"; diff --git a/org.adempiere.base/src/org/compiere/model/SystemProperties.java b/org.adempiere.base/src/org/compiere/model/SystemProperties.java index 0f77fc12f6..9920d40e7d 100644 --- a/org.adempiere.base/src/org/compiere/model/SystemProperties.java +++ b/org.adempiere.base/src/org/compiere/model/SystemProperties.java @@ -50,6 +50,7 @@ public class SystemProperties { private static final String org_idempiere_db_debug_convert = "org.idempiere.db.debug.convert"; private static final String org_idempiere_db_debug_filter = "org.idempiere.db.debug.filter"; private static final String org_idempiere_FileLogPrefix = "org.idempiere.FileLogPrefix"; + private static final String org_idempiere_FullExceptionTraceInLog = "org.idempiere.FullExceptionTraceInLog"; private static final String org_idempiere_postgresql_URLParameters = "org.idempiere.postgresql.URLParameters"; private static final String org_idempiere_po_useOptimisticLocking = "org.idempiere.po.useOptimisticLocking"; private static final String PostgreSQLNative = "PostgreSQLNative"; @@ -278,4 +279,11 @@ public class SystemProperties { return "true".equals(System.getProperty(TRACE_NULL_TRX_CONNECTION)); } + /** + * org_idempiere_FullExceptionTraceInLog=true to not cut trace log + * @return + */ + public static boolean isFullExceptionTraceInLog() { + return "true".equals(System.getProperty(org_idempiere_FullExceptionTraceInLog)); + } } diff --git a/org.adempiere.base/src/org/compiere/util/CLogFormatter.java b/org.adempiere.base/src/org/compiere/util/CLogFormatter.java index 5033457d39..8e31e30a2e 100644 --- a/org.adempiere.base/src/org/compiere/util/CLogFormatter.java +++ b/org.adempiere.base/src/org/compiere/util/CLogFormatter.java @@ -16,8 +16,6 @@ *****************************************************************************/ package org.compiere.util; -import static org.compiere.model.MSysConfig.FULL_EXCEPTION_TRACE_IN_LOG; - import java.awt.Toolkit; import java.rmi.ServerException; import java.sql.SQLException; @@ -27,7 +25,6 @@ import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.LogRecord; -import org.compiere.model.MSysConfig; import org.compiere.model.SystemProperties; /** @@ -310,7 +307,7 @@ public class CLogFormatter extends Formatter if (adempiereTrace) sb.append("\tat ").append(trace[i]).append(NL); } - else if (!MSysConfig.getBooleanValue(FULL_EXCEPTION_TRACE_IN_LOG, false) && (i > 20 || (i > 10 && adempiereTraceNo > 8))) + else if (!SystemProperties.isFullExceptionTraceInLog() && (i > 20 || (i > 10 && adempiereTraceNo > 8))) break; else sb.append("\tat ").append(trace[i]).append(NL);