CN102479084A - Method and device for acquiring log by Android terminal - Google Patents

Method and device for acquiring log by Android terminal Download PDF

Info

Publication number
CN102479084A
CN102479084A CN2010105686902A CN201010568690A CN102479084A CN 102479084 A CN102479084 A CN 102479084A CN 2010105686902 A CN2010105686902 A CN 2010105686902A CN 201010568690 A CN201010568690 A CN 201010568690A CN 102479084 A CN102479084 A CN 102479084A
Authority
CN
China
Prior art keywords
log
record
daily record
log record
daily
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN2010105686902A
Other languages
Chinese (zh)
Inventor
徐铮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN2010105686902A priority Critical patent/CN102479084A/en
Publication of CN102479084A publication Critical patent/CN102479084A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a method and a device for acquiring a log by an Android terminal, and the method and the device are used for solving the problems that software BUG cannot be positioned accurately, the instantaneity is poor and the operation is complicated because the log can be acquired from the terminal only by an adb tool on a personal computer (PC). The method comprises the following steps of: acquiring an object embodiment of a log progress of an Android operating system through an interface function during running, acquiring logs recorded by the log progress by calling a log acquisition function of the object embodiment of the log progress, and displaying and storing the acquired log records through a master progress. The log records generated by a system and/or an application program can be checked and displayed on a terminal, therefore, the technical problem that debugging of the program is performed by virtue of the PC is solved, and the development efficiency is improved.

Description

A kind of Android terminal obtains the method and the device of daily record
Technical field
The present invention relates to Android operating system, relate in particular to a kind of method and device that on the terminal, obtains daily record.
Background technology
In software development process based on Android operating system, if tested software goes wrong, can grasp the terminal software daily record usually and come orientation problem, if there is not daily record, some stochastic problems are difficult to search.Yet; Want the intercepting daily record, must be to computer with the drive installation of Android mobile phone, and need Android SDK; Start the cmd terminal of windows; Switch under the tools catalogue of SDK, use debugging bridge (Android Debug Bridge, adb) order of the logcat in instrument intercepting on the PC terminal.Use this method, mobile phone terminal must connect computer, and the sdk environment of Android will be arranged on the computer, is not having under the situation of computer, can't the intercepting daily record.
Most bug that occur at random occur careless, and very difficult in order to last method intercepting daily record, the developer can't locate again in this case, and therefore, software product is being with BUG to reach the standard grade through regular meeting, thereby causes bad influence.
Summary of the invention
In view of this; Fundamental purpose of the present invention is to provide a kind of Android terminal to obtain the method and the device of daily record; Be used to solve and must obtain the daily record on the terminal through the adb instrument on the PC, inaccurate to software BUG location, real-time is poor, the problem of complex operation.
For achieving the above object, technical scheme of the present invention is achieved in that
A kind of Android terminal obtains the method for daily record, and this method comprises:
Through when operation interface function obtain the object instance of the daily record process that Android operating system carries;
Obtain said daily record process recorded logs through the log acquisition function that calls said daily record process object instance.
Further, said method is specially:
Obtain process through the host process starting log, said log acquisition process through when operation interface function obtain the object instance of the daily record process that Android operating system carries;
The log acquisition function that said log acquisition process is at first called said daily record process object obtains all log records that said daily record process has generated, and sends the log record that obtains to said host process;
After said log acquisition process is obtained the log record of having preserved, monitor said daily record process in real time and whether generate new log record, when new log record produces, send the log record that newly produces to said host process.
Further, said method also comprises:
Said log record is filtered, judge whether comprise specified services and/or key in application word in every log record,, otherwise abandon this log record if comprise then obtain this log record.
Further, after said host process was receiving said log record, said method also comprised:
Show said log record, said log record is stored on the storage card through menucommand.
Further, the daily record process that carries of described Android operating system is the logcat process.
Based on said method, the present invention also proposes a kind of Android terminal and obtains the device of daily record, and this device comprises:
Log acquisition process module, be used for through when operation interface function obtain the object instance of the daily record process that Android operating system carries, and obtain said daily record process recorded logs through the log acquisition function that calls said daily record process object instance;
The host process module is used to start said log acquisition process module, receives the log record that said log acquisition process module transmits.
Further, the log acquisition function that said log acquisition process module is at first called said daily record process object obtains all log records that said daily record process has generated, and sends the log record that obtains to said host process module;
Said log acquisition process module also is used for monitoring in real time said daily record process and whether generates new log record, when new log record produces, sends the log record that newly produces to said host process module.
Further, said log acquisition process module also is used for the log record that obtains is filtered, and judges whether comprise specified services and/or key in application word in every log record, if comprise then keep this log record, otherwise abandons this log record; Send the log record that filters out to said host process module at last.
Further, also be used to show said log record, and provide menucommand to store said log record in said host process module.
The present invention through when operation interface function obtain the object instance of the daily record process that Android operating system carries; And obtain said daily record process recorded logs through the log acquisition function that calls said daily record process object instance, after obtaining log record, show and store through host process.The present invention can realize checking of log record that system and/or application program produce and show that the technical matters that need carry out program debug by PC of solution has improved development efficiency on the terminal.
Description of drawings
Fig. 1 obtains the method flow diagram of daily record for the present invention;
Fig. 2 obtains the device process flow diagram of daily record for the present invention.
Embodiment
For making the object of the invention, technical scheme and advantage clearer, below lift embodiment and with reference to accompanying drawing, to further explain of the present invention.
Fig. 1 is the method flow diagram that on the terminal, obtains daily record provided by the invention, and this method comprises:
Step 100, obtain the object instance of the daily record process (logcat) that Android operating system carries;
Interface (Runtime) obtains the object instance of the daily record process that Android operating system carries during operation that the log acquisition process provides through Android operating system; It is the logcat object instance; The logcat process is a system process, is used for obtaining in real time operating system and application log information.
The method instance that obtains said logcat object instance is following:
Runtime.getRuntime().exec(“logcat”)
Step 102, after getting access to the logcat object instance, the member function through the logcat object obtains the log record that system has produced;
Can obtain log information through the member function GetInputStream () that obtains inlet flow of logcat object;
Step 104, log acquisition process are filtered the log information that gets access to, and obtain the log record of specified services and/or application, send host process to;
The method of filtering can adopt following method: the log information that obtains is input in the tabulation class; Search function through the tabulation class judges whether comprise specified services and/or key in application word in every log record; If comprise then obtain this log record, otherwise abandon this log record.
Step 106, host process show log obtain the log record that process transmits, and can preserve the log record that obtains through the menucommand that provides for the user.
Preferably, the method for the invention also comprises the steps:
Whether step 108, said log acquisition the process said logcat process of monitoring in real time produce new log record; If produce new log record; Then it is filtered; If the log record of said new generation satisfies filtercondition, the log record that then will newly produce is real-time transmitted to host process, and host process shows after receiving the log record of new generation in real time.
In order to realize above-mentioned method embodiment, other embodiment of the present invention also provide a kind of Android terminal to obtain the device of daily record, and are as shown in Figure 2.What need at first explanation is; Because following embodiment is for realizing aforesaid method embodiment; So the module in this base station controller all is to establish for each step that realizes preceding method; But the present invention is not limited to following embodiment, and any device of said method and module of realizing all should be contained in protection scope of the present invention.And in the following description, the content identical with preceding method omitted at this, to practice thrift length.
This device comprises the host process module 210 and log acquisition process module 200 based on Android framework (Framework) exploitation;
Said log acquisition module 200, be used for through when operation interface function obtain the object instance of the daily record process that Android operating system carries, and obtain said daily record process recorded logs through the log acquisition function that calls said daily record process object instance;
Host process module 210 is used to start said log acquisition process module 200, receives the log record that said log acquisition process module 200 transmits, and also is used to show said log record, and provide menucommand to be used to store said log record.
Said log acquisition module 200 further comprises acquiring unit 201 and filter element 202;
Said acquiring unit 201 comprises two parts function, and the log acquisition function that at first calls said daily record process object obtains all log records that said daily record process has generated; And then the member function through said daily record process object, monitor said daily record process in real time and whether generate new log record, when new log record produces, obtain the log record of new generation.
Said filter element 202 is used for the log record that obtains is filtered, and judges whether comprise specified services and/or key in application word in every log record, if comprise then keep this log record, otherwise abandons this log record; Send the log record that filters out to said host process module at last.
It is understandable that; Different implementations based on program; Process of the present invention also can be equal to thread or little thread in some cases; The present invention does not limit the concrete implementation of program module according to the invention, can all should belong to protection scope of the present invention for the embodiment that accomplishes program module according to the invention institute defined function.
The above is merely preferred embodiment of the present invention, is not to be used to limit protection scope of the present invention.

Claims (10)

1. an Android terminal obtains the method for daily record, it is characterized in that, this method comprises:
Through when operation interface function obtain the object instance of the daily record process that Android operating system carries;
Obtain said daily record process recorded logs through the log acquisition function that calls said daily record process object instance.
2. method according to claim 1 is characterized in that, said method is specially:
Obtain process through the host process starting log, said log acquisition process through when operation interface function obtain the object instance of the daily record process that Android operating system carries;
The log acquisition function that said log acquisition process is at first called said daily record process object obtains all log records that said daily record process has generated, and sends the log record that obtains to said host process;
After said log acquisition process is obtained the log record of having preserved, monitor said daily record process in real time and whether generate new log record, when new log record produces, send the log record that newly produces to said host process.
3. method according to claim 2 is characterized in that, this method also comprises:
Said log record is filtered, judge whether comprise specified services and/or key in application word in every log record,, otherwise abandon this log record if comprise then obtain this log record.
4. method according to claim 3 is characterized in that, after said host process was receiving said log record, said method also comprised:
Show said log record, said log record is stored on the storage card through menucommand.
5. method according to claim 1 is characterized in that, the daily record process that described Android operating system carries is the logcat process.
6. an Android terminal obtains the device of daily record, it is characterized in that, this device comprises:
Log acquisition process module, be used for through when operation interface function obtain the object instance of the daily record process that Android operating system carries, and obtain said daily record process recorded logs through the log acquisition function that calls said daily record process object instance;
The host process module is used to start said log acquisition process module, receives the log record that said log acquisition process module transmits.
7. device according to claim 6 is characterized in that,
The log acquisition function that said log acquisition process module is at first called said daily record process object obtains all log records that said daily record process has generated, and sends the log record that obtains to said host process module;
Said log acquisition process module also is used for monitoring in real time said daily record process and whether generates new log record, when new log record produces, sends the log record that newly produces to said host process module.
8. device according to claim 6; It is characterized in that; Said log acquisition process module also is used for the log record that obtains is filtered; Judge whether comprise specified services and/or key in application word in every log record,, otherwise abandon this log record if comprise then keep this log record; Send the log record that filters out to said host process module at last.
9. device according to claim 8 is characterized in that, also is used to show said log record in said host process module, and provides menucommand to store said log record.
10. device according to claim 6 is characterized in that, the daily record process that described Android operating system carries is the logcat process.
CN2010105686902A 2010-11-26 2010-11-26 Method and device for acquiring log by Android terminal Pending CN102479084A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2010105686902A CN102479084A (en) 2010-11-26 2010-11-26 Method and device for acquiring log by Android terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2010105686902A CN102479084A (en) 2010-11-26 2010-11-26 Method and device for acquiring log by Android terminal

Publications (1)

Publication Number Publication Date
CN102479084A true CN102479084A (en) 2012-05-30

Family

ID=46091739

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2010105686902A Pending CN102479084A (en) 2010-11-26 2010-11-26 Method and device for acquiring log by Android terminal

Country Status (1)

Country Link
CN (1) CN102479084A (en)

Cited By (26)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103412801A (en) * 2013-08-09 2013-11-27 厦门天锐科技有限公司 Method for file backup based on process identification file
CN103544096A (en) * 2013-10-21 2014-01-29 Tcl集团股份有限公司 Method and system for feeding back information in case of operational failure of Android terminal
CN103902438A (en) * 2012-12-24 2014-07-02 珠海市君天电子科技有限公司 Method and system for generating readable report of APK program behavior
CN103902893A (en) * 2012-12-24 2014-07-02 珠海市君天电子科技有限公司 Method and system for monitoring Android program behavior
CN104021071A (en) * 2013-03-01 2014-09-03 腾讯科技(深圳)有限公司 Method and system for obtaining process lifecycles
CN104426945A (en) * 2013-08-27 2015-03-18 腾讯科技(深圳)有限公司 Method and system for acquiring application performance data, and device
CN104615742A (en) * 2015-02-10 2015-05-13 广东欧珀移动通信有限公司 Multi-media database scanning method and multi-media database scanning device
CN104899129A (en) * 2014-03-06 2015-09-09 腾讯科技(深圳)有限公司 Log recording method and device
CN104965776A (en) * 2015-07-29 2015-10-07 广东欧珀移动通信有限公司 Method and system for viewing logs when mobile terminal is in recovery mode
CN105068797A (en) * 2015-07-24 2015-11-18 深圳市广和通无线股份有限公司 Mobile terminal device and LOG information capture method therefor
CN105224443A (en) * 2015-10-09 2016-01-06 广州视睿电子科技有限公司 Method and device for displaying log information by Android terminal
CN105488119A (en) * 2015-11-23 2016-04-13 小米科技有限责任公司 Process finding method and device
CN105488412A (en) * 2015-06-19 2016-04-13 哈尔滨安天科技股份有限公司 Malicious code detection method and system based on android terminal log
CN105630675A (en) * 2015-12-21 2016-06-01 浪潮集团有限公司 Method for rapidly obtaining and submitting BUG information
CN105677689A (en) * 2015-05-27 2016-06-15 深圳Tcl数字技术有限公司 Log record method and device
CN103716313B (en) * 2013-12-24 2016-07-13 中国科学院信息工程研究所 A kind of user privacy information guard method and system
CN105975387A (en) * 2015-12-09 2016-09-28 乐视移动智能信息技术(北京)有限公司 Method and device for capturing terminal debugging information
CN105988818A (en) * 2015-03-06 2016-10-05 展讯通信(天津)有限公司 Bug automatic debugging system and method
CN106569948A (en) * 2016-10-26 2017-04-19 北京小鸟看看科技有限公司 Method and device for grabbing debugging information of Android equipment
CN106951777A (en) * 2017-03-06 2017-07-14 西安电子科技大学 The estimating method of user interface during Android application operation
CN107066374A (en) * 2017-03-20 2017-08-18 广东欧珀移动通信有限公司 A kind of data processing method and mobile terminal
CN107145341A (en) * 2017-03-31 2017-09-08 武汉斗鱼网络科技有限公司 A kind of method and device that print log function is added in Flash
CN108021491A (en) * 2017-12-28 2018-05-11 宇龙计算机通信科技(深圳)有限公司 Terminal daily record grasping means, device and terminal log analysis method, device
CN110427297A (en) * 2019-07-10 2019-11-08 西门子工厂自动化工程有限公司 Diagnostic message acquisition methods, system and gateway and computer-readable medium
CN110457174A (en) * 2019-05-24 2019-11-15 深圳市金泰克半导体有限公司 Blog management method, device, electronic equipment and storage medium
CN114036117A (en) * 2021-11-15 2022-02-11 平安普惠企业管理有限公司 Log viewing method and device, computer equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1642104A (en) * 2004-01-05 2005-07-20 华为技术有限公司 Method and device for realizing system journal
US20090125557A1 (en) * 2007-11-13 2009-05-14 Kabushiki Kaisha Toshiba Log recording apparatus
CN101753971A (en) * 2008-12-22 2010-06-23 中兴通讯股份有限公司 Journal system and journal recording method in content management system in uniform video management platform

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1642104A (en) * 2004-01-05 2005-07-20 华为技术有限公司 Method and device for realizing system journal
US20090125557A1 (en) * 2007-11-13 2009-05-14 Kabushiki Kaisha Toshiba Log recording apparatus
CN101753971A (en) * 2008-12-22 2010-06-23 中兴通讯股份有限公司 Journal system and journal recording method in content management system in uniform video management platform

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
SHANECONDER: "《Android移动应用开发从入门到精通》", 31 July 2010, article "《Android移动应用开发从入门到精通》", pages: 448-450 *

Cited By (34)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103902893A (en) * 2012-12-24 2014-07-02 珠海市君天电子科技有限公司 Method and system for monitoring Android program behavior
CN103902438A (en) * 2012-12-24 2014-07-02 珠海市君天电子科技有限公司 Method and system for generating readable report of APK program behavior
CN104021071A (en) * 2013-03-01 2014-09-03 腾讯科技(深圳)有限公司 Method and system for obtaining process lifecycles
CN103412801A (en) * 2013-08-09 2013-11-27 厦门天锐科技有限公司 Method for file backup based on process identification file
CN103412801B (en) * 2013-08-09 2016-08-10 厦门天锐科技股份有限公司 The method carrying out file backup based on progress recognizing file
CN104426945B (en) * 2013-08-27 2019-08-13 腾讯科技(深圳)有限公司 A kind of method, apparatus and system obtaining application performance data
CN104426945A (en) * 2013-08-27 2015-03-18 腾讯科技(深圳)有限公司 Method and system for acquiring application performance data, and device
CN103544096A (en) * 2013-10-21 2014-01-29 Tcl集团股份有限公司 Method and system for feeding back information in case of operational failure of Android terminal
CN103716313B (en) * 2013-12-24 2016-07-13 中国科学院信息工程研究所 A kind of user privacy information guard method and system
CN104899129A (en) * 2014-03-06 2015-09-09 腾讯科技(深圳)有限公司 Log recording method and device
CN104615742B (en) * 2015-02-10 2017-11-21 广东欧珀移动通信有限公司 Multimedia database scan method and device
CN104615742A (en) * 2015-02-10 2015-05-13 广东欧珀移动通信有限公司 Multi-media database scanning method and multi-media database scanning device
CN105988818B (en) * 2015-03-06 2020-02-04 展讯通信(天津)有限公司 Automatic bug debugging system and method
CN105988818A (en) * 2015-03-06 2016-10-05 展讯通信(天津)有限公司 Bug automatic debugging system and method
CN105677689A (en) * 2015-05-27 2016-06-15 深圳Tcl数字技术有限公司 Log record method and device
CN105488412A (en) * 2015-06-19 2016-04-13 哈尔滨安天科技股份有限公司 Malicious code detection method and system based on android terminal log
CN105068797A (en) * 2015-07-24 2015-11-18 深圳市广和通无线股份有限公司 Mobile terminal device and LOG information capture method therefor
CN104965776A (en) * 2015-07-29 2015-10-07 广东欧珀移动通信有限公司 Method and system for viewing logs when mobile terminal is in recovery mode
CN104965776B (en) * 2015-07-29 2018-03-09 广东欧珀移动通信有限公司 Mobile terminal checks the method and system of daily record in recovery mode
CN105224443A (en) * 2015-10-09 2016-01-06 广州视睿电子科技有限公司 Method and device for displaying log information by Android terminal
CN105488119A (en) * 2015-11-23 2016-04-13 小米科技有限责任公司 Process finding method and device
CN105975387A (en) * 2015-12-09 2016-09-28 乐视移动智能信息技术(北京)有限公司 Method and device for capturing terminal debugging information
CN105630675A (en) * 2015-12-21 2016-06-01 浪潮集团有限公司 Method for rapidly obtaining and submitting BUG information
CN106569948A (en) * 2016-10-26 2017-04-19 北京小鸟看看科技有限公司 Method and device for grabbing debugging information of Android equipment
CN106951777B (en) * 2017-03-06 2019-07-23 西安电子科技大学 The estimating method of user interface when Android application operation
CN106951777A (en) * 2017-03-06 2017-07-14 西安电子科技大学 The estimating method of user interface during Android application operation
CN107066374A (en) * 2017-03-20 2017-08-18 广东欧珀移动通信有限公司 A kind of data processing method and mobile terminal
CN107066374B (en) * 2017-03-20 2020-07-10 Oppo广东移动通信有限公司 Data processing method and mobile terminal
CN107145341A (en) * 2017-03-31 2017-09-08 武汉斗鱼网络科技有限公司 A kind of method and device that print log function is added in Flash
CN108021491A (en) * 2017-12-28 2018-05-11 宇龙计算机通信科技(深圳)有限公司 Terminal daily record grasping means, device and terminal log analysis method, device
CN110457174A (en) * 2019-05-24 2019-11-15 深圳市金泰克半导体有限公司 Blog management method, device, electronic equipment and storage medium
CN110427297A (en) * 2019-07-10 2019-11-08 西门子工厂自动化工程有限公司 Diagnostic message acquisition methods, system and gateway and computer-readable medium
CN110427297B (en) * 2019-07-10 2023-08-04 西门子工厂自动化工程有限公司 Diagnostic information acquisition method, system, gateway and computer readable medium
CN114036117A (en) * 2021-11-15 2022-02-11 平安普惠企业管理有限公司 Log viewing method and device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN102479084A (en) Method and device for acquiring log by Android terminal
CN107273280B (en) Log processing method and device, electronic equipment and storage medium
CN108255729B (en) Mobile phone game automatic testing method and system based on Unity platform
CN103186740B (en) A kind of automated detection method of Android malware
CN103744824B (en) One is dispatched from the factory method of testing and test system
CN103631707B (en) A kind of method and device for obtaining code coverage
CN102419727A (en) Automatic test method and device
CN103049371A (en) Testing method and testing device of Android application programs
CN104156275A (en) Method and device for exception handling of Android platform
CN103246586B (en) Method for utilizing USB (universal serial bus) storage equipment for ADB (android debug bridge) debugging on android platform
CN110347085B (en) Automated test system, method, vehicle, and computer-readable medium
CN106649107B (en) Automatic testing method and device for stability of android system
CN105338110A (en) Remote debugging method, platform and server
CN104407980A (en) Mobile application automated testing device and method
CN103577313A (en) Mobile terminal application program testing method and device
US10860465B2 (en) Automatically rerunning test executions
CN105607986A (en) Acquisition method and device of user behavior log data
CN104426945B (en) A kind of method, apparatus and system obtaining application performance data
CN104503912A (en) Monitoring method and device for service responding process
CN110597704B (en) Pressure test method, device, server and medium for application program
CN107102928A (en) Application crash information reporting method and device
CN102799522A (en) Managing method and system for software version tracing test
CN105574416A (en) Detection method and device of browser bug
CN111930703A (en) Automatic log file capturing method and device and computer equipment
CN108446224B (en) Performance analysis method of application program on mobile terminal and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20120530