Do not use debug logging for script exceptions

This commit is contained in:
Reinhard Pointner 2016-06-12 18:33:48 +08:00
parent 8bb71d8ac0
commit 24fda5f8d8
2 changed files with 4 additions and 12 deletions

View File

@ -174,7 +174,7 @@ omdb.each{ m ->
tmdb << row
}
} catch(IllegalArgumentException | FileNotFoundException e) {
printException(e, false)
printException(e)
def row = [sync, m[0].pad(7), 0, m[2], m[1]]
log.info "[BAD] Update ${m[0..2]}: $row"
tmdb << row
@ -274,7 +274,7 @@ tvdb_updates.values().each{ update ->
}
}
catch(Throwable e) {
printException(e, false)
printException(e)
def data = [update.time, update.id, '', 0, 0]
tvdb.put(update.id, data)
log.info "[BAD] Update $update => $data"

View File

@ -136,18 +136,10 @@ public abstract class ScriptShellBaseClass extends Script {
}
public void printException(Throwable t, boolean severe) {
Level level = severe ? Level.SEVERE : Level.WARNING;
// print full stacktrace in debug mode
if (debug.isLoggable(level)) {
debug.log(level, t, t::getMessage);
return;
}
if (severe) {
log.log(level, trace(t));
log.log(Level.SEVERE, trace(t));
} else {
log.log(level, t::getMessage);
log.log(Level.WARNING, t::getMessage);
}
}