From 80ef86b90d4a3ce3fdae795d61a5772febd0e980 Mon Sep 17 00:00:00 2001 From: LamGC Date: Mon, 18 Apr 2022 11:56:33 +0800 Subject: [PATCH] Change exception log information. Output exception details in exception handling to help developers troubleshoot problems. At the same time, by checking whether the debug level is enabled, too many output logs in the production environment can be avoided. (I guess the original design was for this reason) --- .../org/telegram/abilitybots/api/bot/BaseAbilityBot.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java index e8297590..e443012b 100644 --- a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java +++ b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java @@ -673,8 +673,13 @@ public abstract class BaseAbilityBot extends DefaultAbsSender implements Ability try { return callable.call(); } catch(Exception ex) { - log.error(format("Reply [%s] failed to check for conditions. " + - "Make sure you're safeguarding against all possible updates.", name)); + String msg = format("Reply [%s] failed to check for conditions. " + + "Make sure you're safeguarding against all possible updates.", name); + if (log.isDebugEnabled()) { + log.error(msg, ex); + } else { + log.error(msg); + } } return false; }