CN112685262A - iOS application program embedded point acquisition method and device based on log - Google Patents

iOS application program embedded point acquisition method and device based on log Download PDF

Info

Publication number
CN112685262A
CN112685262A CN202110007581.1A CN202110007581A CN112685262A CN 112685262 A CN112685262 A CN 112685262A CN 202110007581 A CN202110007581 A CN 202110007581A CN 112685262 A CN112685262 A CN 112685262A
Authority
CN
China
Prior art keywords
log
ios application
class
function
event table
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
CN202110007581.1A
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.)
Shanghai Zhongtongji Network Technology Co Ltd
Original Assignee
Shanghai Zhongtongji Network Technology 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 Shanghai Zhongtongji Network Technology Co Ltd filed Critical Shanghai Zhongtongji Network Technology Co Ltd
Priority to CN202110007581.1A priority Critical patent/CN112685262A/en
Publication of CN112685262A publication Critical patent/CN112685262A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention relates to the relevant technical field of embedded point acquisition, in particular to a log-based iOS application program embedded point acquisition method and device. The log-based iOS application program embedded point acquisition method comprises the following steps: adjusting a log system to ensure that the log character string contains called position information; configuring an acquisition event table; and collecting and recording the logs meeting the conditions according to the configuration of the collection event table. According to the technical scheme, the explicit code embedding point is fused in the log system, so that invasive codes are reduced, maintenance cost is reduced, embedding point requirements can be flexibly met, a more optimal solution of a main service does not need to be abandoned for the embedding point requirements, and the latest characteristic of the iOS platform is exerted.

Description

iOS application program embedded point acquisition method and device based on log
Technical Field
The invention relates to the relevant technical field of embedded point acquisition, in particular to a log-based iOS application program embedded point acquisition method and device.
Background
The existing point burying scheme mainly comprises code point burying, visual point burying and full point burying. And (4) embedding codes, wherein developers manually insert codes of collected events into service function codes, and the codes are invasive embedding points. And (3) visualizing the embedded point, providing all collectable events by developers in an SDK (software development kit) mode, and selecting the required events by service personnel and issuing the selected events to the client for selective collection, wherein the SDK does not invade specific service function codes and is a non-invasive embedded point. And (4) burying points completely, wherein developers collect all events and report all the events, so that the realization principle is the same as that of visual burying points, and the points are also purchased without invasion. Many projects have no or only a few embedded points before being started, and a code embedded point method is generally adopted, and the method is flexible in data acquisition and simple in development. When projects grow up and the demand for embedding points increases, the maintenance cost of code embedding points is higher and higher, and then non-invasive embedding methods such as visualization and full embedding point methods are adopted.
However, the code embedding method requires an explicit method for adding embedded points, and when a new embedded point is added, embedded point codes need to be added, which results in high maintenance cost and strong code intrusion. The visualization buried point and the full buried point are both based on an Objective-C runtime technology, and some common methods of common classes can be book specific to a buried point method, so that the buried point coverage function is limited; and the practical requirements are various, and the non-common classes and methods always succeed, and the complex code logic needs to be written due to the fact that the main service code cannot be invaded, so that the method is far less flexible and convenient than the code embedding point. In addition, using runtime techniques in Swift, it is necessary to inherit from NSObject, which also limits the exertion of the characteristics of Swift language.
Disclosure of Invention
In view of this, a log-based iOS application program embedded point acquisition method and apparatus are provided to solve the problems in the related art.
The invention adopts the following technical scheme:
in a first aspect, an embodiment of the present invention provides an iOS application program embedded point acquisition method based on logs, including:
adjusting a log system to ensure that the log character string contains called position information;
configuring collection event table
And collecting and recording the logs meeting the conditions according to the configuration of the collection event table.
Optionally, the adjusting the log system to ensure that the log character string contains the called location information includes:
for the NSLog method in Objective-C, such that the NSLog comprises __ FUNCTION __, __ LINE;
for the Print function in Swift, the Print is made to contain # file, # function, # line.
Optionally, the configuring the collection event table includes:
the collection event table comprises an OC class and a Swift class; the OC class is defined by a method list taking the class name as a key name; the Swift class is a function list whose file name is a key name.
Optionally, the method further includes:
and outputting the collected information.
In a second aspect, the present application provides a log-based iOS application program embedded point collecting apparatus, comprising:
the adjusting module is used for adjusting the log system and ensuring that the log character string contains the called position information;
a configuration module for configuring the collection event table
And the recording module is used for collecting and recording the logs meeting the conditions according to the configuration of the collection event table.
Optionally, the configuration module is specifically configured to:
for the NSLog method in Objective-C, such that the NSLog comprises __ FUNCTION __, __ LINE;
for the Print function in Swift, the Print is made to contain # file, # function, # line.
Optionally, the configuring the collection event table includes:
the collection event table comprises an OC class and a Swift class; the OC class is defined by a method list taking the class name as a key name; the Swift class is a function list whose file name is a key name.
In a third aspect, the present application provides a log-based iOS application program embedded point collecting device, including:
a processor, and a memory coupled to the processor;
the storage is used for storing a computer program, and the computer program is at least used for executing the journal-based iOS application program embedded point acquisition method provided by the application;
the processor is used for calling and executing the computer program in the memory.
In a fourth aspect, the present application provides a storage medium storing a computer program, which when executed by a processor, implements the steps of the log-based iOS application blob collection method as described in the present application.
In a fifth aspect, the present application provides a computer program product comprising computer program/instructions which, when executed by a processor, implement the steps of the log-based iOS application burdening method as claimed in claims 1-4.
By adopting the technical scheme, the invention carries out embedded point acquisition based on the log system, and has the following advantages compared with code embedded points: for the defect of strong intrusiveness of code buried points, the existing log system is utilized, or the log data is analyzed to acquire the buried point data, so that the intrusiveness can be weakened without increasing explicit acquisition codes. For the defect of high maintenance cost of code embedded points, in the function development stage of the log system, adding logs for a key method is an inertia method, and explicit embedded point codes are not required to be added additionally. The application has the following advantages aiming at visual buried points and full buried points: the visualization embedding point has the defects of limited covering function and low data flexibility, and the method based on the code embedding point does not need worry naturally and can almost add logs randomly to achieve the target. The visual buried point has the defect of limited application in the Swift, and the self-contained print function can run in any Swift entity method, and the acquired point is not required to be in the subclass of NSObject.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a method for collecting a buried point of an iOS application based on a log according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for collecting a buried point of an iOS application based on a log according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an iOS application fixed-point acquisition apparatus based on a log according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a log-based iOS application fixed-point acquisition device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without any inventive step, are within the scope of the present invention.
Firstly, an application scenario of the embodiment of the present invention is explained, and an existing point burying scheme mainly includes a code point burying, a visual point burying and a full point burying. And (4) embedding codes, wherein developers manually insert codes of collected events into service function codes, and the codes are invasive embedding points. And (3) visualizing the embedded point, providing all collectable events by developers in an SDK (software development kit) mode, and selecting the required events by service personnel and issuing the selected events to the client for selective collection, wherein the SDK does not invade specific service function codes and is a non-invasive embedded point. And (4) burying points completely, wherein developers collect all events and report all the events, so that the realization principle is the same as that of visual burying points, and the points are also purchased without invasion. Many projects have no or only a few embedded points before being started, and a code embedded point method is generally adopted, and the method is flexible in data acquisition and simple in development. When projects grow up and the demand for embedding points increases, the maintenance cost of code embedding points is higher and higher, and then non-invasive embedding methods such as visualization and full embedding point methods are adopted. However, the code embedding method requires an explicit method for adding embedded points, and when a new embedded point is added, embedded point codes need to be added, which results in high maintenance cost and strong code intrusion. The visualization buried point and the full buried point are both based on an Objective-C runtime technology, and some common methods of common classes can be book specific to a buried point method, so that the buried point coverage function is limited; and the practical requirements are various, and the non-common classes and methods always succeed, and the complex code logic needs to be written due to the fact that the main service code cannot be invaded, so that the method is far less flexible and convenient than the code embedding point. In addition, using runtime techniques in Swift, it is necessary to inherit from NSObject, which also limits the exertion of the characteristics of Swift language. The present application proposes a corresponding solution to the above-mentioned problem.
Examples
Fig. 1 is a flowchart of an iOS application point burying collection method based on logs according to an embodiment of the present invention, and fig. 2 is a flowchart of an iOS application point burying collection method based on logs according to an embodiment of the present invention; the method can be executed by the journal-based iOS application program buried point acquisition equipment provided by the embodiment of the invention. Referring to fig. 1 and 2, the method may specifically include the following steps:
s101, adjusting a log system, and ensuring that a log character string contains called position information;
for the NSLog method in Objective-C and the Print FUNCTION in Swift, respectively, it is ensured that the log string contains the called location information, such as that NSLog contains __ FUNCTION __, __ LINE _, and Print contains # file, # FUNCTION, # LINE; reference is made to the following table:
__FUNCTION__ __LINE_ parameter information 1 Parameter information 2
NSLog format
#file #function #line Parameter information 1 Parameter information 2
print format
S102, configuring an acquisition event table;
for the logs entering the log system, analyzing required acquisition points according to the configuration in a configuration table, wherein the configuration table is a configuration point list and comprises 2 types, an OC type and a Swift type; the OC class is defined as a list of methods with class names as key names. The Swift class is a function list whose file name is a key name.
Class name 1
Name of method 1 Reporting event name 1
Method name 2 Reporting event name 2
NSLog configuration Table
Filename 1
Function name 1 Reporting event name 1
Function name 2 Reporting event name 2
print configuration table
And S103, collecting and recording the logs meeting the conditions according to the configuration of the collection event table.
The scheme provided by the application further comprises: and outputting the collected information.
By adopting the technical scheme, the invention carries out embedded point acquisition based on the log system, and has the following advantages compared with code embedded points: for the defect of strong intrusiveness of code buried points, the existing log system is utilized, or the log data is analyzed to acquire the buried point data, so that the intrusiveness can be weakened without increasing explicit acquisition codes. For the defect of high maintenance cost of code embedded points, in the function development stage of the log system, adding logs for a key method is an inertia method, and explicit embedded point codes are not required to be added additionally. The application has the following advantages aiming at visual buried points and full buried points: the visualization embedding point has the defects of limited covering function and low data flexibility, and the method based on the code embedding point does not need worry naturally and can almost add logs randomly to achieve the target. The visual buried point has the defect of limited application in the Swift, and the self-contained print function can run in any Swift entity method, and the acquired point is not required to be in the subclass of NSObject.
According to the technical scheme, the explicit code embedding point is fused in the log system, so that invasive codes are reduced, maintenance cost is reduced, embedding point requirements can be flexibly met, a more optimal solution of a main service does not need to be abandoned for the embedding point requirements, and the latest characteristic of the iOS platform is exerted.
Fig. 3 is a schematic structural diagram of an iOS application fixed-point acquisition apparatus based on a log according to an embodiment of the present invention; referring to fig. 3, the journal-based iOS application program embedded point collecting apparatus provided by the present application includes:
the adjusting module 31 is configured to adjust the log system to ensure that the log character string contains the called location information;
a configuration module 32 for configuring the collection event table
And a recording module 33, configured to collect and record logs meeting the conditions according to the configuration of the collection event table.
Further, the configuration module is specifically configured to:
for the NSLog method in Objective-C, such that the NSLog comprises __ FUNCTION __, __ LINE;
for the Print function in Swift, the Print is made to contain # file, # function, # line.
Further, the configuring the collection event table includes:
the collection event table comprises an OC class and a Swift class; the OC class is defined by a method list taking the class name as a key name; the Swift class is a function list whose file name is a key name.
Fig. 4 is a schematic structural diagram of a log-based iOS application fixed-point acquisition device according to an embodiment of the present invention. Referring to fig. 4, the journal-based iOS application program embedded point collecting device provided by the present application includes:
a processor 41, and a memory 42 connected to the processor 41;
the memory 41 is used for storing a computer program, and the computer program is at least used for executing the journal-based iOS application program embedded point acquisition method provided by the present application;
the processor is used for calling and executing the computer program in the memory.
A storage medium storing a computer program which, when executed by a processor, implements the steps of the log-based iOS application blob collection method as provided herein.
A computer program product comprising computer program/instructions, characterized in that the computer program/instructions, when executed by a processor, implement the steps of the log-based iOS application burdening method as provided herein.
It is understood that the same or similar parts in the above embodiments may be mutually referred to, and the same or similar parts in other embodiments may be referred to for the content which is not described in detail in some embodiments.
It should be noted that the terms "first," "second," and the like in the description of the present invention are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Further, in the description of the present invention, the meaning of "a plurality" means at least two unless otherwise specified.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (10)

1. A log-based iOS application program embedded point acquisition method is characterized by comprising the following steps:
adjusting a log system to ensure that the log character string contains called position information;
configuring an acquisition event table;
and collecting and recording the logs meeting the conditions according to the configuration of the collection event table.
2. The log-based iOS application pivot collection method of claim 1, wherein said adjusting the log system to ensure that the log string contains the location information of the call comprises:
for the NSLog method in Objective-C, such that the NSLog comprises __ FUNCTION __, __ LINE;
for the Print function in Swift, the Print is made to contain # file, # function, # line.
3. The log-based iOS application site collection method of claim 1, wherein the configuring a collection event table comprises:
the collection event table comprises an OC class and a Swift class; the OC class is defined by a method list taking the class name as a key name; the Swift class is a function list whose file name is a key name.
4. The log-based iOS application site-specific collection method of claim 1, further comprising:
and outputting the collected information.
5. An iOS application program embedded point acquisition device based on logs is characterized by comprising:
the adjusting module is used for adjusting the log system and ensuring that the log character string contains the called position information;
a configuration module for configuring the collection event table
And the recording module is used for collecting and recording the logs meeting the conditions according to the configuration of the collection event table.
6. The log-based iOS application fixed-point acquisition apparatus of claim 5, wherein the configuration module is specifically configured to:
for the NSLog method in Objective-C, such that the NSLog comprises __ FUNCTION __, __ LINE;
for the Print function in Swift, the Print is made to contain # file, # function, # line.
7. The log-based iOS application site acquisition apparatus of claim 5, wherein the configuration acquisition event table comprises:
the collection event table comprises an OC class and a Swift class; the OC class is defined by a method list taking the class name as a key name; the Swift class is a function list whose file name is a key name.
8. An iOS application point-embedded log-based acquisition device, comprising:
a processor, and a memory coupled to the processor;
the memory for storing a computer program for at least performing the log-based iOS application site collection method of any of claims 1-4;
the processor is used for calling and executing the computer program in the memory.
9. A storage medium storing a computer program which, when executed by a processor, performs the steps of the log-based iOS application burdening method as claimed in any of claims 1-4.
10. A computer program product comprising computer program/instructions, characterized in that the computer program/instructions, when executed by a processor, implement the steps of the log-based iOS application burdening method as claimed in claims 1-4.
CN202110007581.1A 2021-01-05 2021-01-05 iOS application program embedded point acquisition method and device based on log Pending CN112685262A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110007581.1A CN112685262A (en) 2021-01-05 2021-01-05 iOS application program embedded point acquisition method and device based on log

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110007581.1A CN112685262A (en) 2021-01-05 2021-01-05 iOS application program embedded point acquisition method and device based on log

Publications (1)

Publication Number Publication Date
CN112685262A true CN112685262A (en) 2021-04-20

Family

ID=75457155

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110007581.1A Pending CN112685262A (en) 2021-01-05 2021-01-05 iOS application program embedded point acquisition method and device based on log

Country Status (1)

Country Link
CN (1) CN112685262A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115883647A (en) * 2022-11-29 2023-03-31 京东科技信息技术有限公司 Service log recording method, system, device, terminal, server and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170109380A1 (en) * 2015-10-16 2017-04-20 Microsoft Technology Licensing, Llc Telemetry request system
CN107436832A (en) * 2016-05-27 2017-12-05 阿里巴巴集团控股有限公司 A kind of dynamic buries method, apparatus and electronic equipment a little
CN109491921A (en) * 2018-11-29 2019-03-19 携程旅游网络技术(上海)有限公司 Bury the management method and system of information
CN110489699A (en) * 2019-08-16 2019-11-22 南京云帐房网络科技有限公司 A kind of asynchronous data collection method and system
CN111813655A (en) * 2020-06-02 2020-10-23 广州多益网络股份有限公司 Embedded point testing method and device, embedded point management system and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170109380A1 (en) * 2015-10-16 2017-04-20 Microsoft Technology Licensing, Llc Telemetry request system
CN107436832A (en) * 2016-05-27 2017-12-05 阿里巴巴集团控股有限公司 A kind of dynamic buries method, apparatus and electronic equipment a little
CN109491921A (en) * 2018-11-29 2019-03-19 携程旅游网络技术(上海)有限公司 Bury the management method and system of information
CN110489699A (en) * 2019-08-16 2019-11-22 南京云帐房网络科技有限公司 A kind of asynchronous data collection method and system
CN111813655A (en) * 2020-06-02 2020-10-23 广州多益网络股份有限公司 Embedded point testing method and device, embedded point management system and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115883647A (en) * 2022-11-29 2023-03-31 京东科技信息技术有限公司 Service log recording method, system, device, terminal, server and medium

Similar Documents

Publication Publication Date Title
CN107729210B (en) Distributed service cluster abnormity diagnosis method and device
US9262260B2 (en) Information processing apparatus, information processing method, and recording medium
US6892236B1 (en) System and method of generating computer system performance reports
US8332503B2 (en) Message abnormality automatic detection device, method and program
CN109388791B (en) Dynamic diagram display method and device, computer equipment and storage medium
US7237232B2 (en) Method and system for recording program information in the event of a failure
CN109471862B (en) Data processing method and device, electronic equipment and storage medium
CN115576974B (en) Data processing method, device, equipment and medium
CN111581170A (en) Distributed intelligent data acquisition method, device, equipment and storage medium
CN112685262A (en) iOS application program embedded point acquisition method and device based on log
CN112989433A (en) Verification method based on Java Bean verification rule and related equipment
CN110515758B (en) Fault positioning method and device, computer equipment and storage medium
CN114915643A (en) Configuration method, device, equipment and medium of railway signal centralized monitoring system
CN109493928B (en) Patient data screening method, system, equipment and storage medium based on condition tree
CN110554929B (en) Data verification method, device, computer equipment and storage medium
CN115455059A (en) Method, device and related medium for analyzing user behavior based on underlying data
CN110471730A (en) Methods of exhibiting, system, big screen system and medium based on Echarts
CN116010244A (en) Automatic test method, device, electronic equipment and storage medium
CN111857670B (en) Application architecture determining method and device
CN110209554B (en) Database log distribution method, device and equipment
US7603376B1 (en) File and folder scanning method and apparatus
CN113419739B (en) Node map difference detection method and device, electronic equipment and storage medium
WO2019136914A1 (en) Method for automatically recording field change, application server and computer-readable storage medium
CN112699011A (en) Method and device for counting incremental code coverage rate, electronic equipment and storage medium
CN113127056B (en) Information processing method, device, equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination