Java slf4j Logger printPrettyJson(Logger logger, String json)

Here you can find the source of printPrettyJson(Logger logger, String json)

Description

print Pretty Json

License

Open Source License

Declaration

public static void printPrettyJson(Logger logger, String json) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import org.slf4j.Logger;

import com.fasterxml.jackson.databind.ObjectMapper;

public class Main {
    public static void printPrettyJson(Logger logger, String json) {
        try {// ww  w.j  a v  a 2s . c  o m
            ObjectMapper mapper = new ObjectMapper();
            logger.info(mapper.writerWithDefaultPrettyPrinter()
                    .writeValueAsString(mapper.readValue(json, Object.class)));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Related

  1. logThrowable(Throwable throwable)
  2. logWarningWithDebugDetails(Logger logger, Throwable t, String message, Object... values)
  3. notNull(String message, Object obj)
  4. parsePortNumber(String port, int defaultPort)
  5. printInfoLog(Class cla, String message)
  6. printRequestLog(Map reqParam)
  7. printResponseLog(String res)
  8. printStackTrace(Logger logger, Throwable e)
  9. profilerTrigger2(Logger log, String msg)