简体   繁体   中英

Where do Jersey json serialization errors get logged?

This dead simple jersey request fails with server error 500. I'm pretty sure it is on serialization. I had another object that was doing the same thing and I stepped through in the debugger and discovered some member wasn't serializable.

Anyway, my question - where does jersey logs the root cause of these problems? They're not going into the tomcat logs. When I was in the debugger, it was getting logged to something, but I could quite figure out where it was going.

@Path("myresource")
public class MyResource {

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Map<String, String> getProps() {
        Properties props =   System.getProperties();
        Map<String, String> results = new HashMap<>();

        for (Object o : props.keySet()) {
            String key = (String) o;
            results.put(key, props.getProperty(key));
        }
        return results;
    }

Jersey uses the JDK logging API. Here is a tutorial for setting it up: http://yatel.kramolis.cz/2013/11/how-to-configure-jdk-logging-for-jersey.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM