CN107463485A - Journal obtaining method, device and terminal based on method stack - Google Patents
Journal obtaining method, device and terminal based on method stack Download PDFInfo
- Publication number
- CN107463485A CN107463485A CN201710496952.0A CN201710496952A CN107463485A CN 107463485 A CN107463485 A CN 107463485A CN 201710496952 A CN201710496952 A CN 201710496952A CN 107463485 A CN107463485 A CN 107463485A
- Authority
- CN
- China
- Prior art keywords
- parameter
- target information
- daily record
- output
- program
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/34—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
- G06F11/3466—Performance evaluation by tracing or monitoring
- G06F11/3471—Address tracing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
- G06F11/3636—Software debugging by tracing the execution of the program
Abstract
The invention provides a kind of journal obtaining method based on method stack, device and terminal.The journal obtaining method based on method stack of the present invention includes:Obtain at least one parameter in the program statement of daily record to be output;Line number of the title and program statement of the Java files where predeterminated position acquisition program statement in method stack corresponding with application program in Java files;According to each parameter in the program statement of the daily record to be output of acquisition, obtain including the target information of each parameter;According to target information, the title and line number of Java files, target journaling corresponding with program statement is obtained.The journal obtaining method based on method stack, device and the terminal of the present invention, the speed that user searches program statement corresponding with daily record is improved, so as to improve the speed for searching code wrong in source code.
Description
Technical field
The present invention relates to software engineering technology, more particularly to a kind of journal obtaining method based on method stack, device and end
End.
Background technology
With the rapid development that mobile phone is applied, the function of application program of mobile phone (Application, abbreviation APP) constantly increases
Add, Android Android projects are increasing, while APP developer increases year by year.Therefore, development efficiency increasingly into
For one it is very important the problem of.Wherein, daily record Log extremely important a kind of Debugging message for developer, for
Every program statement of application source code can export a daily record, and therefore, parameter in daily record finds source
Exploitation of the problem of code for application program has great importance.
When obtaining daily record in the prior art, by setting different marks to different Java files, the mark occurs
In the content of the daily record of output, the Java texts belonging to program statement that can quickly know that the daily record is directed to by checking daily record
Part.But to the content according to the daily record, it is necessary to which user is according in daily record when searching the program statement that the daily record is directed to
Parameter, MS manual search searches the program statement in Java files corresponding with the mark in daily record;And the above method needs
When daily record exports, increase a unique mark for each Java files, process is cumbersome.Therefore, according to of the prior art
When method obtains daily record, when searching program statement corresponding to the daily record, process is cumbersome, and search efficiency is low, have impact on development efficiency.
Invention information
The present invention provides a kind of journal obtaining method based on method stack, device and terminal, to overcome according to prior art
In daily record when searching the targeted program statement of daily record, the technical problem that process is cumbersome and efficiency is low.
The present invention provides a kind of journal obtaining method based on method stack, including:
Obtain at least one parameter in the program statement of daily record to be output;
Java files where the predeterminated position of method stack corresponding with the application program obtains described program sentence
Line number in the Java files of title and described program sentence;
According to each parameter, obtain including the target information of each parameter;
According to the target information, the title of the Java files and the line number, obtain and the daily record to be output
Target journaling corresponding to program statement.
Method as described above, after at least one parameter in the program statement for obtaining daily record to be output, in addition to:
Each parameter is stored into the internal memory of terminal.
Method as described above, it is described according at least one parameter, target information is obtained, including:
Each parameter of object splicing is built by creating a character string, the target comprising each parameter is obtained and believes
Breath.
Method as described above, each parameter of object splicing is built by creating a character string, obtains including each institute
The target information of parameter is stated, including:
Create character string structure object;
It regard the first parameter as the 1st by character string structure object and prefetches target information;First parameter be from
First parameter obtained in internal memory, first parameter are the parameter at least one parameter;
Judge whether the described 1st number for prefetching the parameter that target information includes is equal to the sum of the parameter;
If so, target information then is prefetched as the target information using the described 1st;
The second parameter is prefetched in target information added to the described 1st if it is not, then building object by the character string, obtained
Target information is prefetched to the 2nd;Second parameter is two parameters being obtained from internal memory, second parameter for it is described at least
Parameter in one parameter;
Process of the number for prefetching the parameter that target information includes compared with the sum is repeated, until prefetching mesh
The number for the parameter that mark information includes is equal with the sum, will prefetch target information as the target information accordingly.
Method as described above, methods described also include:According to the target information, the title of the Java files and
The line number, after obtaining target journaling corresponding with described program sentence, in addition to:
The title and the line number of the Java files established in the target journaling and the journey of the daily record to be output
The hyperlink of sequence sentence, so that user can check instruction by the title of the Java files and line number input, it is described to look into
See that instruction is used for instruction terminal and obtains the program statement of the daily record to be output and show the program statement of the daily record to be output.
Method as described above, before at least one parameter in the program statement for obtaining daily record to be output, also
Including:
Whether the running environment for judging the application program is test environment, and obtained judged result is yes.
The present invention also provides a kind of log acquisition device based on method stack, including:
Parameter acquisition module, at least one parameter in program statement for obtaining daily record to be output;
Position information acquisition module, the journey is obtained for the predeterminated position in method stack corresponding with the application program
Line number of the title and described program sentence of Java files where sequence sentence in the Java files;
Target information acquisition module, for according to each parameter, obtaining including the target information of each parameter;
Target journaling acquisition module, for according to the target information, the title of the Java files and the line number, obtaining
To target journaling corresponding with the program statement of the daily record to be output.
Device as described above, the target information acquisition module are specifically used for:
Create character string structure object;
It regard the first parameter as the 1st by character string structure object and prefetches target information;First parameter be from
First parameter obtained in internal memory, first parameter are the parameter at least one parameter;
Judge whether the described 1st number for prefetching the parameter that target information includes is equal to the sum of the parameter;
If so, target information then is prefetched as the target information using the described 1st;
The second parameter is prefetched in target information added to the described 1st if it is not, then building object by the character string, obtained
Target information is prefetched to the 2nd;Second parameter is two parameters being obtained from internal memory, second parameter for it is described at least
Parameter in one parameter;
Process of the number for prefetching the parameter that target information includes compared with the sum is repeated, until prefetching mesh
The number for the parameter that mark information includes is equal with the sum, will prefetch target information as the target information accordingly.
Device as described above, described device also include:Hyperlink establishes module;
The hyperlink establishes module, for the title for establishing the Java files in the target journaling and the row
Hyperlink number with the program statement of the daily record to be output, so that title that user can be by the Java files and the row
Instruction is checked in number input, described to check that instruction is used for described in the program statement of the instruction terminal acquisition daily record to be output and display
The program statement of daily record to be output.
The present invention also provides a kind of terminal, including the as above log acquisition device based on method stack described in any one.
The journal obtaining method based on method stack of the present invention can include:In the program statement for obtaining daily record to be output
At least one parameter;The name of the Java files where predeterminated position acquisition program statement in method stack corresponding with application program
Claim and line number of the program statement in Java files;According to each parameter in the program statement of the daily record to be output of acquisition, obtain
Include the target information of each parameter;According to target information, the title and line number of Java files, mesh corresponding with program statement is obtained
Mark daily record.User can quickly be found and daily record by the obtained daily record of the journal obtaining method based on method stack of the present invention
Corresponding program statement, so as to quickly find code wrong in source code, development efficiency is high.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing
There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are this hairs
Some bright embodiments, for those of ordinary skill in the art, without having to pay creative labor, can be with
Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 is the schematic flow sheet one of the journal obtaining method provided by the invention based on method stack;
Fig. 2 is the structural representation of method stack provided by the invention;
Fig. 3 is the schematic flow sheet two of the journal obtaining method provided by the invention based on method stack;
Fig. 4 is the structural representation of the log acquisition device embodiment one provided by the invention based on method stack;
Fig. 5 is the structural representation of the log acquisition device embodiment two provided by the invention based on method stack;
Fig. 6 is the structural representation of terminal provided by the invention.
Embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention
In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is
Part of the embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art
The every other embodiment obtained under the premise of creative work is not made, belongs to the scope of protection of the invention.
Fig. 1 is the schematic flow sheet one of the journal obtaining method provided by the invention based on method stack, as shown in figure 1, this
The method of embodiment can include:
Step S101, at least one parameter in the program statement of daily record to be output is obtained;
Step S102, the Java files where the predeterminated position of method stack corresponding with application program obtains program statement
Line number in Java files of title and program statement;
Step S103, each parameter in the program statement of the daily record to be output of acquisition, obtain including the mesh of each parameter
Mark information;
Step S104, according to target information, the title and line number of Java files, target day corresponding with program statement is obtained
Will.
Specifically, the executive agent of the present embodiment can be terminal, and terminal for example can be computer.
User in development and application program, it is necessary to test application program, to determine that the source code of application program is
It is no problematic.Each program statement in source code can be defeated by increasing corresponding daily record after the program statement in source code
Go out sentence, export a daily record.Daily record includes the parameter in corresponding program sentence running, and user can be by wrapping in daily record
The parameter included, judges whether the program statement is properly executed, to judge whether the source code of application program is problematic.
It will be appreciated by those skilled in the art that although after each program statement can be by the program statement in source code
Increase corresponding daily record output statement, export a daily record, but be not that each program statement is required to according to actual conditions
Output journal, so, corresponding daily record output statement is only just provided with after the program statement of output journal in need, therefore, after
The program statement that face is provided with daily record output statement is the program statement of daily record to be output.
It will be understood by those skilled in the art that daily record output statement can be lines of code.
It is not in non-exploitation if the current running environment of application program is test environment (i.e. the environment of debugging utility)
The terminal operating of the user of personnel, then user is by will control the variable assignments in daily record output condition sentence to be in source code
Ture so that the program statement of daily record to be output can export its corresponding daily record by daily record output statement.Control daily record
The assignment of variable in output condition sentence, have decided on whether the daily record of program statement of the output with daily record output statement.
Therefore, the process for judging application program current operating environment is specially:In application program in the process of running, terminal
The current assignment of the variable controlled in source code in daily record output condition sentence is obtained, if being currently entered as the first assignment, really
It is test environment to determine current operating environment, if being currently entered as the second assignment, it is determined that current environment is non-testing environments.First
Assignment is used to indicate that current environment is test environment, and the second assignment is used to indicate to determine that current operating environment is non-testing environments.
After the current operating environment that application program is determined is test environment, the program word of daily record to be output can be obtained
The daily record of sentence.
Illustrated below for the log-output method of the program statement of a daily record to be output.
For step S101, at least one parameter in the program statement of daily record to be output is obtained.
Specifically, the parameter in the program statement of the daily record to be output of acquisition needs to meet following condition:It can reflect
Whether the program statement of the daily record to be output is correctly performed.In the program statement of the acquisition daily record to be output of acquisition at least
One parameter is stored into the internal memory of terminal.
Wherein, at least one ginseng in the program statement of daily record to be output can be obtained by the form of self-defined static variable
Number, that is, the self-defined language of static variable for the mark that at least one parameter can be included by performing application source code
Sentence, obtains each parameter.Such as:Code corresponding with least one parameter in the program statement of acquisition daily record to be output can be such as
Lower form:
Private static void k (String...args), such as when the ginseng in the program statement of daily record to be output
Several when being identified as a, b, then the code can be:Private static void k (a, b).
Wherein, the code is the wherein line code in daily record output statement.Using custom parameter in the present embodiment
Several form (i.e. by self-defined static variable sentence), it is allowed to obtain the parameter of any number.
For step S102, the program word of daily record to be output is obtained in the predeterminated position of method stack corresponding with application program
The line number of the title of Java files and the program statement of daily record to be output in the Java files where sentence.
Specifically, predeterminated position can prestore in the terminal, the Java texts where the program statement of the daily record to be output of acquisition
The line number of the title of part and the program statement of daily record to be output in the Java files is also stored in the internal memory of terminal.
Wherein, method stack is the structure of a stack, for preserving the recalls information of method when application program performs, including is adjusted
With the method name of method, Java filenames where the program statement of this method and the program statement are called in the Java files
In the information such as line number.
For example in the running of application program, when running to the program statement of the daily record to be output, this is to be output
The program statement of daily record is performed, and needs to call certain execution method during the program statement for performing the daily record to be output, then the execution
The recalls information of method can be stored in the predeterminated position in method stack corresponding with the application program, be preserved in the predeterminated position
There are the Java filenames where the method name of the execution method, the program statement of the daily record to be output and the journey of the daily record to be output
Line number of the sequence sentence in the Java files.
The recalls information of the execution method of the program statement of all daily records to be output is all stored in the application in source code
Corresponding to program at the same position of method stack.So journey for any daily record to be output in the source code of the application program
Sequence sentence is sayed:Can be in the title of Java file and the program of to be output daily record of the method stack identical position acquisition where it
Line number of the sentence in the Java files.
Such as where the program statement of the predeterminated position acquisition daily record to be output of method stack corresponding with application program
Code corresponding to the line number of the title of Java files and the program statement of daily record to be output in the Java files can be following
Form:
Stack Trace Element this Method Stack=Thread.current Thread () .get
Stack Trace()[5];
In this way, above-mentioned Java filenames and line number can be obtained by StackTraceElement, wherein, numeral 5 is used
In instruction Java filenames and line number are obtained from the 5th opening position apart from stack top.
In addition, the program statement except daily record to be output can be obtained in the predeterminated position of method stack corresponding with application program
The title of the Java files at place and the program statement of daily record to be output can also obtain execution outside the line number in the Java files
The method name that the program statement of the daily record to be output is called.
For step S103, according to each parameter in the program statement of the daily record to be output of acquisition, obtain including each parameter
Target information.
Specifically, the step is that each parameter in the program statement of the daily record to be output to acquisition is spliced, and is obtained
The process of target information comprising each parameter.
Wherein, each parameter in the program statement of the daily record to be output of acquisition, obtain the target comprising each parameter and believe
Breath, is specifically included:Each parameter of object splicing is built by creating a character string, obtains including the target information of each parameter.
Because at least one parameter in the program statement of daily record to be output by self-defined static variable to be obtained in advance,
Therefore, a character string structure object need to be only created in the present embodiment and splices each parameter, the consumption of internal memory and performance to terminal
It is smaller, and the form of spliced each parameter is consistent, such as parameter a=1, parameter b=1, parameter c=2, can be a after splicing
=1, b=1, c=2 or a=1 | b=1 | c=2, and the form of target information can be a=1, b=1, c=2 or a=1 | b
=1 | c=2.
In the present embodiment obtain target information method be not in obtained in advance due to not in the prior art it is to be output
The parameter of the program statement of daily record, can only using+by the way of carry out splicing parameter (using+by the way of carry out splicing and need to create
Multiple character strings build objects) caused by the internal memory and all very big performance consumption of terminal the problem of.
For step S104, obtain target information, daily record to be output program statement where Java files title
After the line number of the program statement of daily record to be output in the Java files, according to target information, the program word of daily record to be output
It is to be output that the line number of the title of Java files and the program statement of daily record to be output in the Java files where sentence obtains this
The daily record of the program statement of daily record.
Specifically, " according to target information, daily record to be output program statement where the title of Java files and to be output
Line number of the program statement of daily record in the Java files obtains the daily record of the program statement of the daily record to be output " refer to " at least
By target information corresponding with the program statement of daily record to be output, daily record to be output program statement where Java files name
Claim and line number of the program statement of daily record to be output in the Java files spliced ", obtain target journaling.
If the method name for the method called when obtaining the program statement for performing daily record to be output in step s 102,
Also include party's religious name in daily record.
Wherein, the daily record of output can be following form:
Daily record one:11-18 16:36:39:497 3729-3729/com.example.mjn.myapplication D/
onCreate(MainActivity,java:19):{ vesion=2.5, };
MainActivity be daily record to be output program statement where java filenames, java:19 be line number,
Vesion=2.5 is the parameter in the program statement of daily record to be output, as target information.OnCreate is execution day to be output
The method name for the method that the program statement of will is called.
Daily record two:11-18 16:36:39:590 3729-3729/com.example.mjn.myapplication D/
onCreate(Activity,java:16):{ value=1, };
Activity be daily record to be output program statement where java filenames, java:16 be line number, value=1
For the parameter in the program statement of daily record to be output, as target information.
Daily record three:11-18 16:36:39:592 3729-3729/com.example.mjn.myapplication D/
onCreate(Activity,java:17):{ index=5, number=6, };
Activity be daily record to be output program statement where java filenames, java:17 be line number, index=
5, number=6 be the parameter in the program statement of daily record to be output, as target information.
Due in the daily record of output, include target information, daily record to be output program statement where Java files
Title and daily record to be output line number of the program statement in the Java files.Therefore, user is after the daily record is seen,
To immediately know that the daily record is daily record corresponding to the program statement of which row in which Java file, so as to quickly find the journey
Sequence sentence.For example by checking the parameter in daily record, it is found that program statement corresponding to the daily record is not executed correctly, then user
Can according to the position (the Java files at place and the line number in the Java files) of the content aware of the daily record program statement, from
And quickly through the program statement is found in the position, the problem of determining the program statement, then solve the problem.I.e. user can
According to the daily record obtained in the present embodiment, program statement corresponding with daily record can be quickly found, so as to quickly find source
Wrong code in code, development efficiency are high.
After target journaling is obtained, title and line number and the daily record to be output of the Java files established in target journaling
The hyperlink of program statement, so that user can check instruction by title and the line number input of Java files, check that instruction is used for
Instruction terminal obtains the program statement of daily record to be output and shows the program statement of daily record to be output.
Such as the MainActivity in user's click logs one, java:After 19, terminal can be shown to user with
The program statement of daily record to be output corresponding to the daily record.Further increase the program for searching daily record to be output corresponding to the daily record
The speed of sentence.
After the explanation of the journal obtaining method based on method stack in the present embodiment, below again in the present embodiment
The method stack being related to accordingly is described in detail.
The code of application program often calls a method, and the data related to this method will be pressed into method stack.First
The related data of called method apart from the distance of stack top be more than after be called method related data apart from stack top
Distance.
Fig. 2 is the structural representation of method stack provided by the invention.
For the journal obtaining method based on method stack in the present embodiment, before daily record is obtained, it has been first carried out treating
The program statement of output journal, the method name for the method therefore, during the program statement for performing the daily record to be output called, calling should
The program statement of Java filenames and the daily record to be output where the program statement of the daily record to be output of method is in the Java
The information such as the line number in file have just been pressed into the first position 21 of correlation method stack.
Then, at least one parameter in the program statement of daily record to be output is obtained, the method for acquisition is User Defined
Method, then the method name of the customizing method, code (the private static void k for calling the customized method
(String...args) information such as the line number of Java filenames and the code in the Java files where) are just pressed into
The second place 22 of correlation method stack.
Then, the predeterminated position obtained in method stack corresponding with application program obtains the program statement institute of daily record to be output
Line number in the Java files of the title of Java files and the program statement of daily record to be output, obtain the title and line number
The method of calling can be described as acquisition methods stack method, the method name of acquisition methods stack method, where calling the code of this method
The information such as the line number of Java filenames and the code in the Java files have just been pressed into the 3rd position of correlation method stack
23。
Then, each parameter in the program statement of the daily record to be output of acquisition, obtain the target comprising each parameter and believe
Breath, splice each parameter and obtain the method that the method for target information calling can be described as splicing parameter;The method name of splicing parametric technique,
The information such as the line number of Java filenames and the code in the Java files where the code of calling this method are just pressed into
4th position 24 of correlation method stack.
Finally, according to target information, daily record to be output program statement where Java files title and day to be output
Line number of the program statement of will in the Java files obtains the daily record of the program statement of the daily record to be output, the invocation of procedure
Method can be described as log-output method.Java filenames where the method name of log-output method, the code of calling this method
And the information such as the line number of the code in the Java files has just been pressed into the 5th position 25 of correlation method stack.
The present embodiment is exactly the feature of Application way stack, and daily record to be output has been got in the predeterminated position of method stack
The line number of the title of Java files where program statement and the program statement of daily record to be output in the Java files, and should
Information is as a part of content in daily record, and therefore, user is by checking that daily record can know program statement corresponding to the daily record
Position, realize the fast positioning to program statement corresponding to the daily record.
The journal obtaining method based on method stack of the present embodiment can include:In the program statement for obtaining daily record to be output
At least one parameter;Java files where the predeterminated position of corresponding with application program method stack obtains program statement
The line number of title and program statement in Java files;According to each parameter in the program statement of the daily record to be output of acquisition, obtain
To the target information for including each parameter;According to target information, the title and line number of Java files, obtain corresponding with program statement
Target journaling.The journal obtaining method based on method stack of the present embodiment, improve user and search program word corresponding with daily record
The speed of sentence, so as to improve the speed for searching code wrong in source code, finally improve development efficiency.
Specific embodiment is used below, and " object is built by creating a character string to the step in a upper embodiment
Splice each parameter, obtain the target information for including each parameter " it is described in detail.
Fig. 3 is the schematic flow sheet two of the journal obtaining method provided by the invention based on method stack, as shown in figure 3, this
The method of embodiment can include:
Step S301, character string structure object is created;
Step S302, it regard the first parameter as the 1st by character string structure object and prefetches target information;First parameter be from
First parameter obtained in internal memory, the first parameter are the parameter in the daily record sentence to be output of acquisition;
Step S303, judge whether the 1st number for prefetching the parameter that target information includes is equal to the day to be output obtained
The sum of parameter in will sentence;If performing step S304, if it is not, execution step S305~
Step S304, target information then is prefetched as target information using the 1st;
Step S305, then build object by character string to prefetch the second parameter in target information added to the 1st, obtain the
2 prefetch target information;Second parameter is two parameters obtained from internal memory, and the second parameter is the daily record sentence to be output obtained
In parameter;
Step S306, the number for prefetching the parameter that target information includes and the daily record sentence to be output obtained are repeated
In parameter sum process relatively, until prefetching the number of the parameter that target information includes and the daily record to be output obtained
Parameter in sentence it is total equal, target information will be prefetched as target information accordingly.
Specifically, can be following form with step S301~step S306 corresponding code:
The parameter of the program statement of the daily record to be output obtained by custom variable is stored in internal memory after the acquisition,
Using each parameter as, it is necessary to each parameter is read out from internal memory, then passing through character string during the content of daily record and build object and spell
It is connected together, obtains the target information for including each parameter.
Obtained from internal memory first parameter of parameter-first is first built into object composition the 1st by character string and prefetches mesh
Mark information;Then judge whether the 1st number for prefetching the parameter that target information includes is equal to the daily record sentence to be output obtained
In parameter sum.
If it is not, then obtaining a parameter of parameter-second again from internal memory, object is built by the second parameter by character string
Prefetched added to the 1st in target information, obtain the 2nd and prefetch target information;Then judge that the 2nd prefetches the ginseng that target information includes
Whether several numbers is equal to the sum of the parameter in the daily record sentence to be output obtained.
If it is not, then obtaining a parameter of parameter-the 3rd again from internal memory, object is built by the 3rd parameter by character string
Prefetched added to the 2nd in target information, obtain the 3rd and prefetch target information.
Above-mentioned cyclic process is repeated, until the number for prefetching the parameter included in target information is equal to the to be output of acquisition
The sum of parameter in daily record sentence;Using now prefetch target information as final target information.
The journal obtaining method based on method stack of the present embodiment, object is built by a character string and splices each parameter,
So that the internal memory of terminal and the consumption of performance are smaller, and the form of spliced each parameter is consistent.
Fig. 4 is the structural representation of the log acquisition device embodiment one provided by the invention based on method stack, such as Fig. 4 institutes
Show, the device of the present embodiment can include:Parameter acquisition module 11, position information acquisition module 12, target information acquisition module
13 and target journaling acquisition module 14.
Parameter acquisition module 11, at least one parameter in program statement for obtaining daily record to be output;
Position information acquisition module 12, program statement is obtained for the predeterminated position in method stack corresponding with application program
Line number of the title and program statement of the Java files at place in Java files;
Target information acquisition module 13, for according to each parameter, obtaining including the target information of each parameter;
Target journaling acquisition module 14, for according to target information, the title and line number of Java files, obtain with it is to be output
Target journaling corresponding to the program statement of daily record.
Parameter acquisition module 11 is additionally operable to store each parameter of program statement of the daily record to be output of acquisition to terminal
In depositing.
Target information acquisition module 13 also particularly useful for:Create character string structure object;Building object by character string will
First parameter prefetches target information as the 1st;First parameter is first parameter obtained from internal memory, and the first parameter is acquisition
Daily record to be output program statement in parameter;Judge whether the 1st number for prefetching the parameter that target information includes is equal to
The sum of parameter in the program statement of the daily record to be output obtained;Believe if so, then prefetching target information using the 1st as target
Breath;The second parameter is prefetched in target information added to the 1st if it is not, then building object by character string, the 2nd is obtained and prefetches target
Information;Second parameter is two parameters obtained from internal memory, and the second parameter is the program statement of the daily record to be output obtained
In parameter;In the program statement for repeating the number for prefetching the parameter that target information includes and the daily record to be output obtained
Parameter sum process relatively, until prefetching the number of the parameter that target information includes and the daily record to be output that obtains
Parameter in program statement it is total equal, target information will be prefetched as target information accordingly.
The device of the present embodiment, it can be used for the technical scheme for performing above method embodiment, its realization principle and technology
Effect is similar, and here is omitted.
Fig. 5 is the structural representation of the log acquisition device embodiment two of the invention based on method stack, as shown in figure 5, this
The device of embodiment is on the basis of Fig. 4 shown device structures, further, can also include:Judge module 15 and hyperlink
Establish module 16.
Judge module 15 is used to judge whether the running environment of application program to be test environment.
Hyperlink establishes module 16, for establishing title and line number and the daily record to be output of the Java files in target journaling
Program statement hyperlink so that user can check instruction by the input of the title and line number of Java files, check instruction use
The program statement of daily record to be output is obtained in instruction terminal and shows the program statement of daily record to be output.
The device of the present embodiment, it can be used for the technical scheme for performing embodiment of the method shown in Fig. 1, its realization principle and skill
Art effect is similar, and here is omitted.
Fig. 6 is terminal structure schematic diagram provided by the invention, as shown in fig. 6, the terminal 31 of the present embodiment includes Fig. 4 or figure
The log acquisition device 32 based on method stack shown in 5, the log acquisition device 32 based on method stack, can perform Fig. 1~Fig. 3
Any one of embodiment technical scheme, its implementing principle and technical effect is similar, and here is omitted.
One of ordinary skill in the art will appreciate that:Realizing all or part of step of above-mentioned each method embodiment can lead to
The related hardware of programmed instruction is crossed to complete.Foregoing program can be stored in a computer read/write memory medium.The journey
Sequence upon execution, execution the step of including above-mentioned each method embodiment;And foregoing storage medium includes:ROM, RAM, magnetic disc or
Person's CD etc. is various can be with the medium of store program codes.
Finally it should be noted that:Various embodiments above is merely illustrative of the technical solution of the present invention, rather than its limitations;To the greatest extent
The present invention is described in detail with reference to foregoing embodiments for pipe, it will be understood by those within the art that:Its according to
The technical scheme described in foregoing embodiments can so be modified, either which part or all technical characteristic are entered
Row equivalent substitution;And these modifications or replacement, the essence of appropriate technical solution is departed from various embodiments of the present invention technology
The scope of scheme.
Claims (10)
- A kind of 1. journal obtaining method based on method stack, it is characterised in that including:Obtain at least one parameter in the program statement of daily record to be output;The name of the Java files where predeterminated position acquisition described program sentence in method stack corresponding with the application program Claim and line number of the described program sentence in the Java files;According to each parameter, obtain including the target information of each parameter;According to the target information, the title of the Java files and the line number, the program with the daily record to be output is obtained Target journaling corresponding to sentence.
- 2. according to the method for claim 1, it is characterised in that at least one in the program statement for obtaining daily record to be output After individual parameter, in addition to:Each parameter is stored into the internal memory of terminal.
- 3. according to the method for claim 2, it is characterised in that it is described according at least one parameter, obtain target letter Breath, including:Each parameter of object splicing is built by creating a character string, obtains including the target information of each parameter.
- 4. according to the method for claim 3, it is characterised in that each described by creating a character string structure object splicing Parameter, obtain including the target information of each parameter, including:Create character string structure object;It regard the first parameter as the 1st by character string structure object and prefetches target information;First parameter is from internal memory First parameter of middle acquisition, first parameter are the parameter at least one parameter;Judge whether the described 1st number for prefetching the parameter that target information includes is equal to the sum of the parameter;If so, target information then is prefetched as the target information using the described 1st;The second parameter is prefetched in target information added to the described 1st if it is not, then building object by the character string, obtains the 2 prefetch target information;Second parameter is two parameters obtained from internal memory, and second parameter is described at least one Parameter in parameter;Process of the number for prefetching the parameter that target information includes compared with the sum is repeated, until prefetching target letter The number for the parameter that breath includes is equal with the sum, will prefetch target information as the target information accordingly.
- 5. according to the method for claim 1, it is characterised in that methods described also includes:According to the target information, institute The title of Java files and the line number are stated, after obtaining target journaling corresponding with described program sentence, in addition to:The title and the line number of the Java files established in the target journaling and the program word of the daily record to be output The hyperlink of sentence, so that user can check instruction by the title of the Java files and line number input, it is described to check finger Make and obtain the program statement of the daily record to be output for instruction terminal and show the program statement of the daily record to be output.
- 6. according to the method for claim 1, it is characterised in that in the program statement for obtaining daily record to be output extremely Before a few parameter, in addition to:Whether the running environment for judging the application program is test environment, and obtained judged result is yes.
- A kind of 7. log acquisition device based on method stack, it is characterised in that including:Parameter acquisition module, at least one parameter in program statement for obtaining daily record to be output;Position information acquisition module, described program language is obtained for the predeterminated position in method stack corresponding with the application program Line number of the title and described program sentence of Java files where sentence in the Java files;Target information acquisition module, for according to each parameter, obtaining including the target information of each parameter;Target journaling acquisition module, for according to the target information, the title of the Java files and the line number, obtain with Target journaling corresponding to the program statement of the daily record to be output.
- 8. device according to claim 7, it is characterised in that the target information acquisition module is specifically used for:Create word Symbol string structure object;It regard the first parameter as the 1st by character string structure object and prefetches target information;First parameter is from internal memory First parameter of middle acquisition, first parameter are the parameter at least one parameter;Judge whether the described 1st number for prefetching the parameter that target information includes is equal to the sum of the parameter;If so, target information then is prefetched as the target information using the described 1st;The second parameter is prefetched in target information added to the described 1st if it is not, then building object by the character string, obtains the 2 prefetch target information;Second parameter is two parameters obtained from internal memory, and second parameter is described at least one Parameter in parameter;Process of the number for prefetching the parameter that target information includes compared with the sum is repeated, until prefetching target letter The number for the parameter that breath includes is equal with the sum, will prefetch target information as the target information accordingly.
- 9. device according to claim 7, it is characterised in that described device also includes:Hyperlink establishes module;The hyperlink establishes module, for establish the Java files in the target journaling title and the line number with The hyperlink of the program statement of the daily record to be output, so that user can be defeated by the title of the Java files and the line number Enter to check instruction, it is described to check that instruction is defeated for being treated described in the program statement of the instruction terminal acquisition daily record to be output and display Go out the program statement of daily record.
- 10. a kind of terminal, it is characterised in that including the log acquisition based on method stack as described in any one of claim 7~9 Device.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710496952.0A CN107463485B (en) | 2017-06-26 | 2017-06-26 | Method stack-based log acquisition method and device and terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710496952.0A CN107463485B (en) | 2017-06-26 | 2017-06-26 | Method stack-based log acquisition method and device and terminal |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107463485A true CN107463485A (en) | 2017-12-12 |
CN107463485B CN107463485B (en) | 2020-11-10 |
Family
ID=60546398
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710496952.0A Active CN107463485B (en) | 2017-06-26 | 2017-06-26 | Method stack-based log acquisition method and device and terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107463485B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112612701A (en) * | 2020-12-24 | 2021-04-06 | 北京浪潮数据技术有限公司 | Program fault positioning method, device, equipment and readable storage medium |
CN112882902A (en) * | 2021-03-05 | 2021-06-01 | 深圳市迅雷网络技术有限公司 | Thread source obtaining method, electronic equipment and computer readable storage device |
CN113360357A (en) * | 2021-06-01 | 2021-09-07 | 深圳前海微众银行股份有限公司 | Data monitoring method, system, equipment and computer program product |
CN113377674A (en) * | 2021-07-02 | 2021-09-10 | 北京奇艺世纪科技有限公司 | Log code adding method and device |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102360328A (en) * | 2011-09-29 | 2012-02-22 | 用友软件股份有限公司 | Programmed monitoring device and programmed monitoring method |
CN102782649A (en) * | 2010-03-04 | 2012-11-14 | 日本电气株式会社 | Application modification section search device and application modification section search method |
CN104268055A (en) * | 2014-09-01 | 2015-01-07 | 腾讯科技(深圳)有限公司 | Program exception monitoring method and device |
CN106201756A (en) * | 2016-07-12 | 2016-12-07 | 努比亚技术有限公司 | Log acquisition device, mobile terminal and method |
US20160371085A1 (en) * | 2013-08-21 | 2016-12-22 | Vmware, Inc. | Branch trace compression |
-
2017
- 2017-06-26 CN CN201710496952.0A patent/CN107463485B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102782649A (en) * | 2010-03-04 | 2012-11-14 | 日本电气株式会社 | Application modification section search device and application modification section search method |
CN102360328A (en) * | 2011-09-29 | 2012-02-22 | 用友软件股份有限公司 | Programmed monitoring device and programmed monitoring method |
US20160371085A1 (en) * | 2013-08-21 | 2016-12-22 | Vmware, Inc. | Branch trace compression |
CN104268055A (en) * | 2014-09-01 | 2015-01-07 | 腾讯科技(深圳)有限公司 | Program exception monitoring method and device |
CN106201756A (en) * | 2016-07-12 | 2016-12-07 | 努比亚技术有限公司 | Log acquisition device, mobile terminal and method |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112612701A (en) * | 2020-12-24 | 2021-04-06 | 北京浪潮数据技术有限公司 | Program fault positioning method, device, equipment and readable storage medium |
CN112612701B (en) * | 2020-12-24 | 2024-02-23 | 北京浪潮数据技术有限公司 | Program fault positioning method, device, equipment and readable storage medium |
CN112882902A (en) * | 2021-03-05 | 2021-06-01 | 深圳市迅雷网络技术有限公司 | Thread source obtaining method, electronic equipment and computer readable storage device |
CN112882902B (en) * | 2021-03-05 | 2023-02-14 | 深圳市迅雷网络技术有限公司 | Thread source obtaining method, electronic equipment and computer readable storage device |
CN113360357A (en) * | 2021-06-01 | 2021-09-07 | 深圳前海微众银行股份有限公司 | Data monitoring method, system, equipment and computer program product |
CN113377674A (en) * | 2021-07-02 | 2021-09-10 | 北京奇艺世纪科技有限公司 | Log code adding method and device |
CN113377674B (en) * | 2021-07-02 | 2024-03-08 | 北京奇艺世纪科技有限公司 | Log code adding method and device |
Also Published As
Publication number | Publication date |
---|---|
CN107463485B (en) | 2020-11-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107463485A (en) | Journal obtaining method, device and terminal based on method stack | |
CN103425574B (en) | A kind of method and device of test application program | |
US9720811B2 (en) | Unified model for visual component testing | |
CN105912473B (en) | Mobile APP automatically testing platform and test method based on BDD | |
CN107229848A (en) | A kind of code reinforcement means and device | |
CN104899016B (en) | Allocating stack Relation acquisition method and device | |
US20060130026A1 (en) | Method and system for automatically identifying and marking subsets of localizable resources | |
US20090254880A1 (en) | Techniques for offering and applying code modifications | |
US9824075B1 (en) | System and method for interaction coverage | |
CN106874207A (en) | The automated testing method and device of a kind of web page | |
CN104268473B (en) | Method and device for detecting application programs | |
KR20050060013A (en) | Subscriber identification module(sim) emulator | |
CN107015841B (en) | Preprocessing method for program compiling and program compiling device | |
CN103440198B (en) | Form validation method | |
CN110197052A (en) | Authority application method, apparatus, equipment and storage medium based on Android platform | |
CN104462943A (en) | Non-intrusive performance monitoring device and method for service system | |
US7783927B2 (en) | Intelligent processing tools | |
CN106227550A (en) | Generation method, system and the computer of a kind of Internationalized Graphical User Interface | |
CN104881284A (en) | Efficient log operating method | |
CN107247767A (en) | A kind of method and device that database is imported by formatted data files | |
CN106326129A (en) | Program abnormity information generating method and device | |
CN107832176A (en) | Hard disk pressure automatic test approach and system under a kind of Windows | |
US11249880B1 (en) | Debugging and simulating application runtime execution | |
CN107391272A (en) | The method and terminal of multi-process data interaction | |
CN107798244A (en) | A kind of method and device for detecting Remote Code Execution Vulnerability |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |