CN115630033A - Log information processing method and device, electronic equipment and medium - Google Patents

Log information processing method and device, electronic equipment and medium Download PDF

Info

Publication number
CN115630033A
CN115630033A CN202211186402.6A CN202211186402A CN115630033A CN 115630033 A CN115630033 A CN 115630033A CN 202211186402 A CN202211186402 A CN 202211186402A CN 115630033 A CN115630033 A CN 115630033A
Authority
CN
China
Prior art keywords
log
log information
message queue
processing
information
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
CN202211186402.6A
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.)
China Construction Bank Corp
CCB Finetech Co Ltd
Original Assignee
China Construction Bank Corp
CCB Finetech 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 China Construction Bank Corp, CCB Finetech Co Ltd filed Critical China Construction Bank Corp
Priority to CN202211186402.6A priority Critical patent/CN115630033A/en
Publication of CN115630033A publication Critical patent/CN115630033A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems
    • 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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The disclosure provides a log information processing method, a log information processing device, log information processing equipment, a log information storage medium and a log information processing program product, relates to the technical field of task scheduling, and can be applied to the technical field of finance. The method comprises the following steps: in response to receiving an instruction to output log information, obtaining a plurality of log information output by each of a plurality of application threads; sequentially distributing each log information in the plurality of log information to a corresponding message queue; acquiring log information at the head of the message queue through a log processing thread corresponding to the message queue; and storing the log information into a designated log file.

Description

Log information processing method and device, electronic equipment and medium
Technical Field
The present disclosure relates to the field of task scheduling technologies, and more particularly, to a method, an apparatus, a device, a medium, and a program product for processing log information.
Background
During operation, a service system often needs to output a large amount of log files for problem processing or post analysis. The prior art generally outputs the system log by the following two methods: and (1) applying the synchronous output log. This way, the application is in a state of waiting for system IO at the time of log output. For a scene of a large amount of log output during a service peak period, service response time will be remarkably increased, and system performance is affected. And (2) asynchronously outputting the log in a cache mode. The method is that a buffer space is opened up in the memory, the log to be written is written into the buffer memory and then is applied to continue the service processing, and then the independent log processing thread asynchronously reads the buffer memory content and writes the content into the log file. Since the speed of accessing the cache by the application is much faster than the speed of writing the disk file, the service response time is not affected. However, this approach has three disadvantages: 1. when the speed of reading the cache log and writing the file is far less than the increasing speed of the cache log, the cache space can increase rapidly, so that the application occupies a large amount of memory; 2. when high-service concurrent processing exists, a plurality of service processing logs appear in a log file in a crossed manner, and the logs are messy and difficult to check; 3. if the application terminates abnormally, the cache content will be lost, which causes the service missing log to occur, and the running risk is faced.
Disclosure of Invention
In view of the above problems, the present disclosure provides a method, an apparatus, a device, a medium, and a program product for processing log information, which may set a corresponding message queue for log information output by each application thread when dealing with high concurrent service system log processing, and optimize a recording order, data persistence, and accumulation capacity of logs by sequentially allocating each of the plurality of log information to the corresponding message queue; acquiring log information at the head of a message queue by a log processing thread corresponding to the message queue; and the log information is stored in a designated log file, so that the execution logs of each thread can be sequentially generated into independent log files, and the readability of the log files can be improved.
According to a first aspect of the present disclosure, there is provided a method for processing log information, including: in response to receiving an instruction to output log information, obtaining a plurality of log information output by each of the plurality of application threads; sequentially distributing each log information in the plurality of log information to a corresponding message queue; acquiring log information at the head of a message queue through a log processing thread corresponding to the message queue; and storing the log information into a designated log file.
According to an embodiment of the present disclosure, the log information includes a log identifier; the storing the log information into a designated log file includes: determining whether a log header exists in the message queue; and under the condition that the message queue is determined to have the log header, storing the log header and the log information to a log file corresponding to the log identifier according to the log identifier.
According to an embodiment of the present disclosure, in a case that it is determined that a log header exists in the message queue, storing the log header and the log information to a log file corresponding to the log identifier according to the log identifier includes: acquiring a serial number in the log header, and determining whether a specified log file corresponding to the serial number exists or not; under the condition that the designated log file corresponding to the serial number does not exist, creating a log file corresponding to the serial number; and storing the log information to the log file corresponding to the serial number.
According to the embodiment of the present disclosure, the method for processing log information further includes: and releasing the storage space of the log information in the message queue in response to the fact that the log information is stored to the designated log file completely.
According to the embodiment of the present disclosure, the method for processing log information further includes: generating a log head corresponding to a log processing thread while creating the log processing thread; and sending the log header to the message queue.
A second aspect of the present disclosure provides a log information processing apparatus, including: a first obtaining module, configured to obtain, in response to receiving an instruction to output log information, a plurality of pieces of log information output by each of a plurality of application threads; the distribution module is used for sequentially distributing each log information in the plurality of log information to the corresponding message queue; the second acquisition module is used for acquiring the log information at the head of the message queue through the log processing thread corresponding to the message queue; and the processing module is used for storing the log information into a specified log file.
A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the above-mentioned log information processing method.
The fourth aspect of the present disclosure also provides a computer-readable storage medium having stored thereon executable instructions, which when executed by a processor, cause the processor to perform the above-mentioned processing method of log information.
The fifth aspect of the present disclosure also provides a computer program product comprising a computer program which, when executed by a processor, implements the above-described method of processing log information.
When handling the log of the high concurrency service system, the processing method for the log information provided by this embodiment may set a corresponding message queue for the log information output by each application thread, and optimize the recording order, data persistence and accumulation capacity of the log by sequentially allocating each of the plurality of log information to the corresponding message queue; acquiring log information at the head of a message queue by a log processing thread corresponding to the message queue; and the log information is stored in a designated log file, so that the execution logs of each thread can be sequentially generated into independent log files, and the readability of the log files can be improved.
Drawings
The foregoing and other objects, features and advantages of the disclosure will be apparent from the following description of embodiments of the disclosure, taken in conjunction with the accompanying drawings of which:
fig. 1 schematically illustrates an application scenario diagram of a method, apparatus, device, medium, and program product for processing log information according to an embodiment of the present disclosure;
FIG. 2 schematically shows a flow chart of a method of processing log information according to an embodiment of the present disclosure;
FIG. 3 schematically shows a flow chart of a method of processing log information according to another embodiment of the present disclosure;
FIG. 4 schematically illustrates a flow chart of a method of processing log information according to yet another embodiment of the present disclosure;
fig. 5 schematically shows a block diagram of a configuration of a processing apparatus of log information according to an embodiment of the present disclosure; and
fig. 6 schematically shows a block diagram of an electronic device adapted to implement a method of processing log information according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that these descriptions are illustrative only and are not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B, and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B, and C" would include but not be limited to systems that have A alone, B alone, C alone, A and B together, A and C together, B and C together, and/or A, B, and C together, etc.).
The embodiment of the disclosure provides a method and a device for processing log information, which respond to the received instruction for outputting the log information and acquire a plurality of pieces of log information output by a plurality of application threads respectively; sequentially distributing each log information in the plurality of log information to a corresponding message queue; acquiring log information at the head of a message queue through a log processing thread corresponding to the message queue; and storing the log information into a designated log file.
Fig. 1 schematically illustrates an application scenario diagram of a log information processing method, apparatus, device, medium, and program product according to an embodiment of the present disclosure.
As shown in fig. 1, the application scenario 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. Network 104 is the medium used to provide communication links between terminal devices 101, 102, 103 and server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (for example only) providing support for websites browsed by users using the terminal devices 101, 102, 103. The background management server may analyze and perform other processing on the received data such as the user request, and feed back a processing result (e.g., a webpage, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that the processing method of the log information provided by the embodiment of the present disclosure may be generally executed by the server 105. Accordingly, the processing device of log information provided by the embodiment of the present disclosure may be generally disposed in the server 105. The processing method of the log information provided by the embodiment of the present disclosure may also be executed by a server or a server cluster that is different from the server 105 and is capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Accordingly, the processing device for log information provided by the embodiment of the present disclosure may also be disposed in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and/or the server 105.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
The method for processing log information of the disclosed embodiment will be described in detail below with reference to fig. 2 based on the scenario described in fig. 1.
Fig. 2 schematically shows a flowchart of a method of processing log information according to an embodiment of the present disclosure.
As shown in fig. 2, the embodiment includes operations S210 to S240, and the processing method of the log information may be performed by the server.
In the technical scheme of the disclosure, the data acquisition, collection, storage, use, processing, transmission, provision, disclosure, application and other processing are all in accordance with the regulations of relevant laws and regulations, necessary security measures are taken, and the public order and good custom are not violated.
In operation S210, a plurality of log information output by each of a plurality of application threads is acquired in response to receiving an instruction to output the log information.
In operation S220, each of the plurality of log information is sequentially allocated to a corresponding message queue.
In operation S230, log information located at the head of the message queue is acquired via a log processing thread corresponding to the message queue.
In operation S240, the log information is stored into the designated log file.
For example, in a highly concurrent business system, a large amount of log information is generated during the running of a plurality of application threads. A corresponding message queue may be established for the log information output by each application thread.
Message queues are also often referred to as message middleware. The data (message) to be transmitted is put in a queue, and the message transmission between the application programs is realized by using a queue mechanism of first-in first-out. Common message middleware are ActiveMQ, zeroMQ, rabbitMQ, rockattMQ, kafka, etc. The message queue may be used to receive the cache log.
A corresponding log processing thread may be allocated and established for each message queue, and the log processing thread is used to continuously read the corresponding message queue, that is, to obtain the log information located at the head of the message queue. The read log information may be written into a log file corresponding to the task, that is, the log information may be stored into a designated log file.
Fig. 3 schematically shows a flowchart of a processing method of log information according to another embodiment of the present disclosure, referring to fig. 3. There are multiple concurrent tasks, task 1 through task N, in the business system, resulting in a large amount of log information. The log queues, i.e., log queue 1 to log queue N, respectively corresponding to each task are used for caching a plurality of pieces of log information output by a plurality of application threads respectively. And the log processing threads (1-N) read the log information in each log queue through an API (application program interface) interface and respectively designate the read log information in log files, namely the log files 1-N. In this embodiment, for a multitask system, a plurality of MQ queues are used to cache log information respectively, so as to accelerate the processing speed of the log; and the service log is cached by using independent message middleware, so that the service processing and the log processing are decoupled, and the response time of the system is prolonged.
When dealing with high-concurrency service system log processing, the processing method of log information provided by this embodiment may set a corresponding message queue for log information output by each application thread, and optimize the recording order, data persistence and accumulation capability of logs by sequentially allocating each of the plurality of log information to the corresponding message queue; acquiring log information at the head of a message queue by a log processing thread corresponding to the message queue; and the log information is stored in a designated log file, so that the execution logs of each thread can be sequentially generated into independent log files, and the readability of the log files can be improved.
The log information comprises a log identifier; storing the log information into a designated log file, including: determining whether a log header exists in a message queue; and under the condition that the log header exists in the message queue, storing the log header and the log information to a log file corresponding to the log identifier according to the log identifier.
The log information includes log identifiers, for example, the log identifiers may be F and D; the F may be agreed to indicate that the log information is output to the global log file, and the D may be agreed to indicate that the log information is output to the thread log file.
It is understood that, at the same time of creating the log processing thread, a log header corresponding to the log processing thread is generated and then sent to the message queue.
For example, the log processing thread i may continuously read the MQ message queue i, and first determine whether a log header exists for the read message; if no log header exists, corresponding log content can be directly written into the log file name corresponding to the task i. If the log header exists, both the log header and the log content can be written into the log file name corresponding to the task i.
In the method for processing log information provided in this embodiment, when it is determined that a log header exists in the message queue, the log header and the log information are stored in a log file corresponding to the log identifier according to the log identifier, which is beneficial to safely, efficiently and orderly outputting a plurality of log information in a high-concurrency system.
Under the condition that the message queue is determined to have the log header, the log header and the log information are stored into a log file corresponding to the log identifier according to the log identifier, and the method comprises the following steps: acquiring a serial number in a log header, and determining whether a specified log file corresponding to the serial number exists or not; under the condition that the designated log file corresponding to the serial number does not exist, creating a log file corresponding to the serial number; and storing the log information to a log file corresponding to the serial number.
For example, a log output format may be defined first, for example, the log format output to the MQ message queue is [ log id-global serial number ] < log content >. It should be noted that [ log id-global serial number ] is log header information, and may be valid only for multi-threaded concurrent tasks, and a log header is not needed for single-threaded tasks. If the log mark is F, the log is output to the global log file, and if the log mark is D, the log is output to the thread log file. The global water number, i.e. the water number in the log header, can be generated at thread creation time and needs to be unique at any time.
Specifically, firstly, an MQ message queue is configured in advance according to the number of tasks of the service system for receiving a cache log; then, a service system is started, and if a plurality of tasks are started, system service processing is carried out; if the processing task i is directed, whether multi-thread concurrent processing exists is judged firstly, if the multi-thread concurrent processing does not exist, the processing task is a single-thread task, and the service log information can be directly output to the MQ message queue i according to the format < r log content >; if there is multi-thread concurrent processing, for a multi-thread task, when creating each processing thread j for the task i, it is necessary to generate a global serial number of the thread j, and output a log "[ F-global serial number ] < New thread create >" to the MQ message queue i.
For example, when a thread j starts to process a specific service, service key information (such as a batch number, a service serial number, and the like) needs to be output to an MQ message queue i by a log "[ F-global serial number ] < log content >"; the output format of other processing logs of the thread j is 'D-global serial number' < log content >; and outputting a log format (F-global serial number) to be threaded exit when the Thread j finishes exiting.
After the log processing module is started, N log processing threads are established corresponding to the number of the MQ message queues; each log processing thread i continuously reads the MQ message queue i, and whether a log header exists or not is firstly judged for the read message:
(1) When no log header exists, directly writing the log content into the log file name corresponding to the task i;
(2) When a log head exists, if the log identification bit is F, writing the log head and the log content into a log file name corresponding to the task i; if the log identification bit is D, the global serial number in the log header is taken, if a file named by the global serial number exists, the log content is directly written into the file, otherwise, the log content is written into after the file is newly built by the global serial number.
Fig. 4 schematically shows a flowchart of a processing method of log information according to still another embodiment of the present disclosure, referring to fig. 4. In the service system, a plurality of concurrent sub-services exist in one task, that is, M concurrent sub-services exist in task i. The log queue i stores the output log information, and the log processing thread i continuously reads the logs in the message queue. The log processing thread i records the key information created and processed by each thread in the task i by using a global log file (namely, a task i global log), and the specific execution log of each thread can be output to an independent log file (logs 1-M) in sequence, so that the readability of the log file can be greatly improved.
The processing method for log information provided by this embodiment defines a log output format, and when multiple threads are concurrently executed in a task, the key information of each thread in the task can be recorded by using a global log file, and the log information of each thread can be sequentially output to an independent file, which is beneficial to improving the readability of the log file, i.e., it is very convenient to query and use logs of highly concurrent tasks in the subsequent process, and the problem of interleaved and disordered log information in a conventional log file is solved.
The processing method of the log information further comprises the following steps: and in response to determining that the log information is completely stored in the designated log file, releasing the storage space of the log information in the message queue.
The processing method for the log information provided by this embodiment may release the storage space of the log information in the message queue in response to determining that the log information is stored in the designated log file; the method can continuously provide buffer space for the output log information, ensure that the log information can be continuously buffered to the message queue, and is favorable for accelerating the processing speed of the log.
The processing method of the log information further comprises the following steps: generating a log head corresponding to the log processing thread while creating the log processing thread; and sending the log header to a message queue.
The processing method for log information provided by this embodiment can generate a log header corresponding to a log processing thread while creating the log processing thread; and the log head is sent to the message queue, which is beneficial to defining the output format of the log and is convenient for achieving the aim of independently writing the multithreading concurrent log through the simple output format of the log.
The following examples are presented to further illustrate the present disclosure for better understanding, but the present disclosure is not limited to the following examples.
The log messages of the MQ message queue are defined as follows:
Figure BDA0003866042190000101
note that (1) LogType: log identification, used to distinguish whether the log is a main task or a sub-thread task: assigning a main task F and assigning a sub-thread task S; (2) TaskID: the task global number is used for uniquely identifying a main task or a sub-thread; (3) Status: task processing state, divided into 3 states: a start state S, an operation state R and an end state E; (4) Contents: and filling in specific service log contents as required.
Specifically, the first: and (3) outputting the service system log:
s1, configuring MQ message queues for receiving a cache log according to the number of tasks related to a service system, wherein each task corresponds to one MQ message queue;
s2, when each task is started, generating a global number, and connecting a corresponding MQ message queue through an MQ protocol; if multiple threads are involved in the task, a thread pool needs to be initialized during starting, and a global number is generated for each thread;
s3, generating a standard log message for each started task according to the following rules during operation:
(1) LogType: if the log is the log output by the sub-thread, assigning S, otherwise assigning F;
(2) TaskID: assigning the value as the global number of the current task or the current thread;
(3) Status: assigning a value S when each task or thread is started and outputs a first log, assigning a value E when the task or thread finishes the current work and outputs a last log, and assigning a value R under other conditions;
and S4, putting the log messages into MQ message queues corresponding to the tasks one by one to wait for processing.
Secondly, the method comprises the following steps: MQ message queue processing:
s11, configuring all MQ message queues which need to be read by a log processing module;
s21, configuring a task log file name corresponding to each MQ message queue, namely a global log name of each task;
s31, starting a log processing module, initializing log processing threads according to the number of the MQ message queues, and connecting each thread to one MQ message queue through an MQ protocol;
s41, each log processing thread reads a log message from the head of the connected MQ message queue, analyzes four field Contents of LogType, taskID, status and Contents in the message, and performs the following processing:
(1) If the LogType = 'F', writing the TaskID + Status + Contents into a global log file of the corresponding task;
(2) If the LogType = 'S' and the Status = 'S', writing the TaskID + Status + Contents into a global log file of a corresponding task, and checking whether a file of 'global log file name + TaskID' exists or not, and if not, creating;
(3) If the LogType = 'S' and Status = 'E', writing the TaskID + Status + Contents into a global log file of the corresponding task;
(4) If LogType = 'S' and Status = 'R', the task id + Status + Contents are written to the file of "global log filename + task id".
S51, step S41 is repeatedly executed for each log processing thread.
Based on the processing method of the log information, the disclosure also provides a processing device of the log information. The apparatus will be described in detail below with reference to fig. 5.
Fig. 5 schematically shows a block diagram of a configuration of a processing apparatus of log information according to an embodiment of the present disclosure.
As shown in fig. 5, the processing apparatus 500 of log information of this embodiment includes a first obtaining module 510, a distributing module 520, a second obtaining module 530, and a processing module 540.
A first obtaining module 510, configured to obtain, in response to receiving an instruction to output log information, a plurality of pieces of log information output by each of the plurality of application threads; an allocating module 520, configured to sequentially allocate each of the plurality of log information to a corresponding message queue; a second obtaining module 530, configured to obtain, via a log processing thread corresponding to a message queue, log information located at a head of the message queue; and a processing module 540, configured to store the log information into a specified log file.
In some embodiments, the log information includes a log identification; the processing module is configured to: determining whether a log header exists in the message queue; and under the condition that the message queue is determined to have the log header, storing the log header and the log information to a log file corresponding to the log identifier according to the log identifier.
In some embodiments, the second determination module is to: and determining whether the user has the authority to access the target shared document according to whether a preset mapping relation exists between the access identifier and the target shared document.
In some embodiments, the storing, in a case that it is determined that a log header exists in the message queue, the log header and the log information to a log file corresponding to the log identifier according to the log identifier includes: acquiring a serial number in the log header, and determining whether a specified log file corresponding to the serial number exists or not; under the condition that the designated log file corresponding to the serial number does not exist, creating a log file corresponding to the serial number; and storing the log information to the log file corresponding to the serial number.
In some embodiments, the processing device of the log information further comprises: the first change module is used for responding to a change request of an executable operation type received from a user and determining a new executable operation type corresponding to the change request; and updating the operation authority identification of the target user according to the newly added executable operation type.
In some embodiments, the processing device of the log information further comprises: and the releasing module is used for releasing the storage space of the log information in the message queue in response to the fact that the log information is completely stored in the designated log file.
In some embodiments, the processing device of the log information further comprises: the generating module is used for generating a log head corresponding to a log processing thread while the log processing thread is created; and the sending module is used for sending the log head to the message queue.
According to an embodiment of the present disclosure, any plurality of the first obtaining module 510, the allocating module 520, the second obtaining module 530, and the processing module 540 may be combined into one module to be implemented, or any one of the modules may be split into a plurality of modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of the other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the first obtaining module 510, the allocating module 520, the second obtaining module 530 and the processing module 540 may be implemented at least partially as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware by any other reasonable manner of integrating or packaging a circuit, or may be implemented in any one of three implementations of software, hardware and firmware, or in a suitable combination of any of them. Alternatively, at least one of the first obtaining module 510, the assigning module 520, the second obtaining module 530 and the processing module 540 may be at least partially implemented as a computer program module, which when executed may perform a corresponding function.
Fig. 6 schematically shows a block diagram of an electronic device adapted to implement a method of processing log information according to an embodiment of the present disclosure.
As shown in fig. 6, an electronic device 600 according to an embodiment of the present disclosure includes a processor 601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. Processor 601 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 601 may also include onboard memory for caching purposes. Processor 601 may include a single processing unit or multiple processing units for performing different actions of a method flow according to embodiments of the disclosure.
In the RAM 603, various programs and data necessary for the operation of the electronic apparatus 600 are stored. The processor 601, the ROM602, and the RAM 603 are connected to each other via a bus 604. The processor 601 performs various operations of the method flows according to the embodiments of the present disclosure by executing programs in the ROM602 and/or RAM 603. It is to be noted that the programs may also be stored in one or more memories other than the ROM602 and RAM 603. The processor 601 may also perform various operations of the method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
Electronic device 600 may also include input/output (I/O) interface 605, input/output (I/O) interface 605 also connected to bus 604, according to an embodiment of the present disclosure. The electronic device 600 may also include one or more of the following components connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. A driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist alone without being assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement a method according to an embodiment of the disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example but is not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM602 and/or RAM 603 described above and/or one or more memories other than the ROM602 and RAM 603.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the method illustrated by the flow chart. When the computer program product runs in a computer system, the program code is used for causing the computer system to realize the processing method of the log information provided by the embodiment of the disclosure.
The computer program performs the above-described functions defined in the system/apparatus of the embodiments of the present disclosure when executed by the processor 601. The systems, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In one embodiment, the computer program may be hosted on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed in the form of a signal on a network medium, downloaded and installed through the communication section 609, and/or installed from the removable medium 611. The computer program containing program code may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609 and/or installed from the removable medium 611. The computer program, when executed by the processor 601, performs the above-described functions defined in the system of the embodiments of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In accordance with embodiments of the present disclosure, program code for executing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, these computer programs may be implemented using high level procedural and/or object oriented programming languages, and/or assembly/machine languages. The programming language includes, but is not limited to, programming languages such as Java, C + +, python, the "C" language, or the like. The program code may execute entirely on the user computing device, partly on the user device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments of the present disclosure and/or the claims may be made without departing from the spirit and teachings of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the disclosure, and these alternatives and modifications are intended to fall within the scope of the disclosure.

Claims (10)

1. A method for processing log information comprises the following steps:
in response to receiving an instruction to output log information, obtaining a plurality of log information output by each of the plurality of application threads;
sequentially distributing each log information in the plurality of log information to a corresponding message queue;
acquiring log information at the head of a message queue through a log processing thread corresponding to the message queue; and
and storing the log information into a specified log file.
2. The method of claim 1, wherein the log information comprises a log identification; the storing the log information into a designated log file includes:
determining whether a log header exists in the message queue;
and under the condition that the message queue is determined to have the log header, storing the log header and the log information to a log file corresponding to the log identifier according to the log identifier.
3. The method of claim 2, wherein the storing the log header and the log information to a log file corresponding to the log identifier according to the log identifier if it is determined that the log header exists in the message queue comprises:
acquiring a serial number in the log header, and determining whether a designated log file corresponding to the serial number exists or not;
under the condition that the designated log file corresponding to the serial number does not exist, creating a log file corresponding to the serial number; and
and storing the log information to the log file corresponding to the serial number.
4. The method of claim 1, further comprising:
and releasing the storage space of the log information in the message queue in response to the fact that the log information is stored to the designated log file completely.
5. The method of claim 1, further comprising:
the method comprises the steps that a log head corresponding to a log processing thread is generated while the log processing thread is created; and
and sending the log head to the message queue.
6. An apparatus for processing log information, comprising:
a first obtaining module, configured to obtain, in response to receiving an instruction to output log information, a plurality of pieces of log information output by each of the plurality of application threads;
the distribution module is used for sequentially distributing each log information in the plurality of log information to the corresponding message queue;
the second acquisition module is used for acquiring the log information at the head of the message queue through the log processing thread corresponding to the message queue; and
and the processing module is used for storing the log information into a specified log file.
7. The apparatus of claim 6, wherein the log information comprises a log identification; the processing module is configured to:
determining whether a log header exists in the message queue;
and under the condition that the message queue is determined to have the log header, storing the log header and the log information to a log file corresponding to the log identifier according to the log identifier.
8. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-5.
9. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to carry out the method according to any one of claims 1 to 5.
10. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 5.
CN202211186402.6A 2022-09-27 2022-09-27 Log information processing method and device, electronic equipment and medium Pending CN115630033A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211186402.6A CN115630033A (en) 2022-09-27 2022-09-27 Log information processing method and device, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211186402.6A CN115630033A (en) 2022-09-27 2022-09-27 Log information processing method and device, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN115630033A true CN115630033A (en) 2023-01-20

Family

ID=84905611

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211186402.6A Pending CN115630033A (en) 2022-09-27 2022-09-27 Log information processing method and device, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN115630033A (en)

Similar Documents

Publication Publication Date Title
CN107729139B (en) Method and device for concurrently acquiring resources
CN113132489A (en) Method, device, computing equipment and medium for downloading file
US20070016893A1 (en) Tracking resource usage by applications
CN110865888A (en) Resource loading method and device, server and storage medium
CN113934464A (en) Method and device for starting android application in Linux system and electronic equipment
US11330047B2 (en) Work-load management in a client-server infrastructure
CN110851276A (en) Service request processing method, device, server and storage medium
CN111679911B (en) Management method, device, equipment and medium of GPU card in cloud environment
CN114077367A (en) Method and device for realizing shortcut of android application in Linux system
CN110673959A (en) System, method and apparatus for processing tasks
US10613992B2 (en) Systems and methods for remote procedure call
US8738742B2 (en) Tiered XML services in a content management system
US8707449B2 (en) Acquiring access to a token controlled system resource
CN114168607A (en) Global serial number generation method, device, equipment, medium and product
CN115630033A (en) Log information processing method and device, electronic equipment and medium
CN114237765A (en) Functional component processing method and device, electronic equipment and medium
CN113449994A (en) Assignment method, assignment device, electronic device, medium, and program product for job ticket
CN113778659A (en) Multithreading processing method and device
CN112597224A (en) Data export method, data export device, electronic equipment and medium
CN112579282A (en) Data processing method, device, system and computer readable storage medium
CN113347250B (en) Data access method, data access device, electronic equipment and readable storage medium
CN109981554B (en) Information processing method and system and electronic equipment
CN114363172B (en) Decoupling management method, device, equipment and medium for container group
CN114648001A (en) CSV file generation method, device, electronic equipment and medium
CN109871303B (en) Information processing method and system, computer system and readable storage medium

Legal Events

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