Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ghost opened this issue Oct 6, 2016 · 1 comment
Closed

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

ghost opened this issue Oct 6, 2016 · 1 comment
Assignees
Milestone

Comments

@ghost
Copy link

ghost commented Oct 6, 2016

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.

@UrielCh UrielCh self-assigned this Mar 25, 2017
@UrielCh UrielCh added this to the 2.3 milestone Mar 25, 2017
@UrielCh
Copy link
Contributor

UrielCh commented Mar 26, 2017

those e.printStackTrace(); had been removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant