CN113110846A - Method and device for acquiring environment variable - Google Patents

Method and device for acquiring environment variable Download PDF

Info

Publication number
CN113110846A
CN113110846A CN202110467477.0A CN202110467477A CN113110846A CN 113110846 A CN113110846 A CN 113110846A CN 202110467477 A CN202110467477 A CN 202110467477A CN 113110846 A CN113110846 A CN 113110846A
Authority
CN
China
Prior art keywords
environment variable
library
dynamic
variable
static
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
CN202110467477.0A
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.)
Netease Media Technology Beijing Co Ltd
Original Assignee
Netease Media Technology Beijing 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 Netease Media Technology Beijing Co Ltd filed Critical Netease Media Technology Beijing Co Ltd
Priority to CN202110467477.0A priority Critical patent/CN113110846A/en
Publication of CN113110846A publication Critical patent/CN113110846A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The application relates to the technical field of computers, and provides an environment variable acquisition method and device, which are used for solving the problems of complex process and time and labor waste in the process of acquiring environment variables, and the method comprises the following steps: when a target log generation request is received, calling a dynamic environment variable acquisition thread to acquire a current dynamic environment variable; and updating the dynamic environment variable of the previous round stored in a preset environment variable library according to the current dynamic environment variable, traversing the static environment variable stored in the updated environment variable library and the dynamic environment variable of the current round, generating an environment variable log, and sending the environment variable log to the back end. An environment variable library for storing and managing environment variables is constructed, the updated environment variable library can be accessed through an access port, an environment variable log is generated, the process of obtaining the environment variables is simplified, the time spent in obtaining the environment variables is saved, and the working efficiency is improved.

Description

Method and device for acquiring environment variable
Technical Field
The application relates to the technical field of computers, and provides a method and a device for acquiring an environment variable.
Background
When a developer is checking the problem of the application program, the developer needs to obtain environment variables in a system for running the application program and know some parameters of the running environment of the application program.
At present, when the problem of an application program is checked, a developer acquires a corresponding log according to a log information identifier, and then screens out environmental parameters from tens of thousands of lines of codes of the log, so that time and labor are wasted, and the working efficiency is low.
Disclosure of Invention
The embodiment of the application provides an environment variable obtaining method and device, and aims to solve the problems that the process for obtaining the environment variable is complex, time-consuming and labor-consuming.
In a first aspect, an embodiment of the present application provides a method for acquiring an environment variable, including:
when a target log generation request is received, calling a dynamic environment variable acquisition thread to acquire a current dynamic environment variable;
updating the dynamic environment variable of the previous round stored in a preset environment variable library according to the current dynamic environment variable;
and traversing the static environment variables stored in the updated environment variable library and the dynamic environment variables of the current round to generate an environment variable log, and sending the environment variable log to the back end.
Optionally, before receiving the target log generation request, the environment variable library is constructed in the following manner:
if an application program running instruction is generated based on the trigger operation of a user, calling a static environment variable acquisition thread to acquire the static environment variable, and storing the static environment variable into an environment variable library;
and if an initial log generation request is received, calling the dynamic environment variable acquisition thread to acquire an initial dynamic environment variable, and storing the initial dynamic environment variable into the environment variable library as the dynamic environment variable of the current round.
Optionally, the invoking the static environment variable obtaining thread to obtain the static environment variable includes:
and calling the static environment variable acquisition thread, and acquiring the static environment variable from an operating system according to preset static environment variable configuration information.
Optionally, the storing the static environment variable into the environment variable library includes:
and calling the static environment variable acquisition thread to access a variable reading interface of the environment variable library, and sending the static environment variable to the environment variable library so as to enable the environment variable library to store the static environment variable.
Optionally, the invoking the dynamic environment variable obtaining thread to obtain an initial dynamic environment variable includes:
and calling the dynamic environment variable thread, and acquiring the initial dynamic environment variable from an operating system according to preset dynamic environment variable configuration information.
Optionally, the step of storing the initial dynamic environment variable as the dynamic environment variable of the current round in an environment variable library includes:
and calling the dynamic environment variable acquisition thread to access a variable reading interface of the environment variable library, and sending the initial dynamic environment variable to the environment variable library so that the environment variable library stores the initial dynamic environment variable as the dynamic environment variable of the current round.
In a second aspect, an embodiment of the present application further provides an apparatus for acquiring an environment variable, including:
the acquisition unit is used for calling a dynamic environment variable acquisition thread to acquire a current dynamic environment variable when a target log generation request is received;
the processing unit is used for updating the dynamic environment variable of the previous round stored in a preset environment variable library according to the current dynamic environment variable;
and the generating unit is used for traversing the static environment variables stored in the updated environment variable library and the dynamic environment variables of the current round, generating an environment variable log and sending the environment variable log to the back end.
Optionally, before receiving the target log generation request, the apparatus further includes a construction unit, where the construction unit constructs the environment variable library in the following manner:
if an application program running instruction is generated based on the trigger operation of a user, calling a static environment variable acquisition thread to acquire the static environment variable, and storing the static environment variable into an environment variable library;
and if an initial log generation request is received, calling the dynamic environment variable acquisition thread to acquire an initial dynamic environment variable, and storing the initial dynamic environment variable into the environment variable library as the dynamic environment variable of the current round.
Optionally, the building unit is configured to:
and calling the static environment variable acquisition thread, and acquiring the static environment variable from an operating system according to preset static environment variable configuration information.
Optionally, the building unit is configured to:
and calling the static environment variable acquisition thread to access a variable reading interface of the environment variable library, and sending the static environment variable to the environment variable library so as to enable the environment variable library to store the static environment variable.
Optionally, the building unit is configured to:
and calling the dynamic environment variable thread, and acquiring the initial dynamic environment variable from an operating system according to preset dynamic environment variable configuration information.
Optionally, the building unit is configured to:
and calling the dynamic environment variable acquisition thread to access a variable reading interface of the environment variable library, and sending the initial dynamic environment variable to the environment variable library so that the environment variable library stores the initial dynamic environment variable as the dynamic environment variable of the current round.
In a third aspect, an embodiment of the present application further provides a computer device, including a processor and a memory, where the memory stores program codes, and when the program codes are executed by the processor, the processor is caused to execute the steps of any one of the above-mentioned method for acquiring an environment variable.
In a fourth aspect, the present application further provides a computer-readable storage medium, which includes program code for causing a computer device to perform the steps of any one of the above-mentioned methods for acquiring an environment variable when the program product runs on the computer device.
The beneficial effect of this application is as follows:
the embodiment of the application provides a method and a device for acquiring an environment variable, wherein the method comprises the following steps: when a target log generation request is received, calling a dynamic environment variable acquisition thread to acquire a current dynamic environment variable; and updating the dynamic environment variable of the previous round stored in a preset environment variable library according to the current dynamic environment variable, traversing the static environment variable stored in the updated environment variable library and the dynamic environment variable of the current round, generating an environment variable log, and sending the environment variable log to the back end. According to the method for acquiring the environment variables, the environment variable library used for storing and managing the environment variables is constructed, the access port used for externally accessing the environment variable library is further provided, the static environment variables stored in the updated environment variable library and the dynamic environment variables of the current round can be accessed through the access port, the environment variable log is generated, the process of acquiring the environment variables is simplified, the time spent in acquiring the environment variables is saved, and the working efficiency is improved.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
FIG. 1a is a schematic flow diagram of the construction of an environment variable library;
FIG. 1b is a logical diagram of the construction of a library of environmental variables;
fig. 2 is a schematic flowchart of a method for acquiring an environment variable according to an embodiment of the present application;
FIG. 3a is a schematic flowchart of acquiring an environment variable for a troubleshooting scenario in an embodiment of the present application;
FIG. 3b is a logic diagram of acquiring environment variables for a troubleshooting scenario in an embodiment of the present application;
FIG. 3c is a logic diagram of acquiring environment variables for a troubleshooting scenario in the related art;
fig. 4a is a schematic flowchart of acquiring an environment variable for a development scenario in an embodiment of the present application;
FIG. 4b is a logic diagram of obtaining environment variables for a development scenario in an embodiment of the present application;
FIG. 4c is a logic diagram of acquiring environment variables for a development scenario in the related art;
fig. 5 is a schematic structural diagram of an apparatus for acquiring an environmental variable according to an embodiment of the present disclosure;
FIG. 6 is a schematic structural diagram of a computer device in an embodiment of the present application;
fig. 7 is a schematic diagram of a hardware component of a computing device to which an embodiment of the present invention is applied.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments, but not all embodiments, of the technical solutions of the present application. All other embodiments obtained by a person skilled in the art without any inventive step based on the embodiments described in the present application are within the scope of the protection of the present application.
When a developer is checking problems of an application program or developing the application program, the developer needs to obtain environment variables in a system for running the application program and know some parameters of the running environment of the application program.
When the problem of the application program is checked, a developer acquires a corresponding log according to the log information identifier and screens out environmental parameters from the codes of the ten thousand lines of the log, so that time and labor are wasted, and the working efficiency is low; when an application program is developed, developers use a tool method to continuously obtain the same environment variables from the system API layer aiming at each service to be developed, the time and the labor are consumed, process resources are occupied, and the working efficiency is reduced.
Due to the adoption of the method, the process of acquiring the environment variable is complex, time-consuming and labor-consuming, and the application provides the method and the device for acquiring the environment variable. The method comprises the following steps: when an application program running on the intelligent terminal receives a target log generation request, updating the dynamic environment variable of the previous round stored in a preset environment variable library according to the obtained current dynamic environment variable, traversing the updated environment variable library to generate an environment variable log, and sending the environment variable log to the back end.
Therefore, before describing the method for acquiring environment variables provided in the embodiment of the present application, referring to the flowchart illustrated in fig. 1a and the logic diagram illustrated in fig. 1b, a process of constructing an environment variable library is described.
The environment variable library comprises two types of environment variables, namely static environment variables and dynamic environment variables, wherein the environment variables which are kept unchanged in a life cycle are generally called static environment variables, and the environment variables which can change in real time in the life cycle are generally called dynamic environment variables. Due to the characteristics of the two types of environment variables, the two types of environment variables are obtained in different manners. The static environment variable acquiring thread for acquiring the static environment variable and the dynamic environment variable acquiring thread for acquiring the dynamic environment variable are in a multithread relation running in parallel.
S101: and if the application program running instruction is generated based on the trigger operation of the user, calling a static environment variable acquisition thread to acquire a static environment variable, and storing the static environment variable into an environment variable library.
The user can trigger operations such as touch operations (e.g., clicking a screen, double-clicking a screen, sliding a screen, and the like), voice control operations (e.g., sending a control instruction of "starting a music application" to a voice assistant running on the intelligent terminal so that the voice assistant starts a corresponding music application based on the control instruction), gesture controls (e.g., drawing a specific graph on the screen by using a finger, a finger joint, or a screen stylus pen; e.g., pulling down the screen by three fingers, starting a specific application, and the like), and the like, so that an operating system running on the intelligent terminal generates an application running instruction so that the operating system starts the corresponding application based on the application running instruction. The intelligent terminal is an electronic device used by a user, and the electronic device can be a personal computer, a mobile phone, a tablet computer, a notebook, an electronic book reader, an intelligent home and other computer devices with certain computing capability.
And when the operating system generates an application program running instruction based on the triggering operation of the user, the corresponding application program is started to provide application service for the user. The application program can call a static environment variable obtaining thread, and obtain the static environment variable from a system API layer corresponding to the operating system according to preset static environment variable configuration information. Specifically, the static environment variable configuration information at least includes basic information of an application program, screen information of an intelligent terminal, system information of an operating application program, and custom static environment variable configuration information, and the corresponding static environment variables at least include: the method comprises the following steps of developing manufacturers of the application programs, version information of the opened application programs, the screen size of the intelligent terminal, version information of an operating system of the intelligent terminal and attribute values of custom static environment variables. The static environment variables comprise the static environment variables of the application program and the static environment variables in an operating system running the application program, and the self-defined static environment configuration information is one type of static environment variable configuration information self-defined by developers and at least comprises the attributes of the self-defined static environment variables and corresponding attribute values.
After obtaining the static environment variable, the application program calls the static environment variable obtaining thread, accesses a variable reading interface of the environment variable library (i.e. adds an Add interface), and sends the static environment variable to the environment variable library, so that the environment variable library stores the static environment variable. In order to facilitate query and management, each static environment variable is stored in an environment variable library in a classified manner according to the static environment variable configuration information.
S102: and if an initial log generation request is received, calling a dynamic environment variable acquisition thread to acquire an initial dynamic environment variable, and storing the initial dynamic environment variable as the dynamic environment variable of the current round in an environment variable library.
And the problem troubleshooting personnel or the developers send an initial log generation request to the application program running on the intelligent terminal through the operation of the back end. And when receiving an initial log generation request, the application program calls a dynamic environment variable acquisition thread, and acquires an initial dynamic environment variable from a system API layer corresponding to the operating system according to preset dynamic environment variable configuration information. The dynamic environment variable configuration information includes at least: the method comprises the following steps of running information of an application program, Central Processing Unit (CPU) information, patch information and user-defined dynamic environment variable configuration information, wherein the corresponding dynamic environment variables at least comprise: information of an application program running in the front end, information of each application program running in the background, Memory information (including occupied Memory and unoccupied Memory), Secure Digital Card (SD) storage information, patch information of the operating system, patch information of the application program, and attribute values of the customized dynamic environment variables. The dynamic environment variables comprise the dynamic environment variables of the application program and the dynamic environment variables in an operating system running the application program, and the self-defined dynamic environment configuration information is one type of dynamic environment variable configuration information self-defined by developers and at least comprises the attributes of the self-defined dynamic environment variables and corresponding attribute values.
After the initial dynamic environment variable is obtained, the application program calls a dynamic environment variable obtaining thread, accesses a variable reading interface of the environment variable library (namely, adds an Add interface), and sends the initial dynamic environment variable to the environment variable library, so that the environment variable library stores the initial dynamic environment variable. And in order to facilitate query and management, each initial dynamic environment variable is stored in an environment variable library in a classified manner according to the dynamic environment variable configuration information.
Referring to a flow chart diagram shown in fig. 2, a method for obtaining an environment variable based on a constructed environment variable library provided in an embodiment of the present application is described.
S201: and when a target log generation request is received, calling a dynamic environment variable acquisition thread to acquire the current dynamic environment variable.
And the problem troubleshooting personnel or the developers send a target log generation request to the application program running on the intelligent terminal through the operation of the back end. Due to the characteristic of real-time updating of the dynamic environment variable, when the application program receives a target log generation request, the application program calls a dynamic environment variable obtaining thread and obtains the current dynamic environment variable according to the dynamic environment variable configuration information.
S202: and updating the dynamic environment variable of the previous round stored in a preset environment variable library according to the current dynamic environment variable.
The application program calls the dynamic environment variable obtaining thread, accesses a variable reading interface (namely an Add interface) of the environment variable library, sends the current dynamic environment variable to the environment variable library, and updates and replaces the dynamic environment variable of the previous round stored in the environment variable library, so that the latest dynamic environment variable can be stored in the environment variable library before the environment variable log is generated.
S203: and traversing the static environment variables stored in the updated environment variable library and the dynamic environment variables of the current round to generate an environment variable log, and sending the environment variable log to the back end.
And the application program sequentially traverses the static environment variables stored in the updated environment variable library and the dynamic environment variables of the current round, and when one environment variable is traversed, specific contents such as the attribute, the attribute value and the like of the environment variable are printed in an environment variable log until all the environment variables stored in the environment variable library are traversed, the environment variable log is generated, the environment variable log is compressed and uploaded to a server, the server forwards the environment variable log to equipment used by a problem troubleshooting worker or a developer, and the equipment displays the generated environment variable log, so that the problem troubleshooting worker or the developer troubleshoots the problems of the application program or develops the application program based on the environment variable log.
Specific embodiments are given for different application scenarios, and the use process of the environment variable library in the application scenario is described.
The first embodiment is as follows: a troubleshooting scenario for application problems.
The process of the first embodiment will be described with reference to the flow diagram of fig. 3a and the logic diagram of fig. 3 b.
S301: a problem troubleshooting worker sends a troubleshooting log generation request (such as a target log generation request) to an application program running on the intelligent terminal through operation at the back end;
s302: when an application program receives a troubleshooting log generation request sent by a problem troubleshooting worker, calling a dynamic environment variable acquisition thread to acquire a current dynamic environment variable;
s303: the application program updates the dynamic environment variable of the previous round stored in a preset environment variable library according to the current dynamic environment variable;
s304: and traversing the static environment variables stored in the updated environment variable library and the dynamic environment variables of the current round by the application program to generate an environment variable log, and sending the environment variable log to the back end so as to send the environment variable log to the problem troubleshooting personnel.
In the related art, a management method of an environment variable is not provided, so that an application program developed by a developer can only write an environment variable identifier into a log, and then set a specific log information identifier for the log written with the environment variable identifier, so that a problem troubleshooting worker can quickly obtain the environment variable from thousands of lines of log codes in the future.
As can be seen from the logic diagram shown in fig. 3c, in the method for acquiring environment variables provided in the related art for a troubleshooting scene, when a problem troubleshooting person needs to acquire an environment variable, the environment variable is acquired in a corresponding log according to a log information identifier and an environment variable identifier provided by a developer, or the problem troubleshooting person manually screens thousands of lines of log codes to acquire the corresponding environment variable in the case of not acquiring the log information identifier and the environment variable identifier.
Compared with the method for acquiring the environment variables provided by the related art for the investigation scene, the method for acquiring the environment variables provided by the embodiment of the application constructs the environment variable library for storing and managing the environment variables, also provides the access port for externally accessing the environment variable library, can access the static environment variables stored in the updated environment variable library and the dynamic environment variables of the previous round through the access port to generate the environment variable log, simplifies the process for acquiring the environment variables, saves the time spent on acquiring the environment variables, and improves the working efficiency.
The second embodiment is as follows: to a development scenario for developing an application.
The process of the second embodiment will be described with reference to the flow diagram shown in fig. 4a and the logic diagram shown in fig. 4 b.
S401: a developer sends a development log generation request (such as a target log generation request) to an application program running on the intelligent terminal through the operation of a back end;
s402: when receiving a development log generation request sent by a developer, an application program calls a dynamic environment variable acquisition thread to acquire a current dynamic environment variable;
s403: the application program updates the dynamic environment variable of the previous round stored in a preset environment variable library according to the current dynamic environment variable;
s404: and traversing the static environment variables stored in the updated environment variable library and the dynamic environment variables of the current round by the application program to generate an environment variable log, and sending the environment variable log to the back end so as to send the environment variable log to developers.
As can be seen from the logic diagram shown in fig. 4c, in the method for acquiring environment variables provided for a development scenario in the related art, when a developer needs to acquire environment variables for each service to be developed, the developer either finds a corresponding tool method and continuously acquires the same environment variables from the system API layer, or queries other developers to acquire a corresponding tool method and continuously acquires the same environment variables from the system API layer.
Compared with the method for acquiring the environment variables provided by the related art for the development scene, the method for acquiring the environment variables provided by the embodiment of the application constructs the environment variable library for storing and managing the environment variables, also provides the access port for externally accessing the environment variable library, can access the static environment variables stored in the updated environment variable library and the dynamic environment variables of the current round through the access port, generates the environment variable log, and does not need to repeatedly access the system API layer to acquire the same environment variables.
Based on the same inventive concept as the above method embodiment, the present application embodiment further provides an apparatus for acquiring an environmental variable, which, referring to the schematic structural diagram shown in fig. 5, may include an acquiring unit 501, a processing unit 502, a generating unit 503, and a constructing unit 504, wherein,
an obtaining unit 501, configured to, when a target log generation request is received, invoke a dynamic environment variable obtaining thread to obtain a current dynamic environment variable;
a processing unit 502, configured to update a previous round of dynamic environment variables stored in a preset environment variable library according to the current dynamic environment variable;
the generating unit 503 is configured to traverse the static environment variables stored in the updated environment variable library and the dynamic environment variables of the current round, generate an environment variable log, and send the environment variable log to the back end.
Optionally, before receiving the target log generation request, the apparatus further includes a constructing unit 504, where the constructing unit 504 constructs the environment variable library by using the following method:
if an application program running instruction is generated based on the trigger operation of a user, calling a static environment variable acquisition thread to acquire the static environment variable, and storing the static environment variable into an environment variable library;
and if an initial log generation request is received, calling the dynamic environment variable acquisition thread to acquire an initial dynamic environment variable, and storing the initial dynamic environment variable into the environment variable library as the dynamic environment variable of the current round.
Optionally, the constructing unit 504 is configured to:
and calling the static environment variable acquisition thread, and acquiring the static environment variable from an operating system according to preset static environment variable configuration information.
Optionally, the constructing unit 504 is configured to:
and calling the static environment variable acquisition thread to access a variable reading interface of the environment variable library, and sending the static environment variable to the environment variable library so as to enable the environment variable library to store the static environment variable.
Optionally, the constructing unit 504 is configured to:
and calling the dynamic environment variable thread, and acquiring the initial dynamic environment variable from an operating system according to preset dynamic environment variable configuration information.
Optionally, the constructing unit 504 is configured to:
and calling the dynamic environment variable acquisition thread to access a variable reading interface of the environment variable library, and sending the initial dynamic environment variable to the environment variable library so that the environment variable library stores the initial dynamic environment variable as the dynamic environment variable of the current round.
For convenience of description, the above parts are separately described as modules (or units) according to functional division. Of course, the functionality of the various modules (or units) may be implemented in the same one or more pieces of software or hardware when implementing the present application.
Having described the method and apparatus for obtaining environment variables according to exemplary embodiments of the present application, a computer device according to another exemplary embodiment of the present application is described next.
As will be appreciated by one skilled in the art, aspects of the present application may be embodied as a system, method or program product. Accordingly, various aspects of the present application may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
Based on the same inventive concept as the above method embodiment, in the embodiment of the present application, a computer device is further provided, and referring to fig. 6, the apparatus 600 for obtaining an environment variable may at least include a processor 601 and a memory 602. The memory 602 stores program codes, and when the program codes are executed by the processor 601, the processor 601 executes the steps of any one of the above-mentioned method for acquiring environment variables.
In some possible implementations, a computing device according to the present application may include at least one processor, and at least one memory. The memory stores therein program code which, when executed by the processor, causes the processor to perform the steps of the method for acquiring environment variables according to various exemplary embodiments of the present application described above in the present specification. For example, a processor may perform the steps as shown in fig. 2.
A computing device 700 according to this embodiment of the present application is described below with reference to fig. 7. The computing device 700 of fig. 7 is only one example and should not be taken to limit the scope of use and functionality of embodiments of the present application.
As shown in fig. 7, computing device 700 is embodied in the form of a general purpose computing device. Components of computing device 500 may include, but are not limited to: the at least one processing unit 701, the at least one memory unit 702, and a bus 703 that couples various system components including the memory unit 702 and the processing unit 701.
The bus 703 includes a data bus, an address bus, and a control bus.
The storage unit 702 may include readable media in the form of volatile memory, such as Random Access Memory (RAM)7021 and/or cache storage unit 7022, and may further include Read Only Memory (ROM) 7023.
Storage unit 702 may also include a program/utility 7025 having a set (at least one) of program modules 7024, such program modules 7024 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
The computing arrangement 700 may also communicate with one or more external devices 704, such as a keyboard, pointing device, etc., which may be via input/output (I/O) interfaces 705. Moreover, the computing device 700 may also communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 706. As shown, the network adapter 706 communicates with the other modules for the computing device 700 over a bus 703. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with computing device 700, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
On the basis of the same inventive concept as the above method embodiments, the various aspects of the method for acquiring an environment variable provided by the present application may also be implemented in the form of a program product including program code for causing a computer device to perform the steps in the method for acquiring an environment variable according to the various exemplary embodiments of the present application described above in this specification when the program product is run on the computer device, for example, the computer device may perform the steps as shown in fig. 2.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (10)

1. An environment variable acquisition method, comprising:
when a target log generation request is received, calling a dynamic environment variable acquisition thread to acquire a current dynamic environment variable;
updating the dynamic environment variable of the previous round stored in a preset environment variable library according to the current dynamic environment variable;
and traversing the static environment variables stored in the updated environment variable library and the dynamic environment variables of the current round to generate an environment variable log, and sending the environment variable log to the back end.
2. The method of claim 1, wherein the environment variable library is built prior to receiving a target log generation request by:
if an application program running instruction is generated based on the trigger operation of a user, calling a static environment variable acquisition thread to acquire the static environment variable, and storing the static environment variable into an environment variable library;
and if an initial log generation request is received, calling the dynamic environment variable acquisition thread to acquire an initial dynamic environment variable, and storing the initial dynamic environment variable into the environment variable library as the dynamic environment variable of the current round.
3. The method of claim 2, wherein invoking the static environment variable acquisition thread to acquire the static environment variable comprises:
and calling the static environment variable acquisition thread, and acquiring the static environment variable from an operating system according to preset static environment variable configuration information.
4. The method of claim 2 or 3, wherein said storing the static environment variables into the environment variable library comprises:
and calling the static environment variable acquisition thread to access a variable reading interface of the environment variable library, and sending the static environment variable to the environment variable library so as to enable the environment variable library to store the static environment variable.
5. The method of claim 2, wherein said invoking the dynamic environment variable acquisition thread to acquire an initial dynamic environment variable comprises:
and calling the dynamic environment variable thread, and acquiring the initial dynamic environment variable from an operating system according to preset dynamic environment variable configuration information.
6. The method of claim 2 or 5, wherein storing the initial dynamic environment variable as a current round of dynamic environment variable in an environment variable library comprises:
and calling the dynamic environment variable acquisition thread to access a variable reading interface of the environment variable library, and sending the initial dynamic environment variable to the environment variable library so that the environment variable library stores the initial dynamic environment variable as the dynamic environment variable of the current round.
7. An apparatus for acquiring an environment variable, comprising:
the acquisition unit is used for calling a dynamic environment variable acquisition thread to acquire a current dynamic environment variable when a target log generation request is received;
the processing unit is used for updating the dynamic environment variable of the previous round stored in a preset environment variable library according to the current dynamic environment variable;
and the generating unit is used for traversing the static environment variables stored in the updated environment variable library and the dynamic environment variables of the current round, generating an environment variable log and sending the environment variable log to the back end.
8. The apparatus of claim 7, wherein prior to receiving a target log generation request, the apparatus further comprises a construction unit that constructs the environment variable library by:
if an application program running instruction is generated based on the trigger operation of a user, calling a static environment variable acquisition thread to acquire the static environment variable, and storing the static environment variable into an environment variable library;
and if an initial log generation request is received, calling the dynamic environment variable acquisition thread to acquire an initial dynamic environment variable, and storing the initial dynamic environment variable into the environment variable library as the dynamic environment variable of the current round.
9. A computer device, characterized in that it comprises a processor and a memory, wherein the memory stores program code which, when executed by the processor, causes the processor to carry out the steps of the method according to any one of claims 1 to 6.
10. Computer-readable storage medium, characterized in that it comprises program code for causing a computer device to carry out the steps of the method according to any one of claims 1 to 6, when said program product is run on said computer device.
CN202110467477.0A 2021-04-28 2021-04-28 Method and device for acquiring environment variable Pending CN113110846A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110467477.0A CN113110846A (en) 2021-04-28 2021-04-28 Method and device for acquiring environment variable

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110467477.0A CN113110846A (en) 2021-04-28 2021-04-28 Method and device for acquiring environment variable

Publications (1)

Publication Number Publication Date
CN113110846A true CN113110846A (en) 2021-07-13

Family

ID=76720488

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110467477.0A Pending CN113110846A (en) 2021-04-28 2021-04-28 Method and device for acquiring environment variable

Country Status (1)

Country Link
CN (1) CN113110846A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116522036A (en) * 2023-07-04 2023-08-01 北京智麟科技有限公司 Environment variable construction method based on multi-party information summarized at webpage end

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116522036A (en) * 2023-07-04 2023-08-01 北京智麟科技有限公司 Environment variable construction method based on multi-party information summarized at webpage end
CN116522036B (en) * 2023-07-04 2023-08-29 北京智麟科技有限公司 Environment variable construction method based on multi-party information summarized at webpage end

Similar Documents

Publication Publication Date Title
CN108427705B (en) Electronic device, distributed system log query method and storage medium
EP3974962A1 (en) Method, apparatus, electronic device, readable storage medium and program for deploying application
CN109446570B (en) Business process display method, device, computer equipment and storage medium
CN109902255B (en) Page mixed browsing record generation method, device, equipment and storage medium
CN109471626B (en) Page logic structure, page generation method, page data processing method and device
CN110520844A (en) Cloud management platform, virtual machine management method and its system
WO2023066182A1 (en) File processing method and apparatus, device, and storage medium
CN114489512A (en) Method and device for limiting container capacity, electronic equipment and storage medium
JP2021515299A (en) A system for chronological out-of-place updates, a method for chronological out-of-place updates, and a computer program for chronological out-of-place updates.
CN112256676A (en) Method, device, equipment and medium for migrating database
CN109117153A (en) Processing method, device, terminal and the storage medium of application program
CN114461223A (en) Code generation method and device and terminal equipment
CN111159301A (en) Data creating method, device, equipment and storage medium based on intelligent contract
CN101136780A (en) Method, system to obtain user command information, and user command registered device
CN113110846A (en) Method and device for acquiring environment variable
JP2021515304A (en) Methods, computer programs, and equipment for post-failure recovery using checkpoints in key-value stores in a time-series log structure in the system.
CN112395437B (en) 3D model loading method and device, electronic equipment and storage medium
CN109656936A (en) Method of data synchronization, device, computer equipment and storage medium
CN108984238A (en) Gesture processing method, device and the electronic equipment of application program
CN113094367A (en) Data processing method and device and server
CN112764729A (en) Application software development method and device, computer equipment and readable storage medium
CN112148712A (en) Data processing method, device, equipment and medium
CN111813407A (en) Game development method, game running device and electronic equipment
CN112306723A (en) Operation information acquisition method and device applied to small program
JP2021515301A (en) Methods for recovery from failures during garbage collection in the system, computer programs and equipment for recovery from failures during garbage collection in the system.

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