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

Slf4j in static context #15

Closed
giko opened this issue Oct 31, 2013 · 1 comment
Closed

Slf4j in static context #15

giko opened this issue Oct 31, 2013 · 1 comment
Labels
Milestone

Comments

@giko
Copy link

giko commented Oct 31, 2013

Don't know if error is present in other loggers, but for Slf4j:

@Slf4j
public class NrivExceptionHandler {
    public static ModelAndView handle(Exception ex) {
        MappingJacksonJsonView jsonView = new MappingJacksonJsonView();
        Map<String, String> errors = new HashMap<String, String>();
        CharArrayWriter buffer = new CharArrayWriter();
        PrintWriter writer = new PrintWriter(buffer);
        ex.printStackTrace(writer);
        errors.put("error", ex.getMessage());
        errors.put("errorStackTrace", buffer.toString());
        writer.close();

        log.error("", ex);
        return new ModelAndView(jsonView, errors);
    }
}

plugin can't resolve log object

@mplushnikov
Copy link
Owner

Please verify with new plugin version (0.8.2)

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

No branches or pull requests

2 participants