Application log garbled in Tomcat under Linux

  The Java Web application is deployed on the Tomcat server on the upper part of Linux. When checking the log, it is found that all the Chinese characters in it are garbled. When dragging and dropping the files to the local Windows, there are all question marks. A normally displayed log containing Chinese can also be displayed normally from other systems, indicating that the system character set is fine.
  So follow the steps from the bottom of the system to the application settings to pay attention to the screening code settings
  1. System code
   
cat /etc/sysconfig/i18n  或  echo $LANG

    Shows as GBK, no problem.

  2. Check the encoding settings in the Tomcat configuration file.     There are no encoding items set
    in web.xml and logging.properties , so they should be the default settings.   3.     Add "-Dfile.encoding=GBK -Dsun.jnu.encoding=GBK" to the Java reference parameters referenced by JDK, add     the above parameters to the JAVA_OPTS variable in Catalina.sh, restart Tomcat, and it's OK.






Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326864207&siteId=291194637