The data returns to normal, but the console output parameter is a garbled solution

Source: Internet
Author: User
Tags log log


Recently in the background to write the function, tangled up a long time problem, the query data are normal, but the console output Chinese parameters are garbled, before because the progress is not too concerned about, now the function is almost done, began to solve this garbled problem.
At first, I think it might be a problem with the data coding in the foreground, but think about it, data inquiries are normal, indicating that the reception of the coding and backstage reception of the code are normal; After thinking may be compiler coding problem, Baidu, Google a large circle, the idea of the code and configuration files changed and changed, or did not solve the garbled problem; After thinking that it was Tomcat did not set the encoding. So looked at Tomcat under the Server.xml file, found that has been configured uriencoding= "UTF-8"; above three kinds of situation can not solve the garbled problem, that will be what led to garbled it.
Later validated, is in the log log to the output log code, resulting in the console output Chinese garbled. I use the slf4j log, in the Logback.xml, all the appender below the CharSet all commented out
After that, the console Chinese parameters are displayed correctly.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.