diff --git a/JSONObject.java b/JSONObject.java index 60420bdd1..4ae5c2c4d 100755 --- a/JSONObject.java +++ b/JSONObject.java @@ -795,7 +795,10 @@ public int length() { } private void logSerializationException(Exception e) { - logger.error("Failed to serialize a JSONObject: " + e, e); + String enabled = System.getProperty("json.java.log.serialization.exceptions"); + if (enabled != null && Boolean.parseBoolean(enabled)) { + logger.error("Failed to serialize a JSONObject: " + e, e); + } } /**