lately Android,IOS More automation, better group control , however Appium Medium log Display Chinese garbled problem like a fly , It's very hard to watch , lingering , Redress the injustice . The forum searched , Many posts have reflected this problem , But they didn't give a solution . I don't know these little Whether the partner has solved the problem in the end . So it was decided , Have a hairy crab , Study to see if it can be solved .

important clause

This article only aims at solving Jenkins After the integration Appium Of log Garbled Chinese in the log . The desktop version itself 1.8.1 There is no garbled code in the version , Such as the messy code of your desktop version , I can't solve it either 了 . In addition, command execution is limited by the machine , Environmental Science , development language , Executive posture and so on , If reference to this post does not solve your problem , I sincerely apologize to you . Failed to end your garbled problem , The bull is blowing big .

Engineering code coding settings

  • Set your own project code character code to UTF-8
  • Set up Maven Package compilation jar The code of is UTF-8

Jenkins Environment variable Settings

In a word : After the administrator login , Set global properties LANG :zh.CH.UTF-8
Set location :【 System management 】--->【 System settings 】--->【 Global properties 】


Java Start parameter settings

Set up java Environment variables for execution , That is to say, execute as follows testng Set a coded parameter when
java -Dfile.encoding=UTF-8 -classpath /Users/iosTest.jar org.testng.TestNG /Users/mytestng.xml

If after the above steps , Your log Chinese is not garbled , The following can be ignored .

Appium Of log Acquisition and processing

Because we have to order Appium service , Write a java call CMD perhaps shell The common class of . When executing an order , The output command returns log That is to say Appium Service log information . Set the code when you accept the command and execute the output :UTF-8.
Don't talk nonsense , Put it in code. .

* Command actuators
* @author Zhang
public class CommandExecutorImpl implements CommandExecutor { static final Logger logger = LoggerFactory.getLogger(CommandExecutorImpl.class);
static ExecutorService pool = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 3L, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>()); public ExecuteResult executeCommand(long timeout,String ... commands) { Process process = null;
InputStream pIn = null;
StreamManger outputManger = null;
try {
if(commands == null || commands.length == 0){
logger.error(" The executed command line statement cannot be empty !");
return new ExecuteResult(9999," The executed command line statement cannot be empty ");
process = Runtime.getRuntime().exec(commands);
final Process p = process;
p.waitFor(timeout, TimeUnit.MILLISECONDS);
p.getOutputStream().close(); pIn = process.getInputStream();
outputManger = new StreamManger(pIn);
outputManger.start(); return new ExecuteResult(0, " Command executed successfully !"); } catch (Exception ex) {
String errorMessage = " command :" + commands + " Execution failure !";
logger.error(errorMessage, ex);
return new ExecuteResult(-1, null);
} }

I / O stream management controller , There's more to be done here , Free control outputs something , Or not output something .

* I / O stream management
* @author Zhang
public class StreamManger extends Thread {
private static Logger logger = LoggerFactory.getLogger(StreamManger.class);
private InputStream inputStream; /**
* Construction method
* Instantiate the input stream
* @param in Input stream
public StreamManger(final InputStream in) {
this.inputStream = in;
} /**
* Printout
public void run() {
try {
// Set the default encoding to UTF-8
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "UTF-8");
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String line = null;
while ((line = bufferedReader.readLine()) != null) {
logger.debug(line); }
} catch (Exception ex) {
logger.trace(" Printout stream failed :", ex);
} finally {
synchronized (this) {
} }

Log output

Post a picture . Otherwise, it will be solved Jenkins Of appium Garbled Chinese in the log , There are bound to be people who don't believe it .
Android :




appendix appium Command parameter address

The community is great , Translated by this forum Appium Introduction to Chinese parameters on the official website . Chinese parameter introduction portal


Thank the community , Give a lot of spiritual food , Thank you for your selfless dedication . Solutions to problems , It's like ping X My sister's R ditch , It's a bit of a squeeze after all , Come to the forum more , Learn more , Practice more , There will always be solutions .
Share your own solutions to this problem , Just like me low My brothers . The method is quite frustrating , It may not solve your problem , Thank you !

Appium More related articles about the end of the garbled log

  1. log4j Output log garbled ( turn )

    log4j Solutions to the problem of garbled log files log4j How to deal with garbled Chinese in log files log4j Console and file output garbled problem solved Write it at the front , The third article explains the reason most clearly , Why is it set to UTF-8 perhaps GBK It's in effect , ...

  2. solve CentOS7 Chinese garbled ( Include Tomcat The log is jumbled ) problem

    Linux System Chinese language garbled , It's a lot of little friends who are starting to contact Linux The problems we often encounter , And when we will have Wndows The deployed project moved to Linux Up operation ,Tomcat The output log of Chinese is all garbled ( stay Windows It's normal on the Internet ) ...

  3. git Treasure — To deal with daily work, use enough instruction manuals

    Recently the company gitlab Move again , a pile git Command operation of , Ran goose git command , I feel like I have to review —— Actually ,git Now there are many interface operation tools , such as intellij Self contained git It's good to operate plug-ins ,gitlab github ...

  4. 【app】Appium Log file analysis

    Appium When communicating with clients and mobile phones, a lot of logs will be output , You can do this by clicking on the Get Raw Logs Get its original log : Now we save to another path , And take notepad Tools open to view Appium journal ...

  5. Python Simple introduction to North ( Two )

    Python Simple introduction to North ( Two ) 2 function 2.1 Functions are first class citizens First class citizens refer to Python Can be created dynamically , It can be assigned to other variables , Can be passed to a function as a parameter , It can also be used as the return value of a function . To make a long story short , Functions and ordinary variables ...

  6. Python Simple introduction to North ( One )

    Python Simple introduction to North ( One ) Python It's a very easy language to use , By consulting materials and tutorials , Maybe you can write a simple reptile in one night . but Python It's also a difficult language to master , Because there is a lot of black behind the concise grammar ...

  7. Probably more detailed than the documentation --VueRouter Point to the North completely

    Probably more detailed than the documentation --VueRouter Point to the North completely Preface About titles , It should not be the headline party , Because the content is really long and comprehensive . Mainly on the basis of the official website and a detailed summary , There are a lot of examples . Make sure all new people understand ! So actually a lot of things ...

  8. About supervisor The entrance to the North

    About supervisor The entrance to the North At this point in time (2017/07/25),supervisor Or just support python2, So we're going to use version management pyenv To isolate the environment . pyenv According to the official documents , ...

  9. About Gevent The use of North

    About Gevent The use of North Just read the Getting Started Guide , And a translation document . Write about my reading experience . In fact, after watching , The first reaction is asyncio This system library , Feeling gevent Some of the things we're doing now are related to asyncio Much like the , but ...

Random recommendation

  1. Web game (riddle webgame)--H5 The principle and practice of scraping card

    Preface : Before the preparation of a web game ( similar Riddle Game), I hope you can experience my game . Also willing to share the process of writing this web game , Some knowledge learned . For scratch cards , I think everyone is familiar with , I'm also very happy ...

  2. poj1852 Ants —— Thoughts 、 Water problem

    Find the shortest time and the longest time . When two ants meet , It can be seen as two ants passing through , It has no effect on the result .O(N) Complexity c++ edition : #include <cstdio> #define min(a, b) ( ...

  3. 【 turn 】Android 4.2 Introduction to Bluetooth

    Original website :http://blog.csdn.net/innost/article/details/9187199 Tieto The company's Bluetooth giant wrote < The programmer > Contribution article Android 4.2 bluetooth ...

  4. #include &lt;functional&gt;

    1 bind( Reference internal functions , The address of the entity object , Place holder ); 2 bind1st 3 function 1 auto Variable name = bind( Reference internal functions , The address of the entity object , Place holder ); #include ...

  5. About Delphi XE2 Of FMX A little bit of research news

    Delphi XE2 It's been a while , It's more eye-catching , except VCLStyle Besides this skin changing thing , In addition, the most eye-catching should be FMX This thing . In case there are a lot of articles about FMX I've learned a lot from you . I still haven't turned it off much ...

  6. Jenkins+git+gitlab Achieve continuous automatic integrated deployment

    1  Experimental environment Three servers gitlab Jenkins java [root ...

  7. Autowried Notes and Resource The difference between annotations

    Catalog 1. summary 2.Autowried 3.Resource 4. summary 1. summary In the use of Spring Frame the process , Dependency injection is necessary , Most of the time I use Autowried Annotation for dependency injection , But it can also ...

  8. jQuery Gets the... Containing the current element HTML

    1. Get... In the current element HTML (1) Method 1 $("#current").html(); (2) Method 2 document.getElementById("current&q ...

  9. python Built in methods for data types

    python There are six types of data , They are integers . character string . list . Dictionaries . Yuanzu and the collection , These basic data types have many built-in methods , Next, explore one by one . python There are two types of middle integers :int and float 1 int Use dir The function view ...

  10. day4: data structure list

    1, Always enter the user name , Input Q sign out , Pay attention to the user's input and don't forget to add strip, and upper Case insensitive ,list Last to add append li = [] while 1: name = input("& ...