CN113672465A - Method, system, medium, terminal and unmanned aerial vehicle for generating process log system by process name - Google Patents

Method, system, medium, terminal and unmanned aerial vehicle for generating process log system by process name Download PDF

Info

Publication number
CN113672465A
CN113672465A CN202110967265.9A CN202110967265A CN113672465A CN 113672465 A CN113672465 A CN 113672465A CN 202110967265 A CN202110967265 A CN 202110967265A CN 113672465 A CN113672465 A CN 113672465A
Authority
CN
China
Prior art keywords
log
name
log system
generating
process name
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
CN202110967265.9A
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.)
Yifei Hainan Technology Co ltd
Original Assignee
Yifei Hainan 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 Yifei Hainan Technology Co ltd filed Critical Yifei Hainan Technology Co ltd
Priority to CN202110967265.9A priority Critical patent/CN113672465A/en
Publication of CN113672465A publication Critical patent/CN113672465A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3065Monitoring arrangements determined by the means or processing involved in reporting the monitored data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3013Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is an embedded system, i.e. a combination of hardware and software dedicated to perform a certain function in mobile devices, printers, automotive or aircraft systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3017Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is implementing multitasking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/164File meta data generation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • Mathematical Physics (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a method, a system, a medium, a terminal and an unmanned aerial vehicle for generating a process log system by process names, and relates to the technical field of unmanned aerial vehicle data analysis. A plurality of processes are operated; acquiring a current progress pid through a pid acquisition interface; acquiring a current process name character string through a process name interface; splicing character strings; a default string; and calling a static library of the log system and creating a log file. The invention provides a method for generating a process log system aiming at process names under linux, which realizes the function that static libraries of the log system of a plurality of processes run simultaneously and log information is respectively written into different files by acquiring the process id of the process during running, acquiring the process name according to the process id and creating a log file named by the process name, thereby solving the technical problem of log information confusion caused by writing the log information into the same file by a plurality of processes.

Description

Method, system, medium, terminal and unmanned aerial vehicle for generating process log system by process name
Technical Field
The invention belongs to the technical field of unmanned aerial vehicle data analysis, and particularly relates to a method for generating a process log system aiming at a process name under linux, a storage medium for receiving a user input program, an information data processing terminal and an unmanned aerial vehicle.
Background
At present, in an embedded linux system (a Unix-like operating system which is used and freely propagated and is a multi-user, multi-task, multithreading and multi-CPU-based operating system), when two processes using the same log system store a process running log, the same log file is written into the process running log at the same time, so that the problems of record confusion and time confusion of the log system in the unmanned aerial vehicle are caused.
Designing a method capable of separately storing the logs thereof according to the processes is called a problem to be solved.
Through the above analysis, the problems and defects of the prior art are as follows: at present, in an embedded linux system, when a plurality of processes call the same static library of a log system to write in log information, the log information of the plurality of processes is mixed and written in the same log file, so that the problems of time confusion and influence on log information analysis exist.
The significance of solving the problems and the defects is as follows: the invention solves the inconvenience caused by changing the log information recorded in a mixed way into the follow-up abnormal analysis when a plurality of processes run, and improves the robustness and the usability of the log system.
Disclosure of Invention
In order to overcome the problems in the related art, the disclosed embodiment of the present invention provides a method for generating a process log system for a process name under linux. The technical scheme is as follows:
according to a first aspect of the disclosed embodiments of the present invention, there is provided a method for generating a process log system for a process name under linux, a storage medium for receiving a user input program, an information data processing terminal, and an unmanned aerial vehicle, including:
when a log system runs, acquiring a process pid of a process, and then converting a process name;
and creating a log file by adding a text suffix to the name of the process name, realizing the function of simultaneously operating the static libraries of the log system of a plurality of processes and respectively writing log information into different log files.
In an embodiment of the present invention, the method for generating a process log system for a process name under linux specifically includes:
firstly, running a plurality of processes;
step two, acquiring a current process pid through a pid acquisition interface;
step three, acquiring a current process name character string through a process name interface; if the step four is successfully executed, skipping the step five and executing the step six; if not, skipping the step four and executing the step five;
fourthly, splicing character strings;
step five, defaulting character strings;
and step six, calling a log system static library and creating a log file.
In an embodiment of the present invention, the pid acquisition interface in the step one and the process name interface in the step two are both mounted on a lingux system.
In an embodiment of the present invention, the performing character string splicing in step four includes: log/plus current process name plus log.
In an embodiment of the present invention, the fourth step uses the spliced character string as a filename, skips the fifth step, and executes the sixth step.
In an embodiment of the present invention, the default character string in the fifth step cooperates with the self-increment information of the call times of the log system to set the name of the log file, so that the log information is normally stored in the static library of the log system, and then the sixth step is executed.
According to a second aspect of the disclosed embodiments of the present invention, there is provided a process logging system comprising:
the process running module is used for running a plurality of processes;
a pid acquisition interface for acquiring the pid of the current process;
the process name interface is used for acquiring a current process name character string;
the character string splicing module is used for splicing character strings; the method comprises the following steps: log/adding the name of the current process;
the default character string module is used for defaulting a character string and is also used for setting a log file name in cooperation with the self-increment information of the calling times of the log system so as to enable the static library of the log system to normally store log information;
and the log system static library is used for creating different log files.
According to a third aspect of the disclosed embodiments of the present invention, there is provided a program storage medium for receiving a user input, the stored computer program causing an electronic device to execute a method of generating a process log system for a process name under linux.
According to a fourth aspect of the disclosed embodiments of the present invention, there is provided an information data processing terminal comprising a memory and a processor, the memory storing a computer program, the computer program, when executed by the processor, causing the processor to perform a method of generating a process log system for a process name under linux.
According to a fifth aspect of the disclosed embodiments of the present invention, there is provided an unmanned aerial vehicle, wherein the unmanned aerial vehicle executes a method for generating a process log system for a process name under linux.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
the invention provides a method for generating a process log system aiming at process names under linux, which realizes the function of simultaneously operating the static libraries of the log system of a plurality of processes and respectively writing log information into different files by acquiring the process pid of the process during the operation, acquiring the process name according to the process pid and creating the log file named by the process name, thereby solving the technical problem of log information confusion caused by writing the log information into the same file by a plurality of processes.
Compared with the prior art, the invention has the advantages that:
according to the invention, a plurality of log files are created through the process information, and a plurality of processes are written into the log files respectively at the same time, so that the problems of log information time confusion and log mixing caused by the fact that a plurality of processes write one log at the same time are perfectly solved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention as disclosed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
Fig. 1 is a flowchart of a method for generating a process log system for a process name under linux according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of a process log system according to an embodiment of the present invention.
In the figure: 1. a process running module; 2. a pid acquisition interface; 3. a process name interface; 4. a character string splicing module; 5. a default string module; 6. a log system static library.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The invention obtains the process id of the process when the log system runs, then converts the process name, creates the log file by the method of adding text suffix to the name, and realizes the functions of calling the same static library by a plurality of processes and creating different log files.
As shown in fig. 1, the method for generating a process log system for a process name in linux according to the embodiment of the present disclosure optimizes a scheme for creating a log name in a log system, and realizes a function of calling a same static library 6 of the log system by different processes and creating different log files.
The method specifically comprises the following steps:
acquiring a current process pid through a self-carrying pid acquisition interface 2 of the linux system;
acquiring a current process name character string through a lingux system self-carried process name interface 3;
if the acquisition is successful: carrying out character string splicing: "log/" + "current process name" + "log"; calling a log system static library 6 by taking the spliced character string as a file name, and creating a log file;
if the acquisition fails: and setting a log file name by using the default character string and the self-increment information of the calling times of the log system, and ensuring that the log system static library 6 can normally store log information. And then the static library 6 of the log system is called to create a log file.
The technical solution of the present invention is further described below with reference to specific examples.
Examples
The invention provides a method for generating a process log system aiming at a process name under linux, which comprises the following steps:
step 1, running a plurality of processes;
step 2, acquiring the pid of the current process through the pid acquisition interface 2;
step 3, acquiring a current process name character string through the process name interface 3; if the step 4 is successfully executed, skipping the step 5 and executing the step 6; if not, skipping the step 3 and executing the step 5;
step 4, splicing character strings;
step 5, defaulting the character string;
and 6, calling a static library 6 of the log system, and creating a log file.
In an embodiment of the present invention, the pid acquisition interface 2 in step 1 and the process name interface 3 in step 2 are both mounted on a lingux system.
In a preferred embodiment of the present invention, the step 4 of splicing the character strings includes: log/plus current process name plus log.
In a preferred embodiment of the present invention, step 4 uses the spliced character string as a file name, skips step 5, and executes step 6.
In a preferred embodiment of the present invention, the default character string in step 5 is matched with the log system call frequency self-increment information to set the log file name, so that the log system static library 6 normally stores the log information, and then step 6 is executed.
As shown in FIG. 2, the present invention provides a process logging system comprising:
the process running module 1 is used for running a plurality of processes;
a pid acquisition interface 2, configured to acquire a current process pid;
a process name interface 3, configured to obtain a current process name string;
the character string splicing module 4 is used for splicing character strings; the method comprises the following steps: log/adding the name of the current process;
the default character string module 5 is used for defaulting a character string and is also used for setting a log file name in cooperation with the self-increment information of the calling times of the log system so as to enable the log system static library 6 to normally store log information;
and the log system static library 6 is used for creating different log files.
The effects of the present invention will be further described with reference to the experimental results.
On the display interface of the system terminal provided by the invention, the two processes Test1 and Test2 call the same log system static library when running, create logs under the same path log/' and then respectively create independent files and log file names according to the current process name to record the respective logs, thereby achieving the effect of isolating different process logs.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure should be limited only by the attached claims.

Claims (10)

1. A method for generating a process log system aiming at a process name under linux is characterized by comprising the following steps:
when a log system runs, acquiring a process pid of a process, and then converting a process name;
and creating a log file by adding a text suffix to the name of the process name, realizing the function of simultaneously operating the static libraries of the log system of a plurality of processes and respectively writing log information into different log files.
2. The method for generating a process log system for a process name under linux according to claim 1, wherein the method for generating a process log system for a process name under linux specifically comprises:
firstly, running a plurality of processes;
step two, acquiring a current process pid through a pid acquisition interface;
step three, acquiring a current process name character string through a process name interface; if the step four is successfully executed, skipping the step five and executing the step six; if not, skipping the step four and executing the step five;
fourthly, splicing character strings;
step five, defaulting character strings;
and step six, calling a log system static library and creating a log file.
3. The method for generating a process log system for a process name under linux according to claim 1, wherein the pid acquisition interface of step one and the process name interface of step two are mounted on a linux system.
4. The method for generating a process log system for a process name under linux according to claim 1, wherein the character string splicing in step four comprises: log/plus current process name plus log.
5. The method for generating a process log system for a process name under linux according to claim 1, wherein the step four takes the spliced character string as a file name, skips the step five, and executes the step six.
6. The method for generating the process log system aiming at the process name under the linux, which is characterized in that the default character string in the fifth step is matched with the self-increment information of the calling times of the log system to set the log file name so that the static library of the log system normally stores the log information, and then the sixth step is executed.
7. A process log system for implementing the method for generating the process log system aiming at the process name under linux of any one of claims 1 to 6, wherein the process log system comprises:
the process running module is used for running a plurality of processes;
a pid acquisition interface for acquiring the pid of the current process;
the process name interface is used for acquiring a current process name character string;
the character string splicing module is used for splicing character strings; the method comprises the following steps: log/adding the name of the current process;
the default character string module is used for defaulting a character string and is also used for setting a log file name in cooperation with the self-increment information of the calling times of the log system so as to enable the static library of the log system to normally store log information;
and the log system static library is used for creating different log files.
8. A program storage medium for receiving user input, the stored computer program causing an electronic device to perform the method of generating a process log system for a process name according to any one of claims 1 to 6 under linux.
9. An information data processing terminal, characterized in that the information data processing terminal comprises a memory and a processor, the memory stores a computer program, and the computer program, when executed by the processor, causes the processor to execute the method for generating a process log system for process names under linux according to any one of claims 1 to 6.
10. An unmanned aerial vehicle, characterized in that the unmanned aerial vehicle executes the method for generating the progress log system for the progress name under linux according to any one of claims 1 to 6.
CN202110967265.9A 2021-08-23 2021-08-23 Method, system, medium, terminal and unmanned aerial vehicle for generating process log system by process name Pending CN113672465A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110967265.9A CN113672465A (en) 2021-08-23 2021-08-23 Method, system, medium, terminal and unmanned aerial vehicle for generating process log system by process name

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110967265.9A CN113672465A (en) 2021-08-23 2021-08-23 Method, system, medium, terminal and unmanned aerial vehicle for generating process log system by process name

Publications (1)

Publication Number Publication Date
CN113672465A true CN113672465A (en) 2021-11-19

Family

ID=78544996

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110967265.9A Pending CN113672465A (en) 2021-08-23 2021-08-23 Method, system, medium, terminal and unmanned aerial vehicle for generating process log system by process name

Country Status (1)

Country Link
CN (1) CN113672465A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116662045A (en) * 2022-11-18 2023-08-29 荣耀终端有限公司 Process name acquisition method, terminal equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103984621A (en) * 2014-04-01 2014-08-13 广州杰赛科技股份有限公司 Method and system for separating log
CN104038821A (en) * 2014-06-09 2014-09-10 四川长虹电器股份有限公司 Method for uniformly gathering fault information of each functional module of Android television
CN107153695A (en) * 2017-05-05 2017-09-12 恒生电子股份有限公司 Log recording method and device, electronic equipment, storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103984621A (en) * 2014-04-01 2014-08-13 广州杰赛科技股份有限公司 Method and system for separating log
CN104038821A (en) * 2014-06-09 2014-09-10 四川长虹电器股份有限公司 Method for uniformly gathering fault information of each functional module of Android television
CN107153695A (en) * 2017-05-05 2017-09-12 恒生电子股份有限公司 Log recording method and device, electronic equipment, storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116662045A (en) * 2022-11-18 2023-08-29 荣耀终端有限公司 Process name acquisition method, terminal equipment and storage medium

Similar Documents

Publication Publication Date Title
US9274768B2 (en) Runtime code hooking for print driver and functionality testing
JP5415557B2 (en) User script code conversion for debugging
KR101076867B1 (en) Automatic image capture for generating content
US9858091B2 (en) Generating customized on-demand videos from automated test scripts
US8250554B2 (en) Systems and methods for generating and distributing executable procedures for technical desk-side support
CN110531962B (en) Development processing method and device for applet and computer readable storage medium
US20050223360A1 (en) System and method for providing a generic user interface testing framework
CN107577477B (en) DTB file-based multi-platform software version self-adaption method and system
CN108170465B (en) Version information management method, electronic equipment and readable storage medium
US20070169017A1 (en) Method and apparatus for translating an application programming interface (API) call
US20050229161A1 (en) Generic user interface testing framework with load-time libraries
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
CN104503772A (en) Operating system installation and test environment establishment method and device based on virtual machine
US20090125895A1 (en) Re-Using Legacy Libraries in Software
US20050228644A1 (en) Generic user interface testing framework with rules-based wizard
CN117112060A (en) Component library construction method and device, electronic equipment and storage medium
CN113672465A (en) Method, system, medium, terminal and unmanned aerial vehicle for generating process log system by process name
CN111258802A (en) Method for capturing application program crash information and related equipment
CN111061522A (en) Method, device, equipment and storage medium for generating front-end card assembly based on back end
CN113986263A (en) Code automation test method, device, electronic equipment and storage medium
US10977157B2 (en) Enhanced continuous integration (CI)/continuous delivery (CD) build script debugging environment
CN112114811A (en) Compiling method, device and equipment
CN111176718A (en) Script online method and device, storage medium and electronic equipment
CN111026463A (en) Page loading method, device, equipment and storage medium
CN111273956B (en) Program module loading method, device, equipment and 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