diff --git a/app/src/main/java/com/termux/app/TermuxService.java b/app/src/main/java/com/termux/app/TermuxService.java index 0b713935..59005c0a 100644 --- a/app/src/main/java/com/termux/app/TermuxService.java +++ b/app/src/main/java/com/termux/app/TermuxService.java @@ -455,8 +455,10 @@ public final class TermuxService extends Service implements AppShell.AppShellCli // If the execution command was started for a plugin, then process the error if (executionCommand.isPluginExecutionCommand) TermuxPluginUtils.processPluginExecutionCommandError(this, LOG_TAG, executionCommand, false); - else - Logger.logErrorExtended(LOG_TAG, executionCommand.toString()); + else { + Logger.logError(LOG_TAG, "Set log level to debug or higher to see error in logs"); + Logger.logErrorPrivateExtended(LOG_TAG, executionCommand.toString()); + } return null; } @@ -576,8 +578,10 @@ public final class TermuxService extends Service implements AppShell.AppShellCli // If the execution command was started for a plugin, then process the error if (executionCommand.isPluginExecutionCommand) TermuxPluginUtils.processPluginExecutionCommandError(this, LOG_TAG, executionCommand, false); - else - Logger.logErrorExtended(LOG_TAG, executionCommand.toString()); + else { + Logger.logError(LOG_TAG, "Set log level to debug or higher to see error in logs"); + Logger.logErrorPrivateExtended(LOG_TAG, executionCommand.toString()); + } return null; } diff --git a/termux-shared/src/main/java/com/termux/shared/logger/Logger.java b/termux-shared/src/main/java/com/termux/shared/logger/Logger.java index e2573a8a..e5075b1f 100644 --- a/termux-shared/src/main/java/com/termux/shared/logger/Logger.java +++ b/termux-shared/src/main/java/com/termux/shared/logger/Logger.java @@ -120,6 +120,28 @@ public class Logger { + public static void logErrorPrivate(String tag, String message) { + if (CURRENT_LOG_LEVEL >= LOG_LEVEL_DEBUG) + logMessage(Log.ERROR, tag, message); + } + + public static void logErrorPrivate(String message) { + if (CURRENT_LOG_LEVEL >= LOG_LEVEL_DEBUG) + logMessage(Log.ERROR, DEFAULT_LOG_TAG, message); + } + + public static void logErrorPrivateExtended(String tag, String message) { + if (CURRENT_LOG_LEVEL >= LOG_LEVEL_DEBUG) + logExtendedMessage(Log.ERROR, tag, message); + } + + public static void logErrorPrivateExtended(String message) { + if (CURRENT_LOG_LEVEL >= LOG_LEVEL_DEBUG) + logExtendedMessage(Log.ERROR, DEFAULT_LOG_TAG, message); + } + + + public static void logWarn(String tag, String message) { logMessage(Log.WARN, tag, message); } diff --git a/termux-shared/src/main/java/com/termux/shared/termux/plugins/TermuxPluginUtils.java b/termux-shared/src/main/java/com/termux/shared/termux/plugins/TermuxPluginUtils.java index 28904e9f..ed2d9a20 100644 --- a/termux-shared/src/main/java/com/termux/shared/termux/plugins/TermuxPluginUtils.java +++ b/termux-shared/src/main/java/com/termux/shared/termux/plugins/TermuxPluginUtils.java @@ -144,7 +144,9 @@ public class TermuxPluginUtils { boolean isExecutionCommandLoggingEnabled = Logger.shouldEnableLoggingForCustomLogLevel(executionCommand.backgroundCustomLogLevel); // Log the error and any exception. ResultData should not be logged if pending result since ResultSender will do it - Logger.logErrorExtended(logTag, ExecutionCommand.getExecutionOutputLogString(executionCommand, true, + Logger.logError(logTag, "Processing plugin execution error for:\n" + executionCommand.getCommandIdAndLabelLogString()); + Logger.logError(logTag, "Set log level to debug or higher to see error in logs"); + Logger.logErrorPrivateExtended(logTag, ExecutionCommand.getExecutionOutputLogString(executionCommand, true, !isPluginExecutionCommandWithPendingResult, isExecutionCommandLoggingEnabled)); // If execution command was started by a plugin which expects the result back @@ -161,7 +163,7 @@ public class TermuxPluginUtils { if (error != null) { // error will be added to existing Errors resultData.setStateFailed(error); - Logger.logErrorExtended(logTag, ExecutionCommand.getExecutionOutputLogString(executionCommand, true, true, isExecutionCommandLoggingEnabled)); + Logger.logErrorPrivateExtended(logTag, ExecutionCommand.getExecutionOutputLogString(executionCommand, true, true, isExecutionCommandLoggingEnabled)); forceNotification = true; }