Skip to content

Can't disable stack traces written to standard error #33

Closed
@ghost

Description

Is there any way that the calls to write the stack trace to standard out be replaced with calls to a logging framework such as logback, log4j, or slf4j? This would allow filtering of specific log messages.

Here's our problem: We are using JSON smart v2 as a part of the JayWay JSON Path expression processor to parse JSON formatted response messages from REST web services. Our application runs in a Tomcat container, with its standard error being during to a file.

Under certain circumstances, when the JSON Path expression in the response almost perfectly matches the JSON String being processed (I can give you more details if you wish), a stack trace happens on every call and the Tomcat log file grows dramatically quickly. It has reached in excess of 5GB and has caused production problems.

As an example, in the File "JSONValue.java" at lines 203 thru 211 inclusive (with the e.printStackTrace() call at line 208):

public static <T> T parse(String in, Class<T> mapTo) {
    try {
        JSONParser p = new JSONParser(DEFAULT_PERMISSIVE_MODE);
        return p.parse(in, defaultReader.getMapper(mapTo));
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

The call to e.printStackTrace() at line 208 causes a stack trace to be written each time this exception occurs , which can be quite often. Basically, we don't need to see the stack trace.

So, could they be replaced by a logging framework?

I would be more than happy to create a fork or json-smart-v2 and add the logging framework in.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions