In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to do Chinese garbled code appears in the console log when building the task for everyone. Xiaobian thinks it is quite practical, so share it with you for reference. I hope you can gain something after reading this article.
I. Description of the problem:
Under Linux environment Centos operating system, download Jenkins image through Docker and create container, and access Jenkins address through server IP+ port, perform relevant configuration, and then create task job to build java+selenium automation test script, currently build Success, the only deficiency is that the printed log appears garbled, as shown below:
(Note: The execution machine is Jenkins itself, the same machine)
II. Troubleshooting Jenkins Settings
Jenkins System Settings View Global Properties Language Section
2. Jenkins details (browser Jenkins address followed by/systemInfo)
III. Code log encoding mode
1. Printed log confirms whether it is utf-8, confirmed yes
Linux Server Language Information
1. To view the host language configuration, type: locale -a
2. View/.vimrc
I didn't dare to change it here, because it might affect the scope. I just found the article in CSDN.
This is not very clear, the answer given online is:
https://blog.csdn.net/u010189459/article/details/38338735
In vimrc encoding can do these settings at the same time:
set encoding=utf-8 set langmenu=zh_CN.UTF-8 language message zh_CN.UTF-8
V. Final investigation
Now that Jenkins system settings and host languages have been checked, let's start checking containers.
1. Go inside the Jenkins container
docker exec -it Container ID /bin/bash
View Language
then enter
export LC_ALL="C.UTF-8"
Write at the end of/etc/bash.bashrc, then source /etc/bash.bashrc and find that there is no vim, so forget it.
lc_all actually assigns values to all the variables above, the effect is the same, but it doesn't matter if you try it. Generally speaking, docker itself has a complete operating system, which has nothing to do with the host machine.
2. Go to Chrome container
set LC_ALL="C.UTF-8"
3. Then Jenkins system settings modify the global properties, changing the previous LANG = zh_CN . UTF-8 to LANG = C. UTF-8. The reason is: At present, the servers on the market are basically occupied by centos and debian. Centos relies on redhat, debian comes from the source, centos comes from Red Hat, various patches and services are more perfect, centos also makes more servers, and the automation department I guessed correctly that the host machine where jenkins is located uses the debian system instead of centos, because the locale in debian supports zh_CN. UTF-8. Centos supports C. UTF-8
Finally restart the jenkins service (jenkins address followed by/restart), and then start the task to view the jenkins console log!
Postscript, may be the container inside the need to set the language, jenkins system settings global attribute language LANG = C. UTF-8 has a relationship.
About "Docker environment build Jenkins in the console log when building tasks appear Chinese garbled how to do" This article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.