CN113342771A - Distributed call log printing method - Google Patents
Distributed call log printing method Download PDFInfo
- Publication number
- CN113342771A CN113342771A CN202110746275.XA CN202110746275A CN113342771A CN 113342771 A CN113342771 A CN 113342771A CN 202110746275 A CN202110746275 A CN 202110746275A CN 113342771 A CN113342771 A CN 113342771A
- Authority
- CN
- China
- Prior art keywords
- log
- unique tracking
- tracking number
- distributed call
- call log
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 33
- 230000000977 initiatory effect Effects 0.000 claims abstract description 11
- 230000016507 interphase Effects 0.000 claims abstract description 4
- 238000004891 communication Methods 0.000 claims description 19
- 238000005096 rolling process Methods 0.000 claims description 13
- 230000026676 system process Effects 0.000 claims description 4
- 230000005540 biological transmission Effects 0.000 claims description 3
- 125000006850 spacer group Chemical group 0.000 claims description 3
- 238000010586 diagram Methods 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 238000004366 reverse phase liquid chromatography Methods 0.000 description 2
- 238000013024 troubleshooting Methods 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 230000000903 blocking effect Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/18—File system types
- G06F16/1805—Append-only file systems, e.g. using logs or journals to store data
- G06F16/1815—Journaling file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/18—File system types
- G06F16/182—Distributed file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4488—Object-oriented
- G06F9/449—Object-oriented method invocation or resolution
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Debugging And Monitoring (AREA)
- Telephonic Communication Services (AREA)
Abstract
The invention relates to a distributed call log printing method, which comprises the following steps: the link initiating system generates a unique tracking number when initiating a call request; when the inter-phase modulation is carried out among the systems, the content corresponding to the service code is output in a log file according to the requirement of the service code in the system to form a log; when the log file is called and the corresponding content is output each time, the unique tracking number is automatically updated and is recorded in the corresponding log; after the multiple calls among the systems, the multiple logs are connected in series through the multiple unique tracking numbers generated in the log file; and inquiring a corresponding log by inquiring the unique tracking number, and positioning the log. The invention can connect the context logs in the whole call link in series, thereby facilitating the log search and the log positioning.
Description
Technical Field
The invention relates to the technical field of data processing, in particular to a distributed call log printing method.
Background
With the iterative development and cluster deployment of distributed systems, the number of systems also increases correspondingly, when the number of systems increases to a certain stage, log searching and log positioning become extremely difficult, and when one request spans multiple systems, logs on the whole link are difficult to be connected in series. If the log is required to be positioned, a large amount of time is consumed, and sometimes even all log information cannot be found, which is not beneficial to timely troubleshooting of problems.
Therefore, there is a need to provide a method for printing distributed call logs, which can connect context logs in the whole call link in series, and facilitate log search and log positioning.
Disclosure of Invention
The invention aims to provide a distributed call log printing method, which can connect context logs in a whole call link in series and is convenient for searching logs and positioning the logs.
In order to achieve the above object, the present invention provides a method for printing a distributed call log, comprising the steps of:
the link initiating system generates a unique tracking number when initiating a call request;
when the inter-phase modulation is carried out among the systems, the content corresponding to the service code is output in a log file according to the requirement of the service code in the system to form a log; when the log file is called and the corresponding content is output each time, the unique tracking number is automatically updated and is recorded in the corresponding log;
after the multiple calls among the systems, the multiple logs are connected in series through the multiple unique tracking numbers generated in the log file;
and inquiring a corresponding log by inquiring the unique tracking number, and positioning the log.
Optionally, in the method for printing a distributed call log, the unique tracking number is composed of a timestamp, a multi-bit rolling serial number, and a system process code, and the timestamp, the multi-bit rolling serial number, and the system process code are separated by a spacer.
Optionally, in the method for printing the distributed call log, the timestamp is 17 bits, and the timestamp is used for recording the specific time of each call log file.
Optionally, in the method for printing the distributed call log, the multi-bit rolling sequence number is 6 bits, and 1 is added to the multi-bit rolling sequence number every time the log file is called.
Optionally, in the method for printing a distributed call log, one unique tracking number corresponds to at least one log.
Optionally, in the method for printing the distributed call log, the unique tracking number is recorded in the log through an MDC function of log4 j.
Optionally, in the method for printing the distributed call log, when multiple calls are made between systems, communications are performed through rpc and/or socket.
Optionally, in the method for printing the distributed call log,
when the communication is carried out through rpc, the bottom layer of rpc uses rabbitMQ to carry out data communication, and the unique tracking number is placed in the head of the rabbitMQ to carry out layer-by-layer transmission;
when communication is carried out through the socket, the data communication is carried out on the bottom layer of the socket by using a Mina frame, and the unique tracking number is placed in the head of the socket message body to be transmitted layer by layer.
Compared with the prior art, the invention has the following advantages:
(1) the logs of context in the entire call link may be concatenated;
(2) the log searching and log positioning are facilitated, and the log searching and log positioning efficiency is improved.
Drawings
FIG. 1 is a diagram of a system call with a unique tracking number according to an embodiment of the present invention;
FIG. 2 is a block diagram of a unique tracking number provided by an embodiment of the present invention;
FIG. 3 is a flow chart of communications using rpc according to an embodiment of the present invention;
fig. 4 is a flowchart of communication using a socket according to an embodiment of the present invention.
Detailed Description
The following describes in more detail embodiments of the present invention with reference to the schematic drawings. The advantages and features of the present invention will become more apparent from the following description. It is to be noted that the drawings are in a very simplified form and are not to precise scale, which is merely for the purpose of facilitating and distinctly claiming the embodiments of the present invention.
If the method described herein comprises a series of steps, the order in which these steps are presented herein is not necessarily the only order in which these steps may be performed, and some of the described steps may be omitted and/or some other steps not described herein may be added to the method.
With the iterative development and cluster deployment of distributed systems, the number of systems also increases correspondingly, when the number of systems increases to a certain stage, log searching and log positioning become extremely difficult, and when one request spans multiple systems, logs on the whole link are difficult to be connected in series. If the log is required to be positioned, a large amount of time is consumed, and sometimes even all log information cannot be found, which is not beneficial to timely troubleshooting of problems.
Therefore, it is necessary to provide a method for printing a distributed call log, as shown in fig. 1, where fig. 1 is a system call graph when a unique tracking number is used according to an embodiment of the present invention, the method includes the following steps:
the link initiating system generates a unique tracking number when initiating a call request;
when the inter-phase modulation is carried out among the systems, the content corresponding to the service code is output in a log file according to the requirement of the service code in the system to form a log; when the log file is called and the corresponding content is output each time, the unique tracking number is automatically updated and is recorded in the corresponding log;
after the multiple calls among the systems, the multiple logs are connected in series through the multiple unique tracking numbers generated in the log file;
and inquiring a corresponding log by inquiring the unique tracking number, and positioning the log.
Preferably, as shown in fig. 2, fig. 2 is a structural diagram of a unique tracking number provided by an embodiment of the present invention, wherein the unique tracking number (which may be defined as aicSrcTradeId in the present invention) is composed of a timestamp, a multi-bit rolling sequence number and a process code of a system, and the timestamp, the multi-bit rolling sequence number and the process code of the system are separated by a spacer. The time stamp is 17 bits and is used for recording the specific time of calling the log file each time; the multi-bit rolling serial number is 6, and 1 is added to the multi-bit rolling serial number every time the log file is called; the process code of the system is 3-5 bits and is not changed after being generated.
Preferably, with continued reference to fig. 1, the unique tracking number is logged by the MDC function of log4j, and the link initiation system is the pre-entry in fig. 1. The MDC function is log4j for storing context information (context information) of an application, thereby facilitating the use of the context information in log. The MDC uses a map-like mechanism to store information inside, and the corresponding method is as follows: put (key, value); the following are used when configuring Pattern layout: % x { key } to output the corresponding value. While Log4j is an open source code item of Apache, by using Log4j we can control the Log information delivery to the console, files, GUI components, even socket servers, NT event recorders, UNIX Syslog daemons, etc.
As shown in fig. 1, at call time, a unique trace number is generated by the link initiation system at the time of initiating a call request, where the unique trace number is the starting unique trace number, i.e., the time stamp is recorded is the earliest, and the multi-bit rolling sequence number is the smallest, e.g., 000001. Then, the system 1 calls, according to the requirement of the service code in the system 1, the content corresponding to the service code is output in a log file to form a log corresponding to the system 1, the MDC of log4j receives the initial unique tracking number, the 2 nd unique tracking number is obtained by updating, and the 2 nd unique tracking number is stored; then, the system 2 calls, according to the requirement of the service code in the system 2, the content corresponding to the service code is output in the log file to form a log corresponding to the system 2, the MDC of log4j receives the 2 nd unique tracking number, the 3 rd unique tracking number is obtained through updating, and the 3 rd unique tracking number is stored; and by analogy, the calling of all the systems is completed.
Preferably, after the MDC of log4j of each system is updated to obtain a new unique tracking number, it is recorded in the corresponding log; after the log corresponding to each system is processed, the corresponding unique tracking number in each system is cleared, because the corresponding unique tracking number in each system is recorded in the log file at the moment, and all the unique tracking numbers are printed by the log file to reduce the cache of each system.
Usually, one unique tracking number corresponds to at least one log, that is, one log may be generated or multiple logs may be generated each time a log file is called, and the logs use the same unique tracking number to distinguish the condition of each system calling the log file.
As shown in fig. 3 and 4, fig. 3 is a flowchart of communications using rpc according to an embodiment of the present invention, fig. 4 is a flowchart of communications using a socket according to an embodiment of the present invention, and when multiple calls are made between systems, communications are performed through rpc and/or socket, that is, one or 2 of rpc and socket are selected according to actual situations. Further, RPCs generally refer to Remote Procedure calls, RPCs being an abbreviated form of Remote Procedure calls (Remote Procedure Call). The socket comprises a server and a client, and the operation flows of the server and the client are as follows: a server side: initializing socket, monitoring port (listen), blocking (accept), waiting for client connection, and then running the program to the state of the server just started. A client: initializing socket- > sending a connection request (connect), if the connection is successful, sending a data request by the client, receiving and processing the request by the server, sending response data to the client, reading the data by the client, and finally closing the connection to finish one interaction.
In the invention, when the communication is carried out through rpc, the bottom layer of rpc uses rabbitMQ (message queue) to carry out data communication, and the unique tracking number is placed in the head of the rabbitMQ to carry out layer-by-layer transmission; when communication is carried out through the socket, the data communication is carried out on the bottom layer of the socket by using a Mina frame, and the unique tracking number is placed in the head of the socket message body to be transmitted layer by layer. The Mina framework (Apache Mina Server) is a network communication application framework, and provides a very convenient framework for developing network applications with high performance and high availability.
Compared with the prior art, the invention has the following advantages:
(1) the logs of context in the entire call link may be concatenated;
(2) the log searching and log positioning are facilitated, and the log searching and log positioning efficiency is improved.
The above description is only a preferred embodiment of the present invention, and does not limit the present invention in any way. It will be understood by those skilled in the art that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the invention as defined by the appended claims.
Claims (8)
1. A method of distributed call log printing, comprising the steps of:
the link initiating system generates a unique tracking number when initiating a call request;
when the inter-phase modulation is carried out among the systems, the content corresponding to the service code is output in a log file according to the requirement of the service code in the system to form a log; when the log file is called and the corresponding content is output each time, the unique tracking number is automatically updated and is recorded in the corresponding log;
after the multiple calls among the systems, the multiple logs are connected in series through the multiple unique tracking numbers generated in the log file;
and inquiring a corresponding log by inquiring the unique tracking number, and positioning the log.
2. The method of distributed call log printing according to claim 1, wherein the unique tracking number is comprised of a timestamp, a multi-bit rolling sequence number, and a system process code, the timestamp, the multi-bit rolling sequence number, and the system process code being separated by a spacer.
3. The method of distributed call log printing according to claim 2, wherein the time stamp is 17 bits, and the time stamp is used to record a specific time of each call log file.
4. The method of distributed call log printing according to claim 2, wherein the multi-bit rolling sequence number is 6 bits, and wherein the multi-bit rolling sequence number is incremented by 1 each time the log file is called.
5. The method of distributed call log printing as recited in claim 1, wherein one of said unique tracking numbers corresponds to at least one log.
6. The method of distributed call log printing as recited in claim 1, wherein the unique tracking number is logged in the log by the MDC function of log4 j.
7. The method for distributed call log printing as claimed in claim 1, wherein multiple inter-system calls are communicated via rpc and/or socket.
8. The method of distributed call log printing of claim 7,
when the communication is carried out through rpc, the bottom layer of rpc uses rabbitMQ to carry out data communication, and the unique tracking number is placed in the head of the rabbitMQ to carry out layer-by-layer transmission;
when communication is carried out through the socket, the data communication is carried out on the bottom layer of the socket by using a Mina frame, and the unique tracking number is placed in the head of the socket message body to be transmitted layer by layer.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110746275.XA CN113342771A (en) | 2021-07-01 | 2021-07-01 | Distributed call log printing method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110746275.XA CN113342771A (en) | 2021-07-01 | 2021-07-01 | Distributed call log printing method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113342771A true CN113342771A (en) | 2021-09-03 |
Family
ID=77482173
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110746275.XA Pending CN113342771A (en) | 2021-07-01 | 2021-07-01 | Distributed call log printing method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113342771A (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105933163A (en) * | 2016-06-24 | 2016-09-07 | 微梦创科网络科技(中国)有限公司 | Real-time distributed debugging tracking method and system |
CN107977473A (en) * | 2017-12-28 | 2018-05-01 | 政采云有限公司 | The search method and system of distributed system journal based on Logback |
CN108038145A (en) * | 2017-11-23 | 2018-05-15 | 携程旅游网络技术(上海)有限公司 | Distributed Services tracking, system, storage medium and electronic equipment |
CN108205486A (en) * | 2017-12-26 | 2018-06-26 | 上海中畅数据技术有限公司 | A kind of intelligent distributed call chain tracking based on machine learning |
CN111198773A (en) * | 2019-12-31 | 2020-05-26 | 上海汇付数据服务有限公司 | Message-based application communication method and device |
CN112118286A (en) * | 2020-08-04 | 2020-12-22 | 紫光云(南京)数字技术有限公司 | Multi-thread link tracking method and device based on MDC and computer readable storage medium |
-
2021
- 2021-07-01 CN CN202110746275.XA patent/CN113342771A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105933163A (en) * | 2016-06-24 | 2016-09-07 | 微梦创科网络科技(中国)有限公司 | Real-time distributed debugging tracking method and system |
CN108038145A (en) * | 2017-11-23 | 2018-05-15 | 携程旅游网络技术(上海)有限公司 | Distributed Services tracking, system, storage medium and electronic equipment |
CN108205486A (en) * | 2017-12-26 | 2018-06-26 | 上海中畅数据技术有限公司 | A kind of intelligent distributed call chain tracking based on machine learning |
CN107977473A (en) * | 2017-12-28 | 2018-05-01 | 政采云有限公司 | The search method and system of distributed system journal based on Logback |
CN111198773A (en) * | 2019-12-31 | 2020-05-26 | 上海汇付数据服务有限公司 | Message-based application communication method and device |
CN112118286A (en) * | 2020-08-04 | 2020-12-22 | 紫光云(南京)数字技术有限公司 | Multi-thread link tracking method and device based on MDC and computer readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10824525B2 (en) | Distributed data monitoring device | |
US9717011B2 (en) | Event management in telecommunications networks | |
EP3386150B1 (en) | Terminal failure processing method, device and system | |
JP2000076161A (en) | Event log method | |
US20080177811A1 (en) | Method and system for policy-based secure destruction of data | |
US20090204949A1 (en) | System, method and program product for dynamically adjusting trace buffer capacity based on execution history | |
CN107688611B (en) | Saltstack-based Redis key value management system and method | |
CN111459760B (en) | Micro-service monitoring method and device and computer storage medium | |
CN111209126A (en) | Data transmission method and device between microservices and electronic equipment | |
US7543041B2 (en) | Pattern based web services using caching | |
CN109218401A (en) | Log collection method, system, computer equipment and storage medium | |
CN111831954B (en) | Content data updating method, device, computer equipment and storage medium | |
CN113342771A (en) | Distributed call log printing method | |
US20150088958A1 (en) | Information Processing System and Distributed Processing Method | |
US8489838B2 (en) | Method and terminal device for erasing data of terminal | |
CN112910697B (en) | Fault processing method and device | |
CN116467336A (en) | Data processing method and device, electronic equipment and storage medium | |
CN113778709B (en) | Interface calling method, device, server and storage medium | |
US7293043B1 (en) | Tracking switch transactions | |
CN109922316A (en) | Media resource scheduling and managing medium resource method, apparatus and electronic equipment | |
CN114879977A (en) | Application deployment method, device and storage medium | |
CN109525642B (en) | LIMS system client data automatic reporting method under user mechanism | |
US20040243653A1 (en) | System and method for generating an alarm when an abnormal database backup status occurs | |
CN114201659A (en) | Message track transmission query method, device and system | |
CN109634931B (en) | Log uploading method and device |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20210903 |