From a0991e9461ef0a6a14ba90aa9a91dc9ce790bce9 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 26 Sep 2018 11:45:18 +1200 Subject: Check if log message is provided --- src/org/traccar/helper/Log.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/helper/Log.java b/src/org/traccar/helper/Log.java index 0e7eb64e8..fa732dc9c 100644 --- a/src/org/traccar/helper/Log.java +++ b/src/org/traccar/helper/Log.java @@ -124,10 +124,16 @@ public final class Log { @Override public String format(LogRecord record) { - StringBuilder message = new StringBuilder(record.getMessage()); + StringBuilder message = new StringBuilder(); + + if (record.getMessage() != null) { + message.append(record.getMessage()); + } if (record.getThrown() != null) { - message.append(" - "); + if (message.length() > 0) { + message.append(" - "); + } if (fullStackTraces) { StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); -- cgit v1.2.3