WO2021179578A1 - Business logic debugging method and apparatus, device, and computer-readable storage medium - Google Patents

Business logic debugging method and apparatus, device, and computer-readable storage medium Download PDF

Info

Publication number
WO2021179578A1
WO2021179578A1 PCT/CN2020/118490 CN2020118490W WO2021179578A1 WO 2021179578 A1 WO2021179578 A1 WO 2021179578A1 CN 2020118490 W CN2020118490 W CN 2020118490W WO 2021179578 A1 WO2021179578 A1 WO 2021179578A1
Authority
WO
WIPO (PCT)
Prior art keywords
debugging
data
business logic
request
target
Prior art date
Application number
PCT/CN2020/118490
Other languages
French (fr)
Chinese (zh)
Inventor
张玉辰
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021179578A1 publication Critical patent/WO2021179578A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • This application mainly relates to the field of server technology, and specifically, to a method, device, device, and computer-readable storage medium for debugging business logic.
  • a mechanism is set up to generate log data for all aspects of business logic. Once an online service access exception occurs, the log data generated by the corresponding business logic is obtained for analysis.
  • the analyzed log data is likely to contain data that is not related to abnormalities, which increases the amount of data analyzed, affects the efficiency of analysis, and brings data processing pressure to the normal access to the server; in addition, other non-relevant data Developers can also obtain or attack log data by constructing requests, which leads to the leakage of log data and brings risks to online services.
  • the main purpose of this application is to provide a business logic debugging method, device, equipment, and computer readable storage medium, aiming to solve the low efficiency of log data analysis of business logic in the prior art, which affects server data processing and online services Security issues.
  • this application provides a business logic debugging method, which includes the following steps:
  • the target log level, target encryption key, and first encryption value corresponding to the debugging request are read.
  • the debugging request includes the target log level, target encryption key, and first encryption value.
  • the debugging data generated based on the business logic corresponding to the debugging request is collected according to the target log level, so as to compare the business based on the debugging data. Logic for debugging.
  • this application also proposes a business logic debugging device, the business logic debugging device includes:
  • the reading module is used to read the target log level, target encryption key, and first encrypted value corresponding to the debugging request when a debugging request is detected, and the debugging request includes the target log level, The request header corresponding to the target encryption key and the first encryption value;
  • a generating module configured to encrypt the target log level according to the target encryption key to generate a second encrypted value
  • the debugging module is configured to collect debugging data generated based on the business logic corresponding to the debugging request according to the log level when the first encrypted value matches the second encrypted value, so as to be based on the debugging data Debug the business logic.
  • this application also proposes a business logic debugging device, the business logic debugging device includes: a memory, a processor, a communication bus, and a business logic debugging program stored on the memory;
  • the communication bus is used to realize the connection and communication between the processor and the memory
  • the processor is used to execute the business logic debugging program to implement the following steps:
  • the target log level, target encryption key, and first encryption value corresponding to the debugging request are read.
  • the debugging request includes the target log level, target encryption key, and first encryption value.
  • the debugging data generated based on the business logic corresponding to the debugging request is collected according to the target log level, so as to compare the business based on the debugging data. Logic for debugging.
  • the present application also provides a computer-readable storage medium that stores one or more programs, and the one or more programs can be used by one or more processors. Execute for:
  • the target log level, target encryption key, and first encryption value corresponding to the debugging request are read.
  • the debugging request includes the target log level, target encryption key, and first encryption value.
  • the debugging data generated based on the business logic corresponding to the debugging request is collected according to the target log level, so as to compare the business based on the debugging data. Logic for debugging.
  • the target log level and target corresponding to the debugging request are read.
  • the encryption key and the first encrypted value; and the target log level is encrypted by the target encryption key to generate the second encrypted value; if it is determined that the first encrypted value matches the second encrypted value, the collection is based on the target log level
  • the debugging data generated by the business logic corresponding to the debugging request can be used to debug the business logic based on the debugging data.
  • this application uses the consistency between the first encrypted value and the second encrypted value to promptly detect malicious acquisition or attack of log data by non-developers, avoid the leakage of log data, and facilitate the security of online services;
  • this application uses the consistency between the first encrypted value and the second encrypted value to promptly detect malicious acquisition or attack of log data by non-developers, avoid the leakage of log data, and facilitate the security of online services;
  • by setting the target log level to collect debugging data it avoids obtaining irrelevant data for analysis and affecting the server's data processing ability, which improves the accuracy and efficiency of analysis.
  • FIG. 1 is a schematic flowchart of the first embodiment of the business logic debugging method of the present application
  • FIG. 2 is a schematic diagram of functional modules of the first embodiment of the business logic debugging device of the present application
  • FIG. 3 is a schematic diagram of the device structure of the hardware operating environment involved in the method of the embodiment of the present application.
  • This application provides a business logic debugging method.
  • FIG. 1 is a schematic flowchart of a first embodiment of a business logic debugging method of this application.
  • the business logic debugging method includes:
  • Step S10 When a debugging request is detected, read the target log level, target encryption key, and first encryption value corresponding to the debugging request, and the debugging request includes the target log level and target encryption secret.
  • the business logic debugging method of this application is applied to a server, and is suitable for the targeted collection of data generated by the business logic of the online service abnormality through the server, so as to facilitate analysis and debugging based on the collected data to find the cause of the abnormality.
  • this embodiment debugs the abnormalities that occur in the process of providing online service access by the server, in order to avoid the impact of debugging on the normal user access, the server is provided with an external interface for external access in addition to an external interface dedicated for debugging.
  • the internal interface; the request for triggering debugging and the data used for debugging are transmitted through the internal interface, while the normal access of the user is carried out through the external interface; the request initiated by the user is transmitted to the business logic for processing through the external interface, and the processing result Return to the user terminal through an external interface; this enables the distinction between debugging and normal access.
  • a sending end that can communicate with the server.
  • the sending end can be a mobile terminal such as a mobile phone or a tablet computer, or a smart bracelet, a smart watch, etc.
  • the wearable device can also be a fixed terminal such as a desktop computer.
  • the sending of the debugging request is based on the establishment of a communication connection between the server and the sending end. Therefore, before sending the debugging request to the server, a communication connection between the two needs to be established and the security of the communication must be ensured. Specifically, before step S10, it includes:
  • Step a1 receiving the communication connection request sent by the sending end corresponding to the debugging request, and performing identity verification on the sending end;
  • the developer sends a communication connection request to the server through the sender.
  • the server authenticates the sender in order to ensure the security of the communication.
  • the identity verification can be carried out through the unique identifier of the sender, such as the MAC address of the sender (Media Access Control Address) or IMEI (International Mobile Equipment Identity, International Mobile Equipment Identity), etc.
  • the sender Before sending the communication connection request, the sender reads its own identifier of this type and adds it to the communication connection request before sending it; after receiving the communication connection request, the server reads the identifier in it. Or the sender only initiates a communication connection request.
  • the server After receiving the communication connection request, the server returns a verification request for obtaining its identifier for identity verification to the sender, and the sender sends the identifier to the server according to the verification request.
  • the server stores the identifier of the sender used for debugging in advance, and after obtaining the identifier of the sender, compares it with the pre-stored identifiers to determine whether the obtained identifier exists in the stored identifier; if If it exists, it is judged that the identity verification is successful, otherwise it is judged that the identity verification has failed, and the communication connection with the sender is refused.
  • Step a2 After the identity verification is successful, establish a communication connection with the sender for the sender to construct a request header, and send the debugging request based on the request header, wherein the request header is based on the request header.
  • the target log level, the target encryption key, and the time point information of the request header construction are generated.
  • a communication connection with the sender is established to realize data transmission between the sender and the server.
  • the developer constructs the request header through the sender, so that the debugging request is sent to the server based on the request header to realize the communication between the two.
  • the request header is used to inform the server about the information requested by the sender, such as the data type supported by the sender, which character set is supported, which compression format is supported, the language environment, which host is accessed, etc.
  • the developer sets the target log level that needs to be collected and the target encryption key used to achieve encryption, and the sender sets the target log level, target encryption key, and the current time of the constructed request header.
  • the point information is added to the request header to form a special header of the request header. If the constructed request header is X-Debug-Req: token, then the token is the special generated by the target log level, encryption key and time point information head.
  • the log data is divided into multiple target log levels, including at least five levels: FATAL, ERROR, WARN, INFO, and DEBUG;
  • the actual situation of the exception sets the target log level of the log data that it needs to pull. If the actual condition of the abnormality is WARN level, the target log level can be set to WARN to pull log data with the target log level above WARN level, and avoid pulling log data that is not related to the abnormality. Processing efficiency.
  • an encryption mechanism is set; the developer sets the target encryption key when constructing the request header to pass The target encryption key realizes the encryption processing of the target log level.
  • an encryption algorithm is preset in the sender.
  • the encryption algorithm can be symmetric encryption such as DES, RC2, RC4, RC5 and Blowfish, or asymmetric encryption such as RSA, Rabin, DH, and ECC. Encryption can also be MD5 encryption, etc.
  • the sender After receiving the request header constructed by the developer, the sender encrypts the target log level through the encryption algorithm according to the target encryption key in the request header, and generates the first encrypted value; and the first encrypted value is combined with the target log level ,
  • the target encryption key and time point information are sent to the internal interface of the server as the information corresponding to the debugging request.
  • the internal interface of the server When the internal interface of the server detects the debugging request, it reads the corresponding target log level, target encryption key, time point information, and first encrypted value to pass the time point information and the first encrypted value verification After that, the log data corresponding to the target log level is collected and returned to the sender.
  • Step S20 encrypt the target log level according to the target encryption key to generate a second encrypted value
  • the internal interface of the server is set with the same encryption algorithm as the sender.
  • the time point information is used to determine the current detection time and the time of the debugging request. Whether there is a large difference in the time to construct the request header, if it is large, it means that the time period between the construction time and the receiving time is longer, and there may be a risk of malicious attacks. Therefore, refuse to collect log data and return it to the sender. On the contrary, if there is not much difference between the two, it means that the time period between the construction time and the reception time is within a reasonable range and is a normal request.
  • the target log level is encrypted by the target encryption key and the preset encryption algorithm. Obtain the second encrypted value. Based on the consistency between the first encrypted value and the second encrypted value, it is judged whether the data is subject to tampering attacks during transmission to the internal interface of the server.
  • Step S30 When the first encrypted value matches the second encrypted value, according to the target log level, collect debugging data generated based on the business logic corresponding to the debugging request, so as to pair the debugging data based on the debugging data.
  • the business logic is debugged.
  • the generated second encrypted value is compared with the read first encrypted value to determine the consistency between the two; if the two are consistent, it is determined that the two match, the sender and the internal interface used
  • the encryption algorithm is a preset algorithm.
  • the target encryption key, target log level, and first encrypted value have not been tampered with during transmission; otherwise, it is determined that the first encrypted value and the second encrypted value do not match, and the data is being transmitted to the internal interface of the server After malicious tampering in the process, the debugging request is risky, and the log data is refused to be collected and returned to the sender.
  • the server collects the target log data corresponding to the target log level from the log data generated by the business logic triggered by the debugging request; at the same time obtains the business logic
  • the response data and target log data are returned to the sending end as debugging data, so that developers can debug business logic based on the returned debugging data.
  • the server is provided with a buffer area dedicated to storing log data for debugging; this buffer area is used as a buffer area corresponding to the debugging request. And set up a regular cleaning mechanism.
  • the server sends the collected target log data to the cache area, and detects the storage duration of each target log data previously stored in the cache area. When there is a target log data in each target log data, the storage duration is greater than the preset substantial When the duration threshold is set, a prompt message is output, prompting to clean up the target log data to free up storage space and facilitate subsequent storage of the target log data.
  • the target log level and target corresponding to the debugging request are read.
  • the encryption key and the first encrypted value; and the target log level is encrypted by the target encryption key to generate the second encrypted value; if it is determined that the first encrypted value matches the second encrypted value, the collection is based on the target log level
  • the debugging data generated by the business logic corresponding to the debugging request can be used to debug the business logic based on the debugging data.
  • this application uses the consistency between the first encrypted value and the second encrypted value to promptly detect malicious acquisition or attack of log data by non-developers, avoid the leakage of log data, and facilitate the security of online services;
  • this application uses the consistency between the first encrypted value and the second encrypted value to promptly detect malicious acquisition or attack of log data by non-developers, avoid the leakage of log data, and facilitate the security of online services;
  • by setting the target log level to collect debugging data it avoids obtaining irrelevant data for analysis and affecting the server's data processing ability, which improves the accuracy and efficiency of analysis.
  • the collection based on the target log level and the debugging includes:
  • Step S31 Adjust the default level of log data generated by the business logic corresponding to the debugging request according to the target log level, and collect the target corresponding to the adjusted default level from the log data generated by the business logic Log data;
  • the log data generated by the business logic triggered by the debugging request is diverse to reflect abnormalities with different degrees of risk.
  • log data corresponding to abnormalities that are small in risk and do not affect the use are not processed.
  • the log data corresponding to the abnormality is processed only when the degree of danger of the abnormality is large and affects the use.
  • the log level of the log data that needs to be processed is set as the default level of the log data generated by the business logic. After the server reads the target log level, it compares it with the default level of the log data generated by the business logic. Compare and judge the consistency of the two. If they are consistent, it means that the log level of the log data returned by default meets the target log level required by the developer.
  • the target log data above the default level is directly obtained and returned to the sending end. . If the default level and the target log level are inconsistent, the default level is adjusted according to the target log level, and the default level is adjusted to the target log level, so as to collect and adjust the default log data from the log data generated by the business logic for the current debugging request.
  • the target log data corresponding to the level is returned to the sender. For example, the default level of log data returned for each request is ERROR level, and the target log level required by the current debugging request characterization is DEBUG, the server adjusts the level returned by the log data to DEBUG to target the current debugging request Obtain the generated target log data above the DEBUG level.
  • Step S32 reading the response data generated by the business logic, and setting the target log data and the response data as debugging data;
  • the business logic responds to the debugging request to generate response data.
  • the response data After obtaining the target log data generated by the business logic for the current debugging request that meets the target log level requirements, the response data is read, and the response data Set the debugging data together with the target log data to combine the two debugging to determine the cause of the service exception.
  • Step S33 Send the debugging data to the sending end corresponding to the debugging request, so as to debug the service logic based on the debugging data.
  • the server After the server generates the debugging data, it sends it to the sending end that initiates the debugging request, so that the developer who initiates the debugging request through the sending end can debug the business logic that caused the service exception based on the debugging data.
  • a mechanism is provided to add the data size of the response data in the response header; specifically, the debugging data is sent to the sender corresponding to the debugging request. The steps include:
  • Step S331 Detect the data size of the response data, and add the data size to the response header of the business logic
  • the data size of the response data generated by the business logic processing the debugging request is detected, and the detected data size is added to the response header of the business logic.
  • the response header is used to notify the sender of information about the server, such as the model of the server, the compression format of the data, the length of the returned data, the language environment, and the type of the returned data to the sender.
  • Step S332 Send the debugging data according to the response header to distinguish target log data and response data in the debugging data based on the size of the data in the response header.
  • the server returns the debugging data to the sending end that initiated the debugging request based on the generated response header, so that the developer can determine the response data and target log data in the debugging data according to the data size in the response header.
  • the response header X-Ori-Content-Length: 100, which means that the data size of the response data is 100 bytes.
  • the developer will intercept the first 100 bytes or the last 100 bytes from the returned debugging data according to the data size in the response header. One byte is used as the response data, and the rest is the target log data, and then the response data and target log data are combined to investigate the cause of the service exception.
  • the target log data and response data generated by the business logic for the current debugging request are collected through the set target log level, and the two are distinguished by the data size of the response data, so as to realize the basis of the target log data and the response data.
  • the collected target log data is the abnormally-related log data required by the developer, the collection of irrelevant log data is avoided, the amount of data processing is reduced, and the processing efficiency is improved; at the same time, the target log data is combined with the data size.
  • the distinction of response data is conducive to the rapid distinction between the two and further improves the efficiency of data processing.
  • a third real-time example of the business logic debugging method of the present application is proposed.
  • the steps of the target log level, the target encryption key and the first encryption value corresponding to the debugging request include:
  • Step S11 when a debugging request is detected, record the detection time point, and read the generation time point of the debugging request;
  • the internal interface of the server before verifying the verification of the first encrypted value, also involves verification between the time when the developer constructs the request header and the time when the server detects the debugging request, that is, pass Secondary verification to ensure the security of the transmitted data.
  • the time when the debugging request is detected is recorded as the detection time point, and the generation time point of the debugging request is read; wherein, the generation time point may be
  • the time point information when constructing the request header can also be the time when the sender sends the debugging request.
  • Step S12 judging whether the time difference between the detection time point and the generation time point is within a preset time range
  • a preset time range representing the magnitude of the time difference is preset, and the detection time point and the generation time point are compared to obtain the time difference between the two. The obtained time difference is compared with the preset time range to determine whether the time difference is within the preset time range.
  • Step S13 if the time difference is within the preset time range, execute the step of reading the target log level, the target encryption key, and the first encryption value carried in the debugging request.
  • time difference is within the preset time range, it means that the time when the request header is constructed or the time when the sender sends the debugging request is not far from the time when the debugging request is detected, and the debugging request is reasonable. If the time difference is not within the preset time range, it means that the time when the request header is constructed or the time when the sender sends the debugging request is far from the time when the debugging request is detected.
  • the debugging request may be risky but not risky. Debugging request for continued processing.
  • the first encrypted value and the second encrypted value in this embodiment are related to time.
  • encrypting the target log level according to the target encryption key, and the step of generating the second encrypted value includes:
  • An encryption rule is determined according to the target encryption key, the encryption rule is invoked, and the target log level and the detection time point are encrypted based on the target encryption key to generate a second encrypted value.
  • an encryption rule is used to characterize the encryption algorithm, and the corresponding relationship between the encryption key and the encryption rule is preset.
  • the target encryption key set by the developer must exist in the corresponding relationship, otherwise the set target encryption key Invalid, in order to further prevent tampering by non-developers and ensure the security of encryption.
  • the corresponding relationship between the encryption key and the encryption rule is called, and the corresponding encryption rule in the corresponding relationship is determined according to the read target encryption key, and then the corresponding encryption is called
  • the rule encrypts the target log level and the detection time point with the target encryption key to generate a second encrypted value. It should be noted that the second encrypted value of this embodiment is related to time.
  • the first encrypted value is also related to time.
  • the encryption rule corresponding to the target encryption key in the sender is called, and The set target log level and the time point information for constructing the request header are encrypted by the target encryption key to generate the first encrypted value.
  • a certain threshold can be set, when the first encrypted value and the If the difference between the second encrypted values is within the threshold range, it is determined that the two match; if the difference between the two exceeds the threshold range, it is determined that the two do not match.
  • the initial verification is performed through time first, and then the re-verification is performed through the first encrypted value and the second encrypted value, so that the security is better.
  • the factor of time is added to generate the first encrypted value and the second encrypted value, so that the first encrypted value and the second encrypted value generated each time have dynamic characteristics, which further ensures the security of data transmission.
  • the business logic debugging device includes:
  • the reading module 10 is used to read the target log level, the target encryption key and the first encrypted value corresponding to the debugging request when a debugging request is detected, and the debugging request includes information related to the target log level , The target encryption key and the request header corresponding to the first encryption value;
  • the generating module 20 is configured to encrypt the target log level according to the target encryption key to generate a second encrypted value
  • the debugging module 30 is configured to collect debugging data generated based on the business logic corresponding to the debugging request according to the target log level when the first encrypted value matches the second encrypted value, so as to be based on the The debugging data debugs the business logic.
  • the reading module 10 reads the target log level, the target encryption key, and the first encrypted data corresponding to the debugging request.
  • An encrypted value; and the generation module 20 encrypts the target log level with the target encryption key to generate a second encrypted value; if it is determined that the first encrypted value and the second encrypted value match, the debugging module 30 will, according to the target log level, Collect debugging data generated based on the business logic corresponding to the debugging request, so as to realize the debugging of the business logic based on the debugging data.
  • this application uses the consistency between the first encrypted value and the second encrypted value to promptly detect malicious acquisition or attack of log data by non-developers, avoid the leakage of log data, and facilitate the security of online services;
  • this application uses the consistency between the first encrypted value and the second encrypted value to promptly detect malicious acquisition or attack of log data by non-developers, avoid the leakage of log data, and facilitate the security of online services;
  • by setting the target log level to collect debugging data it avoids obtaining irrelevant data for analysis and affecting the server's data processing ability, which improves the accuracy and efficiency of analysis.
  • the debugging module further includes:
  • the collection unit is configured to adjust the default level of log data generated by the business logic corresponding to the debugging request according to the target log level, and collect the log data generated by the business logic corresponding to the adjusted default level Target log data;
  • a reading unit configured to read the response data generated by the business logic, and set the target log data and the response data as debugging data;
  • the sending unit is configured to send the debugging data to the sending end corresponding to the debugging request, so as to debug the service logic based on the debugging data.
  • the sending unit is further configured to:
  • the debugging data is sent according to the response header to distinguish target log data and response data in the debugging data based on the size of the data in the response header.
  • the collection unit is further configured to:
  • the target log data is sent to a buffer area corresponding to the debugging request for buffering.
  • the reading module further includes:
  • the recording unit is used to record the detection time point when a debugging request is detected, and read the generation time point of the debugging request;
  • a judging unit configured to judge whether the time difference between the detection time point and the generation time point is within a preset time range
  • the execution unit is configured to execute the step of reading the target log level, the target encryption key, and the first encryption value carried in the debugging request if the time difference is within the preset time range.
  • the generating module further includes:
  • An encryption rule is determined according to the target encryption key, the encryption rule is invoked, and the target log level and the detection time point are encrypted based on the target encryption key to generate a second encrypted value.
  • the business logic debugging device further includes:
  • the receiving module is configured to receive the communication connection request sent by the sending end corresponding to the debugging request, and to perform identity verification on the sending end;
  • the establishment module is configured to establish a communication connection with the sending end after the identity verification is successful, so that the sending end can construct a request header and send the debugging request based on the request header, wherein the request header Generated based on the target log level, the target encryption key, and the time point information constructed by the request header.
  • each virtual function module of the above-mentioned service logic debugging device is stored in the memory 1005 of the service logic debugging device shown in FIG. 3.
  • the processor 1001 executes the service logic debugging program, the function of each module in the embodiment shown in FIG. 2 is realized.
  • FIG. 3 is a schematic diagram of the device structure of the hardware operating environment involved in the method of the embodiment of the present application.
  • the business logic debugging device of the embodiment of the present application may be a PC (personal computer, personal computer), or a terminal device such as a smart phone, a tablet computer, an e-book reader, and a portable computer.
  • the service logic debugging device may include: a processor 1001, such as a CPU (Central Processing Unit, central processing unit), a memory 1005, and a communication bus 1002.
  • the communication bus 1002 is used to implement connection and communication between the processor 1001 and the memory 1005.
  • the memory 1005 may be a high-speed RAM (random Access memory, random access memory), can also be a stable memory (non-volatile memory), such as disk memory.
  • the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
  • the service logic debugging equipment may also include user interfaces, network interfaces, cameras, RF (Radio Frequency, radio frequency) circuits, sensors, audio circuits, WiFi (Wireless Fidelity, wireless broadband) module and so on.
  • the user interface may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the optional user interface may also include a standard wired interface and a wireless interface.
  • the optional network interface can include standard wired interface and wireless interface (such as WI-FI interface).
  • the structure of the business logic debugging device shown in FIG. 3 does not constitute a limitation on the business logic debugging device, and may include more or fewer components than shown in the figure, or a combination of certain components, or different components.
  • the layout of the components does not constitute a limitation on the business logic debugging device, and may include more or fewer components than shown in the figure, or a combination of certain components, or different components. The layout of the components.
  • the memory 1005 which is a computer-readable storage medium, may include an operating system, a network communication module, and a business logic debugging program.
  • the operating system is a program that manages and controls the hardware and software resources of the business logic debugging equipment, and supports the operation of the business logic debugging program and other software and/or programs.
  • the network communication module is used to implement communication between various components in the memory 1005, and to communicate with other hardware and software in the business logic debugging device.
  • the processor 1001 is used to execute the business logic debugging program stored in the memory 1005 to implement the steps in each embodiment of the foregoing business logic debugging method.
  • the computer-readable storage medium may be non-volatile or volatile.
  • the computer-readable storage medium stores one or more programs. Alternatively, one or more programs may also be executed by one or more processors to implement the steps in each embodiment of the foregoing service logic debugging method.
  • the technical solution of this application essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product is stored in a computer-readable storage medium as described above (such as The ROM/RAM, magnetic disk, optical disk) includes several instructions to enable a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to execute the method described in each embodiment of the present application.
  • a terminal device which may be a mobile phone, a computer, a server, or a network device, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

Disclosed are a business logic debugging method and apparatus, a device, and a computer-readable storage medium. The method comprises: when a debugging request comprising a request header is detected, reading a target log level, a target encryption key, and a first encryption value corresponding to the debugging request; encrypting the target log level according to the target encryption key to generate a second encryption value; when the first encryption value matches the second encryption value, acquiring, according to the target log level, debugging data generated on the basis of a business logic corresponding to the debugging request, so as to debug the business logic on the basis of the debugging data.

Description

业务逻辑调试方法、装置、设备及计算机可读存储介质Business logic debugging method, device, equipment and computer readable storage medium
本申请要求2020年3月12日申请的,申请号为202010174165.6,名称为“业务逻辑调试方法、装置、设备及计算机可读存储介质”的中国专利申请的优先权,在此将其全文引入作为参考。This application claims the priority of the Chinese patent application filed on March 12, 2020, with the application number 202010174165.6, titled "Business logic debugging method, device, equipment and computer-readable storage medium". The full text is hereby incorporated as refer to.
技术领域Technical field
本申请主要涉及服务器技术领域,具体地说,涉及一种业务逻辑调试方法、装置、设备及计算机可读存储介质。This application mainly relates to the field of server technology, and specifically, to a method, device, device, and computer-readable storage medium for debugging business logic.
背景技术Background technique
随着网络技术的发展,通过服务器中业务逻辑来提供的线上服务访问越来越多。用户在使用线上服务访问的过程中,可能由于各种各样的原因而导致访问异常,此时开发人员通常需要依据提供访问的业务逻辑所生成的日志数据来排查问题。With the development of network technology, more and more online service accesses are provided through business logic in the server. When a user accesses an online service, the access may be abnormal due to various reasons. At this time, the developer usually needs to troubleshoot the problem based on the log data generated by the business logic that provides the access.
当前为了全面体现业务逻辑的功能,设置有针对业务逻辑的各方面均生成日志数据的机制,一旦出现线上服务访问异常的情况,则获取对应业务逻辑所生成的日志数据进行分析。然而,发明人发现,分析的日志数据中容易存在与异常不相关的数据,增加了分析的数据量,影响了分析的效率,且给服务器提供正常访问带来了数据处理的压力;此外其他非开发人员也可通过构建请求来获取或攻击日志数据,导致了日志数据的泄露,给线上服务带来风险。At present, in order to fully reflect the functions of business logic, a mechanism is set up to generate log data for all aspects of business logic. Once an online service access exception occurs, the log data generated by the corresponding business logic is obtained for analysis. However, the inventor found that the analyzed log data is likely to contain data that is not related to abnormalities, which increases the amount of data analyzed, affects the efficiency of analysis, and brings data processing pressure to the normal access to the server; in addition, other non-relevant data Developers can also obtain or attack log data by constructing requests, which leads to the leakage of log data and brings risks to online services.
技术解决方案Technical solutions
本申请的主要目的是提供一种业务逻辑调试方法、装置、设备及计算机可读存储介质,旨在解决现有技术中对业务逻辑的日志数据分析效率低,影响服务器的数据处理和线上服务安全性的问题。The main purpose of this application is to provide a business logic debugging method, device, equipment, and computer readable storage medium, aiming to solve the low efficiency of log data analysis of business logic in the prior art, which affects server data processing and online services Security issues.
为实现上述目的,本申请提供一种业务逻辑调试方法,所述业务逻辑调试方法包括以下步骤:In order to achieve the above objective, this application provides a business logic debugging method, which includes the following steps:
当侦测到调试请求时,读取与所述调试请求对应的目标日志等级、目标加密秘钥和第一加密数值,所述调试请求中包括与所述目标日志等级、目标加密密钥和第一加密数值对应的请求头;When a debugging request is detected, the target log level, target encryption key, and first encryption value corresponding to the debugging request are read. The debugging request includes the target log level, target encryption key, and first encryption value. A request header corresponding to the encrypted value;
根据所述目标加密秘钥对所述目标日志等级进行加密,生成第二加密数值;Encrypting the target log level according to the target encryption key to generate a second encrypted value;
当所述第一加密数值和所述第二加密数值匹配时,根据所述目标日志等级,采集基于与所述调试请求对应的业务逻辑生成的调试数据,以基于所述调试数据对所述业务逻辑进行调试。When the first encrypted value matches the second encrypted value, the debugging data generated based on the business logic corresponding to the debugging request is collected according to the target log level, so as to compare the business based on the debugging data. Logic for debugging.
此外,为实现上述目的,本申请还提出一种业务逻辑调试装置,所述业务逻辑调试装置包括:In addition, in order to achieve the above objective, this application also proposes a business logic debugging device, the business logic debugging device includes:
读取模块,用于当侦测到调试请求时,读取与所述调试请求对应的目标日志等级、目标加密秘钥和第一加密数值,所述调试请求中包括与所述目标日志等级、目标加密密钥和第一加密数值对应的请求头;The reading module is used to read the target log level, target encryption key, and first encrypted value corresponding to the debugging request when a debugging request is detected, and the debugging request includes the target log level, The request header corresponding to the target encryption key and the first encryption value;
生成模块,用于根据所述目标加密秘钥对所述目标日志等级进行加密,生成第二加密数值;A generating module, configured to encrypt the target log level according to the target encryption key to generate a second encrypted value;
调试模块,用于当所述第一加密数值和所述第二加密数值匹配时,根据所述日志等级,采集基于与所述调试请求对应的业务逻辑生成的调试数据,以基于所述调试数据对所述业务逻辑进行调试。The debugging module is configured to collect debugging data generated based on the business logic corresponding to the debugging request according to the log level when the first encrypted value matches the second encrypted value, so as to be based on the debugging data Debug the business logic.
此外,为实现上述目的,本申请还提出一种业务逻辑调试设备,所述业务逻辑调试设备包括:存储器、处理器、通信总线以及存储在所述存储器上的业务逻辑调试程序;In addition, in order to achieve the above object, this application also proposes a business logic debugging device, the business logic debugging device includes: a memory, a processor, a communication bus, and a business logic debugging program stored on the memory;
所述通信总线用于实现处理器和存储器之间的连接通信;The communication bus is used to realize the connection and communication between the processor and the memory;
所述处理器用于执行所述业务逻辑调试程序,以实现以下步骤:The processor is used to execute the business logic debugging program to implement the following steps:
当侦测到调试请求时,读取与所述调试请求对应的目标日志等级、目标加密秘钥和第一加密数值,所述调试请求中包括与所述目标日志等级、目标加密密钥和第一加密数值对应的请求头;When a debugging request is detected, the target log level, target encryption key, and first encryption value corresponding to the debugging request are read. The debugging request includes the target log level, target encryption key, and first encryption value. A request header corresponding to the encrypted value;
根据所述目标加密秘钥对所述目标日志等级进行加密,生成第二加密数值;Encrypting the target log level according to the target encryption key to generate a second encrypted value;
当所述第一加密数值和所述第二加密数值匹配时,根据所述目标日志等级,采集基于与所述调试请求对应的业务逻辑生成的调试数据,以基于所述调试数据对所述业务逻辑进行调试。When the first encrypted value matches the second encrypted value, the debugging data generated based on the business logic corresponding to the debugging request is collected according to the target log level, so as to compare the business based on the debugging data. Logic for debugging.
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者一个以上程序,所述一个或者一个以上程序可被一个或者一个以上的处理器执行以用于:In addition, in order to achieve the above-mentioned object, the present application also provides a computer-readable storage medium that stores one or more programs, and the one or more programs can be used by one or more processors. Execute for:
当侦测到调试请求时,读取与所述调试请求对应的目标日志等级、目标加密秘钥和第一加密数值,所述调试请求中包括与所述目标日志等级、目标加密密钥和第一加密数值对应的请求头;When a debugging request is detected, the target log level, target encryption key, and first encryption value corresponding to the debugging request are read. The debugging request includes the target log level, target encryption key, and first encryption value. A request header corresponding to the encrypted value;
根据所述目标加密秘钥对所述目标日志等级进行加密,生成第二加密数值;Encrypting the target log level according to the target encryption key to generate a second encrypted value;
当所述第一加密数值和所述第二加密数值匹配时,根据所述目标日志等级,采集基于与所述调试请求对应的业务逻辑生成的调试数据,以基于所述调试数据对所述业务逻辑进行调试。When the first encrypted value matches the second encrypted value, the debugging data generated based on the business logic corresponding to the debugging request is collected according to the target log level, so as to compare the business based on the debugging data. Logic for debugging.
本实施例的业务逻辑调试方法,当侦测到包括与目标日志等级请求、目标加密秘钥和第一加密数据对应请求头的调试请求时,通过读取与调试请求对应的目标日志等级、目标加密秘钥和第一加密数值;并由目标加密秘钥对目标日志等级进行加密,生成第二加密数值;若经判定第一加密数值和第二加密数值匹配,则根据目标日志等级,采集基于与调试请求对应的业务逻辑生成的调试数据,以此实现基于调试数据对业务逻辑进行调试。本申请一方面通过第一加密数值和第二加密数值之间的一致性,来及时发现非开发人员对日志数据的恶意获取或攻击,避免日志数据的泄露,有利于线上服务的安全性;另一方面通过设定目标日志等级来采集调试数据,避免获取到不相关数据进行分析和影响到服务器数据处理的能力,提高了分析的准确性和分析效率。In the business logic debugging method of this embodiment, when a debugging request including a request header corresponding to the target log level request, the target encryption key and the first encrypted data is detected, the target log level and target corresponding to the debugging request are read. The encryption key and the first encrypted value; and the target log level is encrypted by the target encryption key to generate the second encrypted value; if it is determined that the first encrypted value matches the second encrypted value, the collection is based on the target log level The debugging data generated by the business logic corresponding to the debugging request can be used to debug the business logic based on the debugging data. On the one hand, this application uses the consistency between the first encrypted value and the second encrypted value to promptly detect malicious acquisition or attack of log data by non-developers, avoid the leakage of log data, and facilitate the security of online services; On the other hand, by setting the target log level to collect debugging data, it avoids obtaining irrelevant data for analysis and affecting the server's data processing ability, which improves the accuracy and efficiency of analysis.
附图说明Description of the drawings
图1是本申请的业务逻辑调试方法第一实施例的流程示意图;FIG. 1 is a schematic flowchart of the first embodiment of the business logic debugging method of the present application;
图2是本申请的业务逻辑调试装置第一实施例的功能模块示意图;2 is a schematic diagram of functional modules of the first embodiment of the business logic debugging device of the present application;
图3是本申请实施例方法涉及的硬件运行环境的设备结构示意图。FIG. 3 is a schematic diagram of the device structure of the hardware operating environment involved in the method of the embodiment of the present application.
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics, and advantages of the purpose of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings.
本发明的实施方式Embodiments of the present invention
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。It should be understood that the specific embodiments described here are only used to explain the present application, and are not used to limit the present application.
本申请提供一种业务逻辑调试方法。This application provides a business logic debugging method.
请参照图1,图1为本申请业务逻辑调试方法第一实施例的流程示意图。在本实施例中,所述业务逻辑调试方法包括:Please refer to FIG. 1, which is a schematic flowchart of a first embodiment of a business logic debugging method of this application. In this embodiment, the business logic debugging method includes:
步骤S10,当侦测到调试请求时,读取与所述调试请求对应的目标日志等级、目标加密秘钥和第一加密数值,所述调试请求中包括与所述目标日志等级、目标加密密钥和第一加密数值对应的请求头;Step S10: When a debugging request is detected, read the target log level, target encryption key, and first encryption value corresponding to the debugging request, and the debugging request includes the target log level and target encryption secret. The request header corresponding to the key and the first encrypted value;
本申请业务逻辑调试方法应用于服务器,适用于通过服务器对出现线上服务异常的业务逻辑所生成的数据进行针对性采集,以便于依据采集的数据进行分析调试,查找异常原因。考虑到本实施例针对服务器在提供线上服务访问过程中所出现的异常进行调试,为了避免调试对用户正常访问的影响,服务器除了设置有用于外部访问的外部接口之外还设置有专用于调试的内部接口;触发调试的请求以及用于调试的数据通过内部接口进行传输,而用户的正常访问则通过外部接口进行;通过外部接口将用户发起的请求传输到业务逻辑进行处理,并将处理结果通过外部接口返回到用户终端;以此实现在调试和正常访问之间进行区分。The business logic debugging method of this application is applied to a server, and is suitable for the targeted collection of data generated by the business logic of the online service abnormality through the server, so as to facilitate analysis and debugging based on the collected data to find the cause of the abnormality. Considering that this embodiment debugs the abnormalities that occur in the process of providing online service access by the server, in order to avoid the impact of debugging on the normal user access, the server is provided with an external interface for external access in addition to an external interface dedicated for debugging. The internal interface; the request for triggering debugging and the data used for debugging are transmitted through the internal interface, while the normal access of the user is carried out through the external interface; the request initiated by the user is transmitted to the business logic for processing through the external interface, and the processing result Return to the user terminal through an external interface; this enables the distinction between debugging and normal access.
进一步地,为了实现开发人员的调试,设置有可与服务器之间进行通信的发送端,该发送端可以是诸如手机、平板电脑之类的移动终端,也可以是智能手环、智能手表之类的穿戴式设备,还可以是台式电脑之类的固定终端。当线上服务访问出现异常,需要对其业务逻辑进行调试时,开发人员通过该发送端构建调试请求发送到服务器,以请求获取与异常对应的数据进行调试。Further, in order to realize debugging by developers, a sending end that can communicate with the server is provided. The sending end can be a mobile terminal such as a mobile phone or a tablet computer, or a smart bracelet, a smart watch, etc. The wearable device can also be a fixed terminal such as a desktop computer. When the online service access is abnormal and the business logic needs to be debugged, the developer constructs a debug request through the sender and sends it to the server to request the data corresponding to the abnormality for debugging.
可理解地,调试请求的发送以服务器与发送端之间建立有通信连接为基础,从而在将调试请求发送到服务器之前,需要建立两者之间的通信连接,并确保通信的安全性。具体地,步骤S10之前包括:Understandably, the sending of the debugging request is based on the establishment of a communication connection between the server and the sending end. Therefore, before sending the debugging request to the server, a communication connection between the two needs to be established and the security of the communication must be ensured. Specifically, before step S10, it includes:
步骤a1,接收所述调试请求对应发送端发送的通信连接请求,并对所述发送端进行身份验证;Step a1, receiving the communication connection request sent by the sending end corresponding to the debugging request, and performing identity verification on the sending end;
开发人员通过发送端向服务器发送通信连接请求,服务器在接收到该通信连接请求后,为了确保通信的安全性,对发送端进行身份验证。其中身份验证可以通过表征发送端唯一性的标识符进行,如发送端的mac地址(Media Access Control Address)或者IMEI(International Mobile Equipment Identity,国际移动设备标识)等。发送端在发送通信连接请求前,先读取其自身的该类标识符添加到通信连接请求中再进行发送操作;服务器在接收到通信连接请求后,则对其中的标识符进行读取。或者发送端仅发起通信连接请求,服务器在接收到通信连接请求后,向发送端返回获取其标识符以进行身份验证的验证请求,发送端依据该验证请求向服务器发送标识符。服务器预先对用于调试的发送端的标识符进行存储,在获取到发送端的标识符后,将其和预先存储的各标识符进行对比,判断获取的标识符是否存在于存储的标识符中;若存在则判定身份验证成功,否则判定身份验证失败,拒绝与发送端建立通信连接。The developer sends a communication connection request to the server through the sender. After receiving the communication connection request, the server authenticates the sender in order to ensure the security of the communication. The identity verification can be carried out through the unique identifier of the sender, such as the MAC address of the sender (Media Access Control Address) or IMEI (International Mobile Equipment Identity, International Mobile Equipment Identity), etc. Before sending the communication connection request, the sender reads its own identifier of this type and adds it to the communication connection request before sending it; after receiving the communication connection request, the server reads the identifier in it. Or the sender only initiates a communication connection request. After receiving the communication connection request, the server returns a verification request for obtaining its identifier for identity verification to the sender, and the sender sends the identifier to the server according to the verification request. The server stores the identifier of the sender used for debugging in advance, and after obtaining the identifier of the sender, compares it with the pre-stored identifiers to determine whether the obtained identifier exists in the stored identifier; if If it exists, it is judged that the identity verification is successful, otherwise it is judged that the identity verification has failed, and the communication connection with the sender is refused.
步骤a2,当所述身份验证成功后,建立与所述发送端之间的通信连接,以供所述发送端构建请求头,并基于请求头发送所述调试请求,其中所述请求头基于所述目标日志等级、所述目标加密秘钥以及所述请求头构建的时间点信息生成。Step a2: After the identity verification is successful, establish a communication connection with the sender for the sender to construct a request header, and send the debugging request based on the request header, wherein the request header is based on the request header. The target log level, the target encryption key, and the time point information of the request header construction are generated.
进一步地,在服务器对发送端的身份验证成功后,则建立与发送端之间的通信连接,以实现发送端与服务器之间的数据传输。此外,为了确保从服务器采集的数据与访问异常具有相关性,开发人员通过发送端构建请求头,以基于请求头将调试请求发送到服务器,实现两者之间的通信。其中请求头用于通知服务器有关发送端请求的信息,如通知服务器发送端所支持的数据类型、支持哪种字符集、支持哪种压缩格式、语言环境、访问哪台主机等。本实施例开发人员在构建请求头时,设置所需要采集的目标日志等级和用于实现加密的目标加密秘钥,发送端将该目标日志等级、目标加密秘钥以及所构建请求头的当前时间点信息添加到请求头中,形成请求头特殊的头部,如所构建的请求头为X-Debug-Req: token,则token即为通过目标日志等级、加密密钥和时间点信息生成的特殊头部。Further, after the server successfully authenticates the sender, a communication connection with the sender is established to realize data transmission between the sender and the server. In addition, in order to ensure that the data collected from the server is correlated with the access exception, the developer constructs the request header through the sender, so that the debugging request is sent to the server based on the request header to realize the communication between the two. The request header is used to inform the server about the information requested by the sender, such as the data type supported by the sender, which character set is supported, which compression format is supported, the language environment, which host is accessed, etc. When constructing the request header in this embodiment, the developer sets the target log level that needs to be collected and the target encryption key used to achieve encryption, and the sender sets the target log level, target encryption key, and the current time of the constructed request header. The point information is added to the request header to form a special header of the request header. If the constructed request header is X-Debug-Req: token, then the token is the special generated by the target log level, encryption key and time point information head.
需要说明的是,本实施例中根据日志数据所反映异常的严重程度的不同,将日志数据划分为多个目标日志等级,至少包括FATAL、ERROR、WARN、INFO、DEBUG五个等级;开发人员依据异常的实际情况设定其所需要拉取的日志数据的目标日志等级。如异常的实际情况属于WARN级,则可将目标日志等级设定为WARN,以对目标日志等级在WARN等级以上的日志数据进行拉取,而避免拉取到与异常不相关的日志数据,提高处理效率。此外,为了避免非开发人员对日志数据的恶意拉取,导致日志数据的泄露而影响线上服务的安全性,设置有加密机制;由开发人员在构建请求头时设置目标加密秘钥,以通过目标加密秘钥实现对目标日志等级的加密处理。It should be noted that in this embodiment, according to the severity of the abnormality reflected by the log data, the log data is divided into multiple target log levels, including at least five levels: FATAL, ERROR, WARN, INFO, and DEBUG; The actual situation of the exception sets the target log level of the log data that it needs to pull. If the actual condition of the abnormality is WARN level, the target log level can be set to WARN to pull log data with the target log level above WARN level, and avoid pulling log data that is not related to the abnormality. Processing efficiency. In addition, in order to avoid the malicious pull of log data by non-developers, resulting in the leakage of log data and affecting the security of online services, an encryption mechanism is set; the developer sets the target encryption key when constructing the request header to pass The target encryption key realizes the encryption processing of the target log level.
更进一步地,发送端中预先设置有加密算法,该加密算法可以是诸如DES、RC2、RC4、RC5和Blowfish之类的对称加密,也可以是诸如RSA、 Rabin、D-H、ECC此类的非对称加密,还可以是MD5加密等。发送端在接收到开发人员所构建的请求头后,根据请求头中的目标加密秘钥通过加密算法对目标日志等级进行加密,生成第一加密数值;并将该第一加密数值和目标日志等级、目标加密秘钥、时间点信息一并作为调试请求对应的信息发送到服务器的内部接口。服务器的内部接口在侦测到该调试请求时,则对与其对应的目标日志等级、目标加密秘钥、时间点信息和第一加密数值进行读取,以通过时间点信息和第一加密数值验证后,采集与目标日志等级对应的日志数据返回到发送端。Furthermore, an encryption algorithm is preset in the sender. The encryption algorithm can be symmetric encryption such as DES, RC2, RC4, RC5 and Blowfish, or asymmetric encryption such as RSA, Rabin, DH, and ECC. Encryption can also be MD5 encryption, etc. After receiving the request header constructed by the developer, the sender encrypts the target log level through the encryption algorithm according to the target encryption key in the request header, and generates the first encrypted value; and the first encrypted value is combined with the target log level , The target encryption key and time point information are sent to the internal interface of the server as the information corresponding to the debugging request. When the internal interface of the server detects the debugging request, it reads the corresponding target log level, target encryption key, time point information, and first encrypted value to pass the time point information and the first encrypted value verification After that, the log data corresponding to the target log level is collected and returned to the sender.
步骤S20,根据所述目标加密秘钥对所述目标日志等级进行加密,生成第二加密数值;Step S20: encrypt the target log level according to the target encryption key to generate a second encrypted value;
进一步地,服务器的内部接口设置有和发送端相同的加密算法,在读取到时间点信息、目标日志等级和目标加密秘钥之后,先通过时间点信息判断当前侦测到调试请求的时间与构建请求头的时间是否相差较大,若较大则说明构建时间与接收时间之间的时间段较长,可能存在恶意攻击的风险,则拒绝采集日志数据返回到发送端。反之若两者之间相差不大,则说明构建时间与接收时间之间的时间段在合理范围内,属于正常请求,则通过目标加密秘钥采用预先设置的加密算法对目标日志等级进行加密,得到第二加密数值。通过第一加密数值和第二加密数值之间的一致性,来判断数据在传输到服务器内部接口的过程中是否遭到篡改攻击。Further, the internal interface of the server is set with the same encryption algorithm as the sender. After reading the time point information, target log level, and target encryption key, the time point information is used to determine the current detection time and the time of the debugging request. Whether there is a large difference in the time to construct the request header, if it is large, it means that the time period between the construction time and the receiving time is longer, and there may be a risk of malicious attacks. Therefore, refuse to collect log data and return it to the sender. On the contrary, if there is not much difference between the two, it means that the time period between the construction time and the reception time is within a reasonable range and is a normal request. Then the target log level is encrypted by the target encryption key and the preset encryption algorithm. Obtain the second encrypted value. Based on the consistency between the first encrypted value and the second encrypted value, it is judged whether the data is subject to tampering attacks during transmission to the internal interface of the server.
步骤S30,当所述第一加密数值和所述第二加密数值匹配时,根据所述目标日志等级,采集基于与所述调试请求对应的业务逻辑生成的调试数据,以基于所述调试数据对所述业务逻辑进行调试。Step S30: When the first encrypted value matches the second encrypted value, according to the target log level, collect debugging data generated based on the business logic corresponding to the debugging request, so as to pair the debugging data based on the debugging data. The business logic is debugged.
更进一步地,将生成的第二加密数值和读取的第一加密数值进行对比,判断两者之间的一致性;若两者一致,则判定两者匹配,发送端和内部接口所采用的加密算法为预先设置的算法,目标加密秘钥、目标日志等级以及第一加密数值在传输过程中未经篡改;否则判定第一加密数值和第二加密数值不匹配,数据在传输到服务器内部接口过程中经过恶意篡改,调试请求具有风险性,拒绝采集日志数据返回到发送端。对于第一加密数值和第二加密数值匹配,不具有风险性的调试请求,服务器从由调试请求所触发业务逻辑生成的日志数据中,采集与目标日志等级对应的目标日志数据;同时获取业务逻辑的响应数据,和目标日志数据一并作为调试数据返回到发送端,以便于开发人员依据返回的调试数据对业务逻辑进行调试。Furthermore, the generated second encrypted value is compared with the read first encrypted value to determine the consistency between the two; if the two are consistent, it is determined that the two match, the sender and the internal interface used The encryption algorithm is a preset algorithm. The target encryption key, target log level, and first encrypted value have not been tampered with during transmission; otherwise, it is determined that the first encrypted value and the second encrypted value do not match, and the data is being transmitted to the internal interface of the server After malicious tampering in the process, the debugging request is risky, and the log data is refused to be collected and returned to the sender. For debugging requests that match the first encrypted value and the second encrypted value without risk, the server collects the target log data corresponding to the target log level from the log data generated by the business logic triggered by the debugging request; at the same time obtains the business logic The response data and target log data are returned to the sending end as debugging data, so that developers can debug business logic based on the returned debugging data.
需要说明的是,为了避免采集的目标日志数据与外部访问所生成的日志数据混淆,服务器中设置有专用于存储调试的日志数据的缓存区;将该缓存区作为与调试请求对应的缓存区,且设置定时清理机制。服务器将采集的目标日志数据发送到该缓存区缓存,并检测缓存区中以往存储的各目标日志数据的存储时长,当各目标日志数据中存在某一目标日志数据的存储时长大于预设实质的时长阈值时,输出提示信息,提示对该目标日志数据进行清理,以释放存储空间,便于后续目标日志数据的存储。It should be noted that in order to avoid confusion between the collected target log data and the log data generated by external access, the server is provided with a buffer area dedicated to storing log data for debugging; this buffer area is used as a buffer area corresponding to the debugging request. And set up a regular cleaning mechanism. The server sends the collected target log data to the cache area, and detects the storage duration of each target log data previously stored in the cache area. When there is a target log data in each target log data, the storage duration is greater than the preset substantial When the duration threshold is set, a prompt message is output, prompting to clean up the target log data to free up storage space and facilitate subsequent storage of the target log data.
本实施例的业务逻辑调试方法,当侦测到包括与目标日志等级请求、目标加密秘钥和第一加密数据对应请求头的调试请求时,通过读取与调试请求对应的目标日志等级、目标加密秘钥和第一加密数值;并由目标加密秘钥对目标日志等级进行加密,生成第二加密数值;若经判定第一加密数值和第二加密数值匹配,则根据目标日志等级,采集基于与调试请求对应的业务逻辑生成的调试数据,以此实现基于调试数据对业务逻辑进行调试。本申请一方面通过第一加密数值和第二加密数值之间的一致性,来及时发现非开发人员对日志数据的恶意获取或攻击,避免日志数据的泄露,有利于线上服务的安全性;另一方面通过设定目标日志等级来采集调试数据,避免获取到不相关数据进行分析和影响到服务器数据处理的能力,提高了分析的准确性和分析效率。In the business logic debugging method of this embodiment, when a debugging request including a request header corresponding to the target log level request, the target encryption key and the first encrypted data is detected, the target log level and target corresponding to the debugging request are read. The encryption key and the first encrypted value; and the target log level is encrypted by the target encryption key to generate the second encrypted value; if it is determined that the first encrypted value matches the second encrypted value, the collection is based on the target log level The debugging data generated by the business logic corresponding to the debugging request can be used to debug the business logic based on the debugging data. On the one hand, this application uses the consistency between the first encrypted value and the second encrypted value to promptly detect malicious acquisition or attack of log data by non-developers, avoid the leakage of log data, and facilitate the security of online services; On the other hand, by setting the target log level to collect debugging data, it avoids obtaining irrelevant data for analysis and affecting the server's data processing ability, which improves the accuracy and efficiency of analysis.
进一步地,基于本申请业务逻辑调试方法第一实施例,提出本申请业务逻辑调试方法的第二实时例,在第二实施例中,所述根据所述目标日志等级,采集基于与所述调试请求对应的业务逻辑生成的调试数据,以基于所述调试数据对所述业务逻辑进行调试的步骤包括:Further, based on the first embodiment of the business logic debugging method of the present application, a second real-time example of the business logic debugging method of the present application is proposed. In the second embodiment, the collection based on the target log level and the debugging The step of requesting the debugging data generated by the corresponding business logic to debug the business logic based on the debugging data includes:
步骤S31,根据所述目标日志等级,调整与所述调试请求对应的业务逻辑生成的日志数据的默认等级,并从所述业务逻辑所生成的日志数据中,采集与调整后默认等级对应的目标日志数据;Step S31: Adjust the default level of log data generated by the business logic corresponding to the debugging request according to the target log level, and collect the target corresponding to the adjusted default level from the log data generated by the business logic Log data;
可理解地,经调试请求所触发的业务逻辑生成的日志数据多种多样,以反映不同危险程度的异常,通常对于危险程度很小、不影响使用的异常所对应的日志数据不进行处理。只有当异常的危险程度较大,影响使用时,才对该异常所对应的日志数据进行处理。本实施例中将需要处理的日志数据具有的日志等级设定为业务逻辑生成的日志数据的默认等级,服务器在读取到目标日志等级后,将其和业务逻辑所生成日志数据的默认等级进行对比,判断两者的一致性。若一致则说明默认返回的日志数据的日志等级满足开发人员所需要的目标日志等级,而从业务逻辑针对当前调试请求所生成的日志数据中,直接获取默认等级以上的目标日志数据返回到发送端。若默认等级和目标日志等级不一致,则依据目标日志等级对默认等级进行调整,将默认等级调整为目标日志等级,以从业务逻辑针对当前调试请求所生成的日志数据中,采集与调整之后的默认等级对应的目标日志数据返回到发送端。如预先针对各请求所设定的日志数据返回的默认等级为ERROR级,而当前调试请求表征所需求的目标日志等级为DEBUG,服务器则将日志数据返回的等级调整为DEBUG,以针对当前调试请求所生成的DEBUG等级以上的目标日志数据进行获取。Understandably, the log data generated by the business logic triggered by the debugging request is diverse to reflect abnormalities with different degrees of risk. Generally, log data corresponding to abnormalities that are small in risk and do not affect the use are not processed. The log data corresponding to the abnormality is processed only when the degree of danger of the abnormality is large and affects the use. In this embodiment, the log level of the log data that needs to be processed is set as the default level of the log data generated by the business logic. After the server reads the target log level, it compares it with the default level of the log data generated by the business logic. Compare and judge the consistency of the two. If they are consistent, it means that the log level of the log data returned by default meets the target log level required by the developer. From the log data generated by the business logic for the current debugging request, the target log data above the default level is directly obtained and returned to the sending end. . If the default level and the target log level are inconsistent, the default level is adjusted according to the target log level, and the default level is adjusted to the target log level, so as to collect and adjust the default log data from the log data generated by the business logic for the current debugging request. The target log data corresponding to the level is returned to the sender. For example, the default level of log data returned for each request is ERROR level, and the target log level required by the current debugging request characterization is DEBUG, the server adjusts the level returned by the log data to DEBUG to target the current debugging request Obtain the generated target log data above the DEBUG level.
步骤S32,读取所述业务逻辑生成的响应数据,并将所述目标日志数据和所述响应数据设为调试数据;Step S32, reading the response data generated by the business logic, and setting the target log data and the response data as debugging data;
进一步地,业务逻辑针对调试请求进行响应会生成响应数据,在获取到业务逻辑针对当前调试请求生成的满足目标日志等级要求的目标日志数据之后,对该响应数据进行读取,并将该响应数据和目标日志数据一并设为调试数据,以结合两者调试,确定引起服务异常的原因。Further, the business logic responds to the debugging request to generate response data. After obtaining the target log data generated by the business logic for the current debugging request that meets the target log level requirements, the response data is read, and the response data Set the debugging data together with the target log data to combine the two debugging to determine the cause of the service exception.
步骤S33,将所述调试数据发送到与所述调试请求对应的发送端,以基于所述调试数据对所述业务逻辑进行调试。Step S33: Send the debugging data to the sending end corresponding to the debugging request, so as to debug the service logic based on the debugging data.
更进一步地,服务器在生成调试数据后,将其发送到发起调试请求的发送端,以便通过发送端发起调试请求的开发人员依据调试数据对引起服务异常的业务逻辑进行调试。其中,为了便于开发人员对调试数据中的响应数据和目标日志数据进行区分,设置有在响应头中添加响应数据的数据大小的机制;具体地,将调试数据发送到与调试请求对应的发送端的步骤包括:Furthermore, after the server generates the debugging data, it sends it to the sending end that initiates the debugging request, so that the developer who initiates the debugging request through the sending end can debug the business logic that caused the service exception based on the debugging data. Among them, in order to facilitate developers to distinguish between the response data in the debugging data and the target log data, a mechanism is provided to add the data size of the response data in the response header; specifically, the debugging data is sent to the sender corresponding to the debugging request. The steps include:
步骤S331,检测所述响应数据的数据大小,并将所述数据大小添加到所述业务逻辑的响应头中;Step S331: Detect the data size of the response data, and add the data size to the response header of the business logic;
更进一步地,检测业务逻辑对调试请求进行处理所生成响应数据的数据大小,并将检测所得的数据大小添加到业务逻辑的响应头中。其中,响应头用于通知发送端有关服务器的信息,如向发送端通知服务器的型号、数据的压缩格式、回送数据的长度、语言环境、回送数据的类型等。Furthermore, the data size of the response data generated by the business logic processing the debugging request is detected, and the detected data size is added to the response header of the business logic. Among them, the response header is used to notify the sender of information about the server, such as the model of the server, the compression format of the data, the length of the returned data, the language environment, and the type of the returned data to the sender.
步骤S332,根据所述响应头对所述调试数据进行发送,以基于所述响应头中的数据大小,对所述调试数据中的目标日志数据和响应数据进行区分。Step S332: Send the debugging data according to the response header to distinguish target log data and response data in the debugging data based on the size of the data in the response header.
进一步地,服务器基于所生成的响应头,将调试数据返回到发起调试请求的发送端,以便于开发人员依据响应头中的数据大小,确定调试数据中的响应数据和目标日志数据。如响应头:X-Ori-Content-Length: 100,表示响应数据的数据大小是100字节,开发人员依据响应头中的该数据大小,从返回的调试数据中截取前100字节或者后100个字节作为响应数据,其余内容为目标日志数据,进而结合响应数据和目标日志数据排查引起服务异常的原因。Further, the server returns the debugging data to the sending end that initiated the debugging request based on the generated response header, so that the developer can determine the response data and target log data in the debugging data according to the data size in the response header. For example, the response header: X-Ori-Content-Length: 100, which means that the data size of the response data is 100 bytes. The developer will intercept the first 100 bytes or the last 100 bytes from the returned debugging data according to the data size in the response header. One byte is used as the response data, and the rest is the target log data, and then the response data and target log data are combined to investigate the cause of the service exception.
本实施例中通过设定的目标日志等级来采集业务逻辑针对当前调试请求所生成的目标日志数据以及响应数据,并通过响应数据的数据大小对两者进行区分,实现依据目标日志数据和响应数据来进行调试。因采集的目标日志数据为开发人员所需求的与异常相关的日志数据,避免了对无关的日志数据的采集,减少了数据处理的数量,提高了处理效率;同时通过数据大小进行目标日志数据和响应数据的区分,有利于两者的快速区分,进一步提高了数据处理的效率。In this embodiment, the target log data and response data generated by the business logic for the current debugging request are collected through the set target log level, and the two are distinguished by the data size of the response data, so as to realize the basis of the target log data and the response data. To debug. Because the collected target log data is the abnormally-related log data required by the developer, the collection of irrelevant log data is avoided, the amount of data processing is reduced, and the processing efficiency is improved; at the same time, the target log data is combined with the data size. The distinction of response data is conducive to the rapid distinction between the two and further improves the efficiency of data processing.
进一步地,基于本申请业务逻辑调试方法第一或第二实施例,提出本申请业务逻辑调试方法的第三实时例,在第三实施例中,所述当侦测到调试请求时,读取与所述调试请求对应的目标日志等级、目标加密秘钥和第一加密数值的步骤包括:Further, based on the first or second embodiment of the business logic debugging method of the present application, a third real-time example of the business logic debugging method of the present application is proposed. In the third embodiment, when a debugging request is detected, read The steps of the target log level, the target encryption key and the first encryption value corresponding to the debugging request include:
步骤S11,当侦测到调试请求时,记录侦测时间点,并读取所述调试请求的生成时间点;Step S11, when a debugging request is detected, record the detection time point, and read the generation time point of the debugging request;
在本实施例中,服务器的内部接口在对第一加密数值的验证进行验证之前,还涉及到开发人员构建请求头的时间点与服务器侦测到调试请求的时间点之间的验证,即通过二次验证来确保所传输数据的安全性。具体地,当服务器的内部接口侦测到调试请求时,将侦测到该调试请求的时间作为侦测时间点进行记录,并读取调试请求的生成时间点;其中,该生成时间点可以是构建请求头时的时间点信息,也可以是发送端发送调试请求的时间。In this embodiment, before verifying the verification of the first encrypted value, the internal interface of the server also involves verification between the time when the developer constructs the request header and the time when the server detects the debugging request, that is, pass Secondary verification to ensure the security of the transmitted data. Specifically, when a debugging request is detected by the internal interface of the server, the time when the debugging request is detected is recorded as the detection time point, and the generation time point of the debugging request is read; wherein, the generation time point may be The time point information when constructing the request header can also be the time when the sender sends the debugging request.
步骤S12,判断所述侦测时间点和所述生成时间点之间的时间差是否在预设时间范围内;Step S12, judging whether the time difference between the detection time point and the generation time point is within a preset time range;
进一步地,预先设置有表征时间差值大小的预设时间范围,将侦测时间点和生成时间点进行对比,得到两者之间的时间差。将所得到的时间差和预设时间范围对比,判断时间差是否在预设时间范围内。Further, a preset time range representing the magnitude of the time difference is preset, and the detection time point and the generation time point are compared to obtain the time difference between the two. The obtained time difference is compared with the preset time range to determine whether the time difference is within the preset time range.
步骤S13,若所述时间差在预设时间范围内,则执行读取所述调试请求携带的目标日志等级、目标加密秘钥和第一加密数值的步骤。Step S13, if the time difference is within the preset time range, execute the step of reading the target log level, the target encryption key, and the first encryption value carried in the debugging request.
若时间差在预设时间范围内,说明构建请求头的时间或者发送端发送调试请求的时间与侦测到调试请求的时间相差不远,调试请求具有合理性。而若时间差不在预设时间范围内,则说明构建请求头的时间或者发送端发送调试请求的时间与侦测到调试请求的时间相差较远,调试请求可能具有风险性,而不对该具有风险性的调试请求进行继续处理。对于合理的调试请求,则继续读取与调试请求对应的目标日志等级、目标加密秘钥和第一加密数值,以通过目标日志等级和目标加密秘钥来生成第二加密数值,通过第一加密数值和第二加密数值之间的一致性来验证传输数据的安全性。If the time difference is within the preset time range, it means that the time when the request header is constructed or the time when the sender sends the debugging request is not far from the time when the debugging request is detected, and the debugging request is reasonable. If the time difference is not within the preset time range, it means that the time when the request header is constructed or the time when the sender sends the debugging request is far from the time when the debugging request is detected. The debugging request may be risky but not risky. Debugging request for continued processing. For a reasonable debugging request, continue to read the target log level, target encryption key, and first encryption value corresponding to the debugging request to generate the second encryption value through the target log level and target encryption key, and pass the first encryption The consistency between the value and the second encrypted value is used to verify the security of the transmitted data.
更进一步地,本实施例中的第一加密数值和第二加密数值与时间具有相关性。具体地,根据目标加密秘钥对目标日志等级进行加密,生成第二加密数值的步骤包括:Furthermore, the first encrypted value and the second encrypted value in this embodiment are related to time. Specifically, encrypting the target log level according to the target encryption key, and the step of generating the second encrypted value includes:
根据所述目标加密秘钥确定加密规则,调用所述加密规则并基于所述目标加密秘钥对所述目标日志等级和所述侦测时间点进行加密,生成第二加密数值。An encryption rule is determined according to the target encryption key, the encryption rule is invoked, and the target log level and the detection time point are encrypted based on the target encryption key to generate a second encrypted value.
本实施例中用加密规则表征加密算法,预先设置加密秘钥与加密规则之间的对应关系,开发人员所设置的目标加密秘钥必须存在于对应关系中,否则所设定的目标加密秘钥无效,以此进一步防止非开发人员的篡改,确保加密的安全性。在生成第二加密数值的过程中,调用加密秘钥与加密规则之间的对应关系,并根据读取的目标加密秘钥来确定对应关系中与之对应的加密规则,进而调用该对应的加密规则通过目标加密秘钥对目标日志等级和侦测时间点进行加密,生成第二加密数值。需要说明的是,本实施例的第二加密数值与时间具有相关性,以此相对应,第一加密数值也与时间具有相关性,调用发送端中与目标加密秘钥对应的加密规则,并通过目标加密秘钥对所设定的目标日志等级和构建请求头的时间点信息进行加密,生成第一加密数值。此时因生成第一加密数值和第二加密数值之间所对应的时间不完全相同,使得第一加密数值和第二加密数值也不完全相同;可设置一定的阈值,当第一加密数值和第二加密数值之间的差值在该阈值范围内,则判定两者匹配;若两者之间的差值超出阈值范围,则判定两者不匹配。In this embodiment, an encryption rule is used to characterize the encryption algorithm, and the corresponding relationship between the encryption key and the encryption rule is preset. The target encryption key set by the developer must exist in the corresponding relationship, otherwise the set target encryption key Invalid, in order to further prevent tampering by non-developers and ensure the security of encryption. In the process of generating the second encrypted value, the corresponding relationship between the encryption key and the encryption rule is called, and the corresponding encryption rule in the corresponding relationship is determined according to the read target encryption key, and then the corresponding encryption is called The rule encrypts the target log level and the detection time point with the target encryption key to generate a second encrypted value. It should be noted that the second encrypted value of this embodiment is related to time. Correspondingly, the first encrypted value is also related to time. The encryption rule corresponding to the target encryption key in the sender is called, and The set target log level and the time point information for constructing the request header are encrypted by the target encryption key to generate the first encrypted value. At this time, because the time corresponding to the generation of the first encrypted value and the second encrypted value is not exactly the same, the first encrypted value and the second encrypted value are not exactly the same; a certain threshold can be set, when the first encrypted value and the If the difference between the second encrypted values is within the threshold range, it is determined that the two match; if the difference between the two exceeds the threshold range, it is determined that the two do not match.
本实施例先通过时间来进行初次验证,再通过第一加密数值和第二加密数值来进行再次验证的方式,使得安全性更好。同时加入时间的因素来生成第一加密数值和第二加密数值,使得每次所生成的第一加密数值和第二加密数值具有动态的特性,也进一步确保了数据传输的安全性。In this embodiment, the initial verification is performed through time first, and then the re-verification is performed through the first encrypted value and the second encrypted value, so that the security is better. At the same time, the factor of time is added to generate the first encrypted value and the second encrypted value, so that the first encrypted value and the second encrypted value generated each time have dynamic characteristics, which further ensures the security of data transmission.
此外,请参照图2,本申请提供一种业务逻辑调试装置,在本申请业务逻辑调试装置第一实施例中,所述业务逻辑调试装置包括:In addition, please refer to FIG. 2. This application provides a business logic debugging device. In the first embodiment of the business logic debugging device of this application, the business logic debugging device includes:
读取模块10,用于当侦测到调试请求时,读取与所述调试请求对应的目标日志等级、目标加密秘钥和第一加密数值,所述调试请求中包括与所述目标日志等级、目标加密密钥和第一加密数值对应的请求头;The reading module 10 is used to read the target log level, the target encryption key and the first encrypted value corresponding to the debugging request when a debugging request is detected, and the debugging request includes information related to the target log level , The target encryption key and the request header corresponding to the first encryption value;
生成模块20,用于根据所述目标加密秘钥对所述目标日志等级进行加密,生成第二加密数值;The generating module 20 is configured to encrypt the target log level according to the target encryption key to generate a second encrypted value;
调试模块30,用于当所述第一加密数值和所述第二加密数值匹配时,根据所述目标日志等级,采集基于与所述调试请求对应的业务逻辑生成的调试数据,以基于所述调试数据对所述业务逻辑进行调试。The debugging module 30 is configured to collect debugging data generated based on the business logic corresponding to the debugging request according to the target log level when the first encrypted value matches the second encrypted value, so as to be based on the The debugging data debugs the business logic.
当侦测到包括与目标日志等级请求、目标加密秘钥和第一加密数据对应请求头的调试请求时,通过读取模块10读取与调试请求对应的目标日志等级、目标加密秘钥和第一加密数值;并由生成模块20通过目标加密秘钥对目标日志等级进行加密,生成第二加密数值;若经判定第一加密数值和第二加密数值匹配,调试模块30则根据目标日志等级,采集基于与调试请求对应的业务逻辑生成的调试数据,以此实现基于调试数据对业务逻辑进行调试。本申请一方面通过第一加密数值和第二加密数值之间的一致性,来及时发现非开发人员对日志数据的恶意获取或攻击,避免日志数据的泄露,有利于线上服务的安全性;另一方面通过设定目标日志等级来采集调试数据,避免获取到不相关数据进行分析和影响到服务器数据处理的能力,提高了分析的准确性和分析效率。When a debugging request including a request header corresponding to the target log level request, the target encryption key, and the first encrypted data is detected, the reading module 10 reads the target log level, the target encryption key, and the first encrypted data corresponding to the debugging request. An encrypted value; and the generation module 20 encrypts the target log level with the target encryption key to generate a second encrypted value; if it is determined that the first encrypted value and the second encrypted value match, the debugging module 30 will, according to the target log level, Collect debugging data generated based on the business logic corresponding to the debugging request, so as to realize the debugging of the business logic based on the debugging data. On the one hand, this application uses the consistency between the first encrypted value and the second encrypted value to promptly detect malicious acquisition or attack of log data by non-developers, avoid the leakage of log data, and facilitate the security of online services; On the other hand, by setting the target log level to collect debugging data, it avoids obtaining irrelevant data for analysis and affecting the server's data processing ability, which improves the accuracy and efficiency of analysis.
进一步地,在本申请业务逻辑调试装置另一实施例中,所述调试模块还包括:Further, in another embodiment of the business logic debugging device of the present application, the debugging module further includes:
采集单元,用于根据所述目标日志等级,调整与所述调试请求对应的业务逻辑生成的日志数据的默认等级,并从所述业务逻辑所生成的日志数据中,采集与调整后默认等级对应的目标日志数据;The collection unit is configured to adjust the default level of log data generated by the business logic corresponding to the debugging request according to the target log level, and collect the log data generated by the business logic corresponding to the adjusted default level Target log data;
读取单元,用于读取所述业务逻辑生成的响应数据,并将所述目标日志数据和所述响应数据设为调试数据;A reading unit, configured to read the response data generated by the business logic, and set the target log data and the response data as debugging data;
发送单元,用于将所述调试数据发送到与所述调试请求对应的发送端,以基于所述调试数据对所述业务逻辑进行调试。The sending unit is configured to send the debugging data to the sending end corresponding to the debugging request, so as to debug the service logic based on the debugging data.
进一步地,在本申请业务逻辑调试装置另一实施例中,所述发送单元还用于:Further, in another embodiment of the service logic debugging apparatus of the present application, the sending unit is further configured to:
检测所述响应数据的数据大小,并将所述数据大小添加到所述业务逻辑的响应头中;Detecting the data size of the response data, and adding the data size to the response header of the business logic;
根据所述响应头对所述调试数据进行发送,以基于所述响应头中的数据大小,对所述调试数据中的目标日志数据和响应数据进行区分。The debugging data is sent according to the response header to distinguish target log data and response data in the debugging data based on the size of the data in the response header.
进一步地,在本申请业务逻辑调试装置另一实施例中,所述采集单元还用于:Further, in another embodiment of the business logic debugging device of the present application, the collection unit is further configured to:
将所述目标日志数据发送到与所述调试请求对应的缓存区进行缓存。The target log data is sent to a buffer area corresponding to the debugging request for buffering.
进一步地,在本申请业务逻辑调试装置另一实施例中,所述读取模块还包括:Further, in another embodiment of the business logic debugging apparatus of the present application, the reading module further includes:
记录单元,用于当侦测到调试请求时,记录侦测时间点,并读取所述调试请求的生成时间点;The recording unit is used to record the detection time point when a debugging request is detected, and read the generation time point of the debugging request;
判断单元,用于判断所述侦测时间点和所述生成时间点之间的时间差是否在预设时间范围内;A judging unit, configured to judge whether the time difference between the detection time point and the generation time point is within a preset time range;
执行单元,用于若所述时间差在预设时间范围内,则执行读取所述调试请求携带的目标日志等级、目标加密秘钥和第一加密数值的步骤。The execution unit is configured to execute the step of reading the target log level, the target encryption key, and the first encryption value carried in the debugging request if the time difference is within the preset time range.
进一步地,在本申请业务逻辑调试装置另一实施例中,所述生成模块还包括:Further, in another embodiment of the business logic debugging apparatus of the present application, the generating module further includes:
根据所述目标加密秘钥确定加密规则,调用所述加密规则并基于所述目标加密秘钥对所述目标日志等级和所述侦测时间点进行加密,生成第二加密数值。An encryption rule is determined according to the target encryption key, the encryption rule is invoked, and the target log level and the detection time point are encrypted based on the target encryption key to generate a second encrypted value.
进一步地,在本申请业务逻辑调试装置另一实施例中,所述业务逻辑调试装置还包括:Further, in another embodiment of the business logic debugging device of the present application, the business logic debugging device further includes:
接收模块,用于接收所述调试请求对应发送端发送的通信连接请求,并对所述发送端进行身份验证;The receiving module is configured to receive the communication connection request sent by the sending end corresponding to the debugging request, and to perform identity verification on the sending end;
建立模块,用于当所述身份验证成功后,建立与所述发送端之间的通信连接,以供所述发送端构建请求头,并基于请求头发送所述调试请求,其中所述请求头基于所述目标日志等级、所述目标加密秘钥以及所述请求头构建的时间点信息生成。The establishment module is configured to establish a communication connection with the sending end after the identity verification is successful, so that the sending end can construct a request header and send the debugging request based on the request header, wherein the request header Generated based on the target log level, the target encryption key, and the time point information constructed by the request header.
其中,上述业务逻辑调试装置的各虚拟功能模块存储于图3所示业务逻辑调试设备的存储器1005中,处理器1001执行业务逻辑调试程序时,实现图2所示实施例中各个模块的功能。Wherein, each virtual function module of the above-mentioned service logic debugging device is stored in the memory 1005 of the service logic debugging device shown in FIG. 3. When the processor 1001 executes the service logic debugging program, the function of each module in the embodiment shown in FIG. 2 is realized.
参照图3,图3是本申请实施例方法涉及的硬件运行环境的设备结构示意图。Referring to FIG. 3, FIG. 3 is a schematic diagram of the device structure of the hardware operating environment involved in the method of the embodiment of the present application.
本申请实施例业务逻辑调试设备可以是PC( personal computer,个人计算机 ),也可以是智能手机、平板电脑、电子书阅读器、便携计算机等终端设备。The business logic debugging device of the embodiment of the present application may be a PC (personal computer, personal computer), or a terminal device such as a smart phone, a tablet computer, an e-book reader, and a portable computer.
如图3所示,该业务逻辑调试设备可以包括:处理器1001,例如CPU(Central Processing Unit,中央处理器),存储器1005,通信总线1002。其中,通信总线1002用于实现处理器1001和存储器1005之间的连接通信。存储器1005可以是高速RAM(random access memory,随机存取存储器),也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。As shown in FIG. 3, the service logic debugging device may include: a processor 1001, such as a CPU (Central Processing Unit, central processing unit), a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to implement connection and communication between the processor 1001 and the memory 1005. The memory 1005 may be a high-speed RAM (random Access memory, random access memory), can also be a stable memory (non-volatile memory), such as disk memory. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
可选地,该业务逻辑调试设备还可以包括用户接口、网络接口、摄像头、RF(Radio Frequency,射频)电路,传感器、音频电路、WiFi(Wireless Fidelity,无线宽带)模块等等。用户接口可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口还可以包括标准的有线接口、无线接口。网络接口可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。Optionally, the service logic debugging equipment may also include user interfaces, network interfaces, cameras, RF (Radio Frequency, radio frequency) circuits, sensors, audio circuits, WiFi (Wireless Fidelity, wireless broadband) module and so on. The user interface may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the optional user interface may also include a standard wired interface and a wireless interface. The optional network interface can include standard wired interface and wireless interface (such as WI-FI interface).
本领域技术人员可以理解,图3中示出的业务逻辑调试设备结构并不构成对业务逻辑调试设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。Those skilled in the art can understand that the structure of the business logic debugging device shown in FIG. 3 does not constitute a limitation on the business logic debugging device, and may include more or fewer components than shown in the figure, or a combination of certain components, or different components. The layout of the components.
如图3所示,作为一种计算机可读存储介质的存储器1005中可以包括操作系统、网络通信模块以及业务逻辑调试程序。操作系统是管理和控制业务逻辑调试设备硬件和软件资源的程序,支持业务逻辑调试程序以及其它软件和/或程序的运行。网络通信模块用于实现存储器1005内部各组件之间的通信,以及与业务逻辑调试设备中其它硬件和软件之间通信。As shown in FIG. 3, the memory 1005, which is a computer-readable storage medium, may include an operating system, a network communication module, and a business logic debugging program. The operating system is a program that manages and controls the hardware and software resources of the business logic debugging equipment, and supports the operation of the business logic debugging program and other software and/or programs. The network communication module is used to implement communication between various components in the memory 1005, and to communicate with other hardware and software in the business logic debugging device.
在图3所示的业务逻辑调试设备中,处理器1001用于执行存储器1005中存储的业务逻辑调试程序,实现上述业务逻辑调试方法各实施例中的步骤。In the business logic debugging device shown in FIG. 3, the processor 1001 is used to execute the business logic debugging program stored in the memory 1005 to implement the steps in each embodiment of the foregoing business logic debugging method.
本申请提供了一种计算机可读存储介质,所述计算机可读存储介质可以是非易失性,也可以是易失性,所述计算机可读存储介质存储有一个或者一个以上程序,所述一个或者一个以上程序还可被一个或者一个以上的处理器执行以用于实现上述业务逻辑调试方法各实施例中的步骤。This application provides a computer-readable storage medium. The computer-readable storage medium may be non-volatile or volatile. The computer-readable storage medium stores one or more programs. Alternatively, one or more programs may also be executed by one or more processors to implement the steps in each embodiment of the foregoing service logic debugging method.
还需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should also be noted that in this article, the terms "including", "including" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements , And also include other elements not explicitly listed, or elements inherent to the process, method, article, or device. If there are no more restrictions, the element defined by the sentence "including a..." does not exclude the existence of other identical elements in the process, method, article, or device that includes the element.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the foregoing embodiments of the present application are for description only, and do not represent the superiority or inferiority of the embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个计算机可读存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above implementation manners, those skilled in the art can clearly understand that the above-mentioned embodiment method can be implemented by means of software plus the necessary general hardware platform, of course, it can also be implemented by hardware, but in many cases the former is better.的实施方式。 Based on this understanding, the technical solution of this application essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product is stored in a computer-readable storage medium as described above (such as The ROM/RAM, magnetic disk, optical disk) includes several instructions to enable a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to execute the method described in each embodiment of the present application.
以上所述仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是在本申请的构思下,利用本申请说明书及附图内容所作的等效结构变换,或直接/间接运用在其他相关的技术领域均包括在本申请的专利保护范围内。The above are only the preferred embodiments of this application, and do not limit the scope of this application. Under the concept of this application, equivalent structural transformations made using the content of the specification and drawings of this application, or directly/indirectly used in Other related technical fields are included in the scope of patent protection of this application.

Claims (20)

  1. 一种业务逻辑调试方法,所述业务逻辑调试方法包括以下步骤:A business logic debugging method, the business logic debugging method includes the following steps:
    当侦测到调试请求时,读取与所述调试请求对应的目标日志等级、目标加密秘钥和第一加密数值,所述调试请求中包括与所述目标日志等级、目标加密密钥和第一加密数值对应的请求头;When a debugging request is detected, the target log level, target encryption key, and first encryption value corresponding to the debugging request are read. The debugging request includes the target log level, target encryption key, and first encryption value. A request header corresponding to the encrypted value;
    根据所述目标加密秘钥对所述目标日志等级进行加密,生成第二加密数值;Encrypting the target log level according to the target encryption key to generate a second encrypted value;
    当所述第一加密数值和所述第二加密数值匹配时,根据所述目标日志等级,采集基于与所述调试请求对应的业务逻辑生成的调试数据,以基于所述调试数据对所述业务逻辑进行调试。When the first encrypted value matches the second encrypted value, the debugging data generated based on the business logic corresponding to the debugging request is collected according to the target log level, so as to compare the business based on the debugging data. Logic for debugging.
  2. 如权利要求1所述的业务逻辑调试方法,其中,所述根据所述目标日志等级,采集基于与所述调试请求对应的业务逻辑生成的调试数据,以基于所述调试数据对所述业务逻辑进行调试的步骤包括:The business logic debugging method of claim 1, wherein the debugging data generated based on the business logic corresponding to the debugging request is collected according to the target log level, so as to compare the business logic based on the debugging data. The steps for debugging include:
    根据所述目标日志等级,调整与所述调试请求对应的业务逻辑生成的日志数据的默认等级,并从所述业务逻辑所生成的日志数据中,采集与调整后默认等级对应的目标日志数据;According to the target log level, adjust the default level of log data generated by the business logic corresponding to the debugging request, and collect target log data corresponding to the adjusted default level from the log data generated by the business logic;
    读取所述业务逻辑生成的响应数据,并将所述目标日志数据和所述响应数据设为调试数据;Reading the response data generated by the business logic, and setting the target log data and the response data as debugging data;
    将所述调试数据发送到与所述调试请求对应的发送端,以基于所述调试数据对所述业务逻辑进行调试。The debugging data is sent to the sending end corresponding to the debugging request, so as to debug the business logic based on the debugging data.
  3. 如权利要求2所述的业务逻辑调试方法,其中,所述将所述调试数据发送到与所述调试请求对应的发送端的步骤包括:3. The service logic debugging method according to claim 2, wherein the step of sending the debugging data to the sending end corresponding to the debugging request comprises:
    检测所述响应数据的数据大小,并将所述数据大小添加到所述业务逻辑的响应头中;Detecting the data size of the response data, and adding the data size to the response header of the business logic;
    根据所述响应头对所述调试数据进行发送,以基于所述响应头中的数据大小,对所述调试数据中的目标日志数据和响应数据进行区分。The debugging data is sent according to the response header to distinguish target log data and response data in the debugging data based on the size of the data in the response header.
  4. 如权利要求2所述的业务逻辑调试方法,其中,所述采集与调整后默认等级对应的目标日志数据的步骤之后包括:3. The business logic debugging method according to claim 2, wherein after the step of collecting target log data corresponding to the adjusted default level comprises:
    将所述目标日志数据发送到与所述调试请求对应的缓存区进行缓存。The target log data is sent to a buffer area corresponding to the debugging request for buffering.
  5. 如权利要求1所述的业务逻辑调试方法,其中,所述当侦测到调试请求时,读取与所述调试请求对应的目标日志等级、目标加密秘钥和第一加密数值的步骤包括:5. The business logic debugging method of claim 1, wherein when a debugging request is detected, the step of reading the target log level, the target encryption key, and the first encryption value corresponding to the debugging request comprises:
    当侦测到调试请求时,记录侦测时间点,并读取所述调试请求的生成时间点;When a debugging request is detected, record the detection time point, and read the generation time point of the debugging request;
    判断所述侦测时间点和所述生成时间点之间的时间差是否在预设时间范围内;Determine whether the time difference between the detection time point and the generation time point is within a preset time range;
    若所述时间差在预设时间范围内,则执行读取与所述调试请求对应的目标日志等级、目标加密秘钥和第一加密数值的步骤。If the time difference is within the preset time range, the step of reading the target log level, the target encryption key, and the first encryption value corresponding to the debugging request is performed.
  6. 如权利要求5所述的业务逻辑调试方法,其中,所述根据所述目标加密秘钥对所述目标日志等级进行加密,生成第二加密数值的步骤包括:5. The business logic debugging method of claim 5, wherein the step of encrypting the target log level according to the target encryption key, and generating a second encrypted value comprises:
    根据所述目标加密秘钥确定加密规则,调用所述加密规则并基于所述目标加密秘钥对所述目标日志等级和所述侦测时间点进行加密,生成第二加密数值。An encryption rule is determined according to the target encryption key, the encryption rule is invoked, and the target log level and the detection time point are encrypted based on the target encryption key to generate a second encrypted value.
  7. 如权利要求1-6任一项所述的业务逻辑调试方法,其中,所述当侦测到调试请求时,读取与所述调试请求对应的目标日志等级、目标加密秘钥和第一加密数值的步骤之前包括:The business logic debugging method according to any one of claims 1 to 6, wherein when the debugging request is detected, the target log level, the target encryption key and the first encryption corresponding to the debugging request are read Before the numerical steps include:
    接收所述调试请求对应发送端发送的通信连接请求,并对所述发送端进行身份验证;Receiving the communication connection request sent by the sending end corresponding to the debugging request, and performing identity verification on the sending end;
    当所述身份验证成功后,建立与所述发送端之间的通信连接,以供所述发送端构建请求头,并基于请求头发送所述调试请求,其中所述请求头基于所述目标日志等级、所述目标加密秘钥以及所述请求头构建的时间点信息生成。After the identity verification is successful, a communication connection with the sender is established for the sender to construct a request header and send the debugging request based on the request header, wherein the request header is based on the target log The level, the target encryption key, and the time point information of the request header construction are generated.
  8. 一种业务逻辑调试装置,所述业务逻辑调试装置包括:A business logic debugging device, the business logic debugging device includes:
    读取模块,用于当侦测到调试请求时,读取与所述调试请求对应的目标日志等级、目标加密秘钥和第一加密数值,所述调试请求中包括与所述目标日志等级、目标加密密钥和第一加密数值对应的请求头;The reading module is used to read the target log level, target encryption key, and first encrypted value corresponding to the debugging request when a debugging request is detected, and the debugging request includes the target log level, The request header corresponding to the target encryption key and the first encryption value;
    生成模块,用于根据所述目标加密秘钥对所述目标日志等级进行加密,生成第二加密数值;A generating module, configured to encrypt the target log level according to the target encryption key to generate a second encrypted value;
    调试模块,用于当所述第一加密数值和所述第二加密数值匹配时,根据所述日志等级,采集基于与所述调试请求对应的业务逻辑生成的调试数据,以基于所述调试数据对所述业务逻辑进行调试。The debugging module is configured to collect debugging data generated based on the business logic corresponding to the debugging request according to the log level when the first encrypted value matches the second encrypted value, so as to be based on the debugging data Debug the business logic.
  9. 一种业务逻辑调试设备,其中,所述业务逻辑调试设备包括:存储器、处理器、通信总线以及存储在所述存储器上的业务逻辑调试程序;A business logic debugging device, wherein the business logic debugging device includes: a memory, a processor, a communication bus, and a business logic debugging program stored on the memory;
    所述通信总线用于实现处理器和存储器之间的连接通信;The communication bus is used to realize the connection and communication between the processor and the memory;
    所述处理器用于执行所述业务逻辑调试程序,以实现业务逻辑调试方法的步骤:The processor is used to execute the business logic debugging program to implement the steps of the business logic debugging method:
    当侦测到调试请求时,读取与所述调试请求对应的目标日志等级、目标加密秘钥和第一加密数值,所述调试请求中包括与所述目标日志等级、目标加密密钥和第一加密数值对应的请求头;When a debugging request is detected, the target log level, target encryption key, and first encryption value corresponding to the debugging request are read. The debugging request includes the target log level, target encryption key, and first encryption value. A request header corresponding to the encrypted value;
    根据所述目标加密秘钥对所述目标日志等级进行加密,生成第二加密数值;Encrypting the target log level according to the target encryption key to generate a second encrypted value;
    当所述第一加密数值和所述第二加密数值匹配时,根据所述目标日志等级,采集基于与所述调试请求对应的业务逻辑生成的调试数据,以基于所述调试数据对所述业务逻辑进行调试。When the first encrypted value matches the second encrypted value, the debugging data generated based on the business logic corresponding to the debugging request is collected according to the target log level, so as to compare the business based on the debugging data. Logic for debugging.
  10. 如权利要求9所述的业务逻辑调试设备,其中,所述处理器执行的所述根据所述目标日志等级,采集基于与所述调试请求对应的业务逻辑生成的调试数据,以基于所述调试数据对所述业务逻辑进行调试的步骤包括:The business logic debugging device according to claim 9, wherein the processor executed by the processor collects debugging data generated based on the business logic corresponding to the debugging request according to the target log level, so as to be based on the debugging The steps of data debugging the business logic include:
    根据所述目标日志等级,调整与所述调试请求对应的业务逻辑生成的日志数据的默认等级,并从所述业务逻辑所生成的日志数据中,采集与调整后默认等级对应的目标日志数据;According to the target log level, adjust the default level of log data generated by the business logic corresponding to the debugging request, and collect target log data corresponding to the adjusted default level from the log data generated by the business logic;
    读取所述业务逻辑生成的响应数据,并将所述目标日志数据和所述响应数据设为调试数据;Reading the response data generated by the business logic, and setting the target log data and the response data as debugging data;
    将所述调试数据发送到与所述调试请求对应的发送端,以基于所述调试数据对所述业务逻辑进行调试。The debugging data is sent to the sending end corresponding to the debugging request, so as to debug the business logic based on the debugging data.
  11. 如权利要求10所述的业务逻辑调试设备,其中,所述处理器执行的所述将所述调试数据发送到与所述调试请求对应的发送端的步骤包括:The service logic debugging device according to claim 10, wherein the step of sending the debugging data to the sending end corresponding to the debugging request performed by the processor comprises:
    检测所述响应数据的数据大小,并将所述数据大小添加到所述业务逻辑的响应头中;Detecting the data size of the response data, and adding the data size to the response header of the business logic;
    根据所述响应头对所述调试数据进行发送,以基于所述响应头中的数据大小,对所述调试数据中的目标日志数据和响应数据进行区分。The debugging data is sent according to the response header to distinguish target log data and response data in the debugging data based on the size of the data in the response header.
  12. 如权利要求10所述的业务逻辑调试设备,其中,所述采集与调整后默认等级对应的目标日志数据的步骤之后包括:The business logic debugging device according to claim 10, wherein the step of collecting target log data corresponding to the adjusted default level afterwards comprises:
    将所述目标日志数据发送到与所述调试请求对应的缓存区进行缓存。The target log data is sent to a buffer area corresponding to the debugging request for buffering.
  13. 如权利要求9所述的业务逻辑调试设备,其中,所述处理器执行的所述当侦测到调试请求时,读取与所述调试请求对应的目标日志等级、目标加密秘钥和第一加密数值的步骤包括:The business logic debugging device according to claim 9, wherein when a debugging request is detected by the processor, it reads the target log level, the target encryption key, and the first log level corresponding to the debugging request. The steps to encrypt the value include:
    当侦测到调试请求时,记录侦测时间点,并读取所述调试请求的生成时间点;When a debugging request is detected, record the detection time point, and read the generation time point of the debugging request;
    判断所述侦测时间点和所述生成时间点之间的时间差是否在预设时间范围内;Determine whether the time difference between the detection time point and the generation time point is within a preset time range;
    若所述时间差在预设时间范围内,则执行读取与所述调试请求对应的目标日志等级、目标加密秘钥和第一加密数值的步骤。If the time difference is within the preset time range, the step of reading the target log level, the target encryption key, and the first encryption value corresponding to the debugging request is performed.
  14. 如权利要求13所述的业务逻辑调试设备,其中,所述处理器执行的所述根据所述目标加密秘钥对所述目标日志等级进行加密,生成第二加密数值的步骤包括:The business logic debugging device according to claim 13, wherein the step of encrypting the target log level according to the target encryption key performed by the processor, and generating a second encrypted value comprises:
    根据所述目标加密秘钥确定加密规则,调用所述加密规则并基于所述目标加密秘钥对所述目标日志等级和所述侦测时间点进行加密,生成第二加密数值。An encryption rule is determined according to the target encryption key, the encryption rule is invoked, and the target log level and the detection time point are encrypted based on the target encryption key to generate a second encrypted value.
  15. 一种计算机可读存储介质,其中,所述计算机可读存储介质上存储有业务逻辑调试程序,所述业务逻辑调试程序被处理器执行时实现业务逻辑调试方法的步骤:A computer-readable storage medium, wherein a business logic debugging program is stored on the computer-readable storage medium, and the steps of the business logic debugging method are implemented when the business logic debugging program is executed by a processor:
    当侦测到调试请求时,读取与所述调试请求对应的目标日志等级、目标加密秘钥和第一加密数值,所述调试请求中包括与所述目标日志等级、目标加密密钥和第一加密数值对应的请求头;When a debugging request is detected, the target log level, target encryption key, and first encryption value corresponding to the debugging request are read. The debugging request includes the target log level, target encryption key, and first encryption value. A request header corresponding to the encrypted value;
    根据所述目标加密秘钥对所述目标日志等级进行加密,生成第二加密数值;Encrypting the target log level according to the target encryption key to generate a second encrypted value;
    当所述第一加密数值和所述第二加密数值匹配时,根据所述目标日志等级,采集基于与所述调试请求对应的业务逻辑生成的调试数据,以基于所述调试数据对所述业务逻辑进行调试。When the first encrypted value matches the second encrypted value, the debugging data generated based on the business logic corresponding to the debugging request is collected according to the target log level, so as to compare the business based on the debugging data. Logic for debugging.
  16. 如权利要求15所述的计算机可读存储介质,其中,所述业务逻辑调试程序被处理器执行时实现的所述根据所述目标日志等级,采集基于与所述调试请求对应的业务逻辑生成的调试数据,以基于所述调试数据对所述业务逻辑进行调试的步骤包括:The computer-readable storage medium according to claim 15, wherein the business logic debugging program is implemented when the business logic debugging program is executed by the processor according to the target log level, and the business logic generated based on the business logic corresponding to the debugging request is collected The steps of debugging data to debug the business logic based on the debugging data include:
    根据所述目标日志等级,调整与所述调试请求对应的业务逻辑生成的日志数据的默认等级,并从所述业务逻辑所生成的日志数据中,采集与调整后默认等级对应的目标日志数据;According to the target log level, adjust the default level of log data generated by the business logic corresponding to the debugging request, and collect target log data corresponding to the adjusted default level from the log data generated by the business logic;
    读取所述业务逻辑生成的响应数据,并将所述目标日志数据和所述响应数据设为调试数据;Reading the response data generated by the business logic, and setting the target log data and the response data as debugging data;
    将所述调试数据发送到与所述调试请求对应的发送端,以基于所述调试数据对所述业务逻辑进行调试。The debugging data is sent to the sending end corresponding to the debugging request, so as to debug the business logic based on the debugging data.
  17. 如权利要求16所述的计算机可读存储介质,其中,所述业务逻辑调试程序被处理器执行时实现的所述将所述调试数据发送到与所述调试请求对应的发送端的步骤包括:16. The computer-readable storage medium according to claim 16, wherein the step of sending the debugging data to the sending end corresponding to the debugging request implemented when the business logic debugging program is executed by the processor comprises:
    检测所述响应数据的数据大小,并将所述数据大小添加到所述业务逻辑的响应头中;Detecting the data size of the response data, and adding the data size to the response header of the business logic;
    根据所述响应头对所述调试数据进行发送,以基于所述响应头中的数据大小,对所述调试数据中的目标日志数据和响应数据进行区分。The debugging data is sent according to the response header to distinguish target log data and response data in the debugging data based on the size of the data in the response header.
  18. 如权利要求16所述的计算机可读存储介质,其中,所述业务逻辑调试程序被处理器执行时实现的所述采集与调整后默认等级对应的目标日志数据的步骤之后包括:15. The computer-readable storage medium of claim 16, wherein the step of collecting target log data corresponding to the adjusted default level implemented when the business logic debugging program is executed by the processor comprises:
    将所述目标日志数据发送到与所述调试请求对应的缓存区进行缓存。The target log data is sent to a buffer area corresponding to the debugging request for buffering.
  19. 如权利要求15所述的计算机可读存储介质,其中,所述业务逻辑调试程序被处理器执行时实现的所述当侦测到调试请求时,读取与所述调试请求对应的目标日志等级、目标加密秘钥和第一加密数值的步骤包括:The computer-readable storage medium according to claim 15, wherein when the debugging request is detected, the target log level corresponding to the debugging request is read when the debugging request is detected when the business logic debugging program is executed by the processor. , The steps of the target encryption key and the first encryption value include:
    当侦测到调试请求时,记录侦测时间点,并读取所述调试请求的生成时间点;When a debugging request is detected, record the detection time point, and read the generation time point of the debugging request;
    判断所述侦测时间点和所述生成时间点之间的时间差是否在预设时间范围内;Determine whether the time difference between the detection time point and the generation time point is within a preset time range;
    若所述时间差在预设时间范围内,则执行读取与所述调试请求对应的目标日志等级、目标加密秘钥和第一加密数值的步骤。If the time difference is within the preset time range, the step of reading the target log level, the target encryption key, and the first encryption value corresponding to the debugging request is performed.
  20. 如权利要求19所述的计算机可读存储介质,其中,所述业务逻辑调试程序被处理器执行时实现的所述根据所述目标加密秘钥对所述目标日志等级进行加密,生成第二加密数值的步骤包括:The computer-readable storage medium according to claim 19, wherein the execution of the business logic debugging program is implemented by the processor to encrypt the target log level according to the target encryption key to generate a second encryption The numerical steps include:
    根据所述目标加密秘钥确定加密规则,调用所述加密规则并基于所述目标加密秘钥对所述目标日志等级和所述侦测时间点进行加密,生成第二加密数值。An encryption rule is determined according to the target encryption key, the encryption rule is invoked, and the target log level and the detection time point are encrypted based on the target encryption key to generate a second encrypted value.
PCT/CN2020/118490 2020-03-12 2020-09-28 Business logic debugging method and apparatus, device, and computer-readable storage medium WO2021179578A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010174165.6A CN111506497B (en) 2020-03-12 2020-03-12 Business logic debugging method, device, equipment and computer readable storage medium
CN202010174165.6 2020-03-12

Publications (1)

Publication Number Publication Date
WO2021179578A1 true WO2021179578A1 (en) 2021-09-16

Family

ID=71875772

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/118490 WO2021179578A1 (en) 2020-03-12 2020-09-28 Business logic debugging method and apparatus, device, and computer-readable storage medium

Country Status (2)

Country Link
CN (1) CN111506497B (en)
WO (1) WO2021179578A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116149958A (en) * 2023-04-20 2023-05-23 华谱科仪(北京)科技有限公司 Chromatograph operation and maintenance method and device based on log management function

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111506497B (en) * 2020-03-12 2023-06-16 平安科技(深圳)有限公司 Business logic debugging method, device, equipment and computer readable storage medium
CN112084537B (en) * 2020-09-02 2023-09-08 英博超算(南京)科技有限公司 JTAG debugging system
CN112783724B (en) * 2021-01-26 2023-06-27 上海商米科技集团股份有限公司 Log grabbing and debugging method, system, intelligent device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190018763A1 (en) * 2017-07-14 2019-01-17 International Business Machines Corporation Test methodology for detection of unwanted cryptographic key destruction
CN110046514A (en) * 2019-04-12 2019-07-23 深圳Tcl新技术有限公司 Tune-up data guard method, device, server and storage medium
CN110163008A (en) * 2019-04-30 2019-08-23 阿里巴巴集团控股有限公司 A kind of method and system of the security audit of the Encryption Model of deployment
CN111506497A (en) * 2020-03-12 2020-08-07 平安科技(深圳)有限公司 Service logic debugging method, device, equipment and computer readable storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105933163B (en) * 2016-06-24 2019-08-27 微梦创科网络科技(中国)有限公司 The real-time distributed debugging tracking of one kind and system
CN106250287A (en) * 2016-07-21 2016-12-21 柳州龙辉科技有限公司 A kind of log information processing means
CN108734033B (en) * 2017-04-14 2020-12-22 北京京东尚科信息技术有限公司 Method and device for realizing safety interaction between systems
CN107861852A (en) * 2017-06-26 2018-03-30 平安普惠企业管理有限公司 Webpage error handling method, system and readable storage medium storing program for executing
CN107181633A (en) * 2017-07-27 2017-09-19 郑州云海信息技术有限公司 A kind of method and system of long-range acquisition business diary
CN109902071B (en) * 2019-01-31 2020-06-30 阿里巴巴集团控股有限公司 Service log storage method, system, device and equipment
CN110046073B (en) * 2019-03-29 2022-10-18 厦门网宿有限公司 Log collection method and device, equipment and storage medium
CN110704262A (en) * 2019-09-17 2020-01-17 广州市玄武无线科技股份有限公司 Dynamic service logic debugging method, system, storage medium and intelligent device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190018763A1 (en) * 2017-07-14 2019-01-17 International Business Machines Corporation Test methodology for detection of unwanted cryptographic key destruction
CN110046514A (en) * 2019-04-12 2019-07-23 深圳Tcl新技术有限公司 Tune-up data guard method, device, server and storage medium
CN110163008A (en) * 2019-04-30 2019-08-23 阿里巴巴集团控股有限公司 A kind of method and system of the security audit of the Encryption Model of deployment
CN111506497A (en) * 2020-03-12 2020-08-07 平安科技(深圳)有限公司 Service logic debugging method, device, equipment and computer readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116149958A (en) * 2023-04-20 2023-05-23 华谱科仪(北京)科技有限公司 Chromatograph operation and maintenance method and device based on log management function
CN116149958B (en) * 2023-04-20 2023-06-27 华谱科仪(北京)科技有限公司 Chromatograph operation and maintenance method and device based on log management function

Also Published As

Publication number Publication date
CN111506497B (en) 2023-06-16
CN111506497A (en) 2020-08-07

Similar Documents

Publication Publication Date Title
WO2021179578A1 (en) Business logic debugging method and apparatus, device, and computer-readable storage medium
US11206451B2 (en) Information interception processing method, terminal, and computer storage medium
US10270758B2 (en) Login method, server, and login system
CN112019332B (en) Encryption and decryption method based on micro-service, API gateway system and equipment
US20230056432A1 (en) Service communication method, system, apparatus, electronic device, and storage medium
US20180324170A1 (en) Method and apparatus for allocating device identifiers
CN108664395B (en) Application program testing method, device, equipment and storage medium
CN106294102B (en) Application program testing method, client, server and system
US9628461B2 (en) Method and device for identity authentication
CN106412024B (en) A kind of page acquisition methods and device
WO2016062002A1 (en) Connection management method and apparatus, electrical device
CN108347361B (en) Application program testing method and device, computer equipment and storage medium
CN108628743B (en) Application program testing method, device, equipment and storage medium
WO2021135918A1 (en) Request authentication method, apparatus and device, and storage medium
US9660833B2 (en) Application identification in records of network flows
US20120253745A1 (en) System and method for testing performance of mobile application server
JP5920169B2 (en) Unauthorized connection detection method, network monitoring apparatus and program
CN111444500A (en) Authentication method, device, equipment and readable storage medium
US11770385B2 (en) Systems and methods for malicious client detection through property analysis
CN109683997B (en) Method for accessing application program interface through sandbox, sandbox and sandbox equipment
CN111711533B (en) Fault diagnosis method, fault diagnosis device, electronic device and storage medium
CN113225351B (en) Request processing method and device, storage medium and electronic equipment
CN112565226A (en) Request processing method, device, equipment and system and user portrait generation method
WO2022062980A1 (en) Communication method and apparatus, and electronic device and storage medium
CN108289096B (en) Method and device for paying attention to live broadcast room and verifying attention to live broadcast room

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20924965

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20924965

Country of ref document: EP

Kind code of ref document: A1