Method for adding label to log, and business log processing method and system
By traversing project files in smart home devices, judging and adding log tags, the accuracy of log statistics and mislocalization is solved, and simpler and more convenient log query and statistics are achieved, reducing development complexity and storage space occupation.
Patent Information
- Application Number
- CN202311790355.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-22
- Publication Date
- 2025-07-01
AI Technical Summary
The prior art cannot accurately locate data information when log statistics and mislocalize in smart home devices, resulting in developers increasing unnecessary energy and time and putting pressure on search engines.
Provide a method to simplify the process of adding labels to the log label by traversing the project file.
It realizes simpler and more convenient query, positioning and statistics in business logs, reduces the complexity of program development and storage space usage, and improves the accuracy and efficiency of query and statistics.
Smart Images

Figure CN120233986A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure generally relates to the field of smart home technologies, and in particular, to a method for adding tags to log files, a method for processing service logs, and a system for processing service logs. Background Art
[0002] With the popularization and spread of smart home devices, the number of users of cloud services has increased, and the amount of cloud logs has also increased accordingly. For different services, there may be a situation where the service logics are the same but the processing is different, resulting in duplicate key information in the logs. When performing log statistics and error message location, it is impossible to accurately locate the actual required data information. If we want to avoid this from the code level, the existing solution is to add tags to the logs during the program development stage before the version is sealed. This solution will increase unnecessary energy and time for developers, and also put great pressure on the log search engine.
[0003] Therefore, there is an urgent need for a simpler and more convenient solution for adding tags to logs, so as to distinguish different services and accurately query, locate, and count in service logs.
[0004] The content in the background art section is only the technology known to the inventor and does not necessarily represent the prior art in this field. Summary of the Invention
[0005] In view of one or more of the problems existing in the prior art, the present disclosure provides a method for adding tags to log files, which is simpler and more convenient than the prior art, so as to accurately query, locate, and count in service logs. The method includes:
[0006] S1: Traverse project files and select target type files;
[0007] S2: Determine whether each line of code in the target type files has a log print identifier, and obtain a first determination result; and
[0008] S3: Based on the first determination result, add tags to each line of code with a log print identifier.
[0009] According to one aspect of the present disclosure, the step S3 includes the following sub-steps:
[0010] S31: Determine whether each line of code with a log print identifier has already been tagged;
[0011] S32: Determine the type of the already added tag, and obtain a second determination result; and
[0012] S33: Based on the second judgment result, add labels to each line of code with a log printing identifier.
[0013] According to one aspect of the present disclosure, the type of the label includes a protection label or a non - protection label; the sub - step S33 includes: when it is judged that the type of the label already added is a non - protection label, add a label to the corresponding line of code.
[0014] According to one aspect of the present disclosure, the labels of each line of code with a log printing identifier are different from each other.
[0015] According to one aspect of the present disclosure, the label includes 6 - digit random characters, and the value range of each random character is 0 - 9, a - z or A - Z.
[0016] According to one aspect of the present disclosure, step S3 includes: using one or more of the languages Python, Java, Php, and Shell to add labels to each line of code with a log printing identifier.
[0017] According to one aspect of the present disclosure, the target type of file includes one or more of java, Php, and Shell.
[0018] According to one aspect of the present disclosure, the log includes one or more levels of fatal error, error, warning, information, debug, and trace.
[0019] The present disclosure also provides a method for processing business logs, including:
[0020] Determine the labels in the business log; and
[0021] Perform one or more operations of positioning, querying, and data statistics in the business log through the labels;
[0022] Wherein, the business log includes the log as described above; the label includes the label as described above.
[0023] The present disclosure also relates to a system for processing business logs, including:
[0024] A terminal; and
[0025] A server, communicating with the terminal;
[0026] Wherein, the terminal is configured to send a request instruction to the server;
[0027] The server is configured to respond to the request instruction and, based on the request instruction, execute the processing method as described above.
[0028] The present disclosure also relates to a computer-readable storage medium, including computer-executable instructions stored thereon, where the executable instructions, when executed by a processor, implement the method described above; and / or implement the processing method described above.
[0029] In summary, the method for adding tags to log files, the processing method for business logs, and the processing system for business logs of the present disclosure have been introduced in detail. Compared with the existing solution for adding tags to log files during the program development stage before version freezing, the method for adding tags to log files in the present disclosure allows normal use of log printing during the program development stage before version freezing without considering adding tags to log files. After version freezing, the above method is executed to add tags to log files, which is more simple and convenient, conducive to reducing the complexity of program development and the storage space occupied by the program, so as to accurately perform operations such as querying, positioning, and statistics in business logs.
[0030] The processing method and system for business logs of the present disclosure, based on tags, can quickly and accurately perform one or more operations of positioning, querying, and data statistics in business logs. Even in the case of numerous and complex business logs, different businesses can be distinguished through tags, and one or more operations of positioning, querying, and data statistics can be performed for different businesses and different levels of logs, which is conducive to reducing the difficulty of business log processing, reducing the pressure on the business log search engine, improving the efficiency of business log processing, improving the accuracy of log processing results, and improving the convenience of business log processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. They are used together with the embodiments of the present disclosure to explain the present disclosure and do not constitute a limitation to the present disclosure. In the drawings:
[0032] Figure 1 A flowchart of a method for adding tags to log files according to some embodiments of the present disclosure is shown;
[0033] Figure 2 A flowchart of the sub-steps of step S3 according to some embodiments of the present disclosure is shown;
[0034] Figure 3 A flowchart of a method for adding tags to log files according to some other embodiments of the present disclosure is shown;
[0035] Figure 4 A flowchart of a method for processing business logs according to some embodiments of the present disclosure is shown;
[0036] Figure 5A schematic diagram of a processing system for business logs according to some embodiments of the present disclosure is shown; and
[0037] Figure 6 A schematic diagram of a processing system for business logs according to other embodiments of the present disclosure is shown.
[0038] Reference numerals:
[0039] 10, 20: Methods
[0040] 300: Processing method
[0041] 40, 50: Processing systems
[0042] S1, S2, S3, S310, S320: Steps
[0043] S31, S32, S33, Sub - steps
[0044] 41: Terminals
[0045] 42: Servers
[0046] 52: Cloud servers Detailed implementation manners
[0047] In the following, only some exemplary embodiments are briefly described. As those skilled in the art can recognize, the described embodiments can be modified in various different ways without departing from the spirit or scope of the present disclosure. Therefore, the drawings and the description are considered to be exemplary in nature and not restrictive.
[0048] In the description of the present disclosure, it should be understood that the orientation or positional relationships indicated by the terms "center", "longitudinal", "transverse", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", etc. are based on the orientation or positional relationships shown in the drawings, and are only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus should not be construed as a limitation of the present disclosure. In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly specifying the number of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of the described features. In the description of the present disclosure, "a plurality" means two or more unless otherwise specifically defined.
[0049] In the description of the present disclosure, it should be noted that unless otherwise clearly specified or limited, the terms "installation", "connection", and "coupling" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection, an electrical connection, or a connection that allows mutual communication; it can be a direct connection, or an indirect connection through an intermediate medium, and can be the internal connection of two components or the interaction relationship between two components. For those of ordinary skill in the art, the specific meanings of the above terms in the present disclosure can be understood according to specific circumstances.
[0050] In the present disclosure, unless otherwise clearly specified or limited, the first feature being "on" or "under" the second feature may include the direct contact between the first and second features, or may include the situation where the first and second features are not in direct contact but in contact through additional features therebetween. Moreover, the first feature being "above", "over" and "on top of" the second feature includes that the first feature is directly above and obliquely above the second feature, or merely means that the horizontal height of the first feature is higher than that of the second feature. The first feature being "under", "below" and "beneath" the second feature includes that the first feature is directly below and obliquely below the second feature, or merely means that the horizontal height of the first feature is lower than that of the second feature.
[0051] The following disclosure provides many different embodiments or examples for implementing different structures of the present disclosure. To simplify the disclosure of the present disclosure, the components and settings of specific examples are described below. Of course, they are only examples and are not intended to limit the present disclosure. In addition, the present disclosure may repeat reference numerals and / or reference letters in different examples. Such repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed. In addition, the present disclosure provides examples of various specific processes and materials, but those of ordinary skill in the art may be aware of the application of other processes and / or the use of other materials.
[0052] The preferred embodiments of the present disclosure are described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are only for the purpose of illustrating and explaining the present disclosure, and are not used to limit the present disclosure.
[0053] The present disclosure provides a method for adding tags (TAGs) to log files. Figure 1 The flowchart of method 10 for adding tags to log files according to some embodiments of the present disclosure is shown, as Figure 1As shown, the method 10 includes steps S1 - S3: In step S1, traverse the project files and select the target type files; in step S2, determine whether each line of code in the target type files has a log print identifier to obtain a first judgment result; in step S3, based on the first judgment result, add tags to each line of code with a log print identifier. Compared with the existing solution of adding tags to log messages during the program development stage before version freezing, the present disclosure can normally use log printing during the program development stage before version freezing without considering adding tags to log messages. After version freezing, executing the above method 10 to add tags to log messages is more simple and convenient, which is beneficial to reducing the complexity of program development, reducing unnecessary energy and time of developers, and reducing the storage space occupied by the program, so as to accurately perform operations such as querying, positioning, and statistics in business logs. The method of the present disclosure will be introduced in detail below.
[0054] In some embodiments, in step S1, after version freezing, traverse the project files, obtain the suffix name and / or extension of the project files, and based on the suffix name and / or extension of the files, select the target type files. The target type files may include one or more of Java, Php, and Shell. Correspondingly, the suffix name of the target type files includes one or more of ".java", ".php", and ".shell"; the extension of the target type files includes one or more of "java", "php", and "shell". In some embodiments, different project files may correspond to different businesses.
[0055] In some embodiments, ways such as using String.substring() to intercept, String.split() to split, regular expressions in Java, the commons.io.FilenameUtils class, the util.StringUtils class, the java.nio.file.Paths class, etc. can be used to obtain the suffix name of Java files in the project and select Java files.
[0056] In some embodiments, the PHP pathinfo() can be used to obtain the extension of Php files, the PHPSplFileInfo class can be used to obtain the suffix name of Php files, and the PHP substr() and strrchr() functions can be used to obtain the extension of Php files to select Php files.
[0057] In some embodiments, ways such as using regular expressions in Shell can be used to obtain the suffix name of Shell files in the project and select Shell files.
[0058] It should be noted that the above-mentioned target type files and their selection methods are only for illustrative purposes and do not constitute a limitation to the present disclosure. In practical applications, the target type files may also include other types in addition to the above-mentioned Java, Php, and Shell, and the target type files can also be selected by other methods in addition to the above-mentioned methods. All of these are within the protection scope of the present disclosure, and in practical applications, it can be flexibly adjusted according to the actual situation.
[0059] In addition, the present disclosure does not limit the quantity and type of target type files under the project. In some embodiments, the quantity of target type files included under the project can be one, and this target type file can be one of the files of Java, Php, and Shell. In other embodiments, the quantity of target type files included under the project can also be multiple. The multiple target type files can be files of the same type, such as one of the files of Java, Php, and Shell; or they can be multiple files of different types, such as two or three of the files of Java, Php, and Shell.
[0060] After selecting the target type files, step S2 can be executed to determine whether each line of code in the target type files has a log print identifier, obtaining a first result. Specifically, it can be determined whether there is a log print identifier by whether each line of code has the keyword "log".
[0061] The first result includes: having a log print identifier, not having a log print identifier.
[0062] An example of a line of code having a log print identifier is as follows:
[0063] "log.warn(\"Password format error\");"
[0064] An example of a line of code not having a log print identifier is as follows:
[0065] "check.setMobile(mobile);"
[0066] It should be noted that the above two lines of code are only for illustrative purposes and do not constitute a limitation to the present disclosure.
[0067] In some embodiments, in step S3, based on the first judgment result, a label is added to each line of code having a log print identifier. For example, when it is determined that a certain line of code in the target type file has a log print identifier, a label can be added to this line of code; on the contrary, when it is determined that a certain line of code in the target type file does not have a log print identifier, no label is added to this line of code.
[0068] In some embodiments, the tag includes 6 random characters, and the value range of each random character is 0-9, a-z, or A-Z. For example, the tag can be "uKPeGy", "TFYRDK", "0Gs2Ls", "pBkaVB", "ZgWSyx", "abmNFM", "Sgshga", "pBkaV5", etc., which can be specifically implemented through the following code:
[0069] random_str = get_random_str(6)
[0070] In some embodiments, when adding a tag to a certain line of code, "tag0" can be concatenated before and / or after the 6 random characters. Taking the concatenation before the 6 random characters as an example, it can be "tag0uKPeGy", and so on.
[0071] It should be noted that the number of digits of the tag and the value range of each random character are only for illustrative purposes and do not constitute a limitation to the present disclosure.
[0072] In some embodiments, in the target type file, the tags of each line of code with a log print identifier are different. In other words, in the target type file, the tag of each line of code with a log print identifier is unique, so that when processing business logs through tags later, operations such as fast and accurate positioning, querying, and data statistics can be achieved.
[0073] In some embodiments, in step S3, one or more of the languages Python, Java, Php, and Shell can be used to add tags to each line of code with a log print identifier.
[0074] In some embodiments, the python language can be used to add tags to each line of code with a log print identifier. Compared with other languages, the python language is more lightweight and the speed of adding tags is faster.
[0075] In some embodiments, the types of tags include protected tags (protection TAG) or non-protected tags (non-protection TAG). A protected tag refers to a tag that cannot be overwritten by newly added tags. A non-protected tag refers to a tag that can be overwritten by newly added tags.
[0076] In some embodiments, a protected tag data pool can also be set up to store protected tags. The protected tag data pool can be implemented through program code, for example, defined in a script, and the example is as follows:
[0077] # protection tag
[0078] protect_tag = ['uKPeGy', 'TFYRDK']
[0079] Whether a label is a protected label depends on its location. If the label is in the protected label data pool, then it is a protected label; conversely, if the label is not in the protected label data pool, then it is a non-protected label. For example, the above labels "uKPeGy" and "TFYRDK" are in the above protected label data pool, so these two labels are protected labels; for another example, the label "0Gs2Ls" is not in the above protected label data pool, so this label is a non-protected label, and so on.
[0080] In some embodiments, the type of a label can be changed by adjusting its storage location. For example, when it is necessary to change the label "uKPeGy" from a protected label to a non-protected label, then this label can be removed from the protected label data pool; for another example, when it is necessary to change the label "0Gs2Ls" from a non-protected label to a protected label, then this label can be added to the protected label data pool, and so on. In practical applications, the type of label can be flexibly adjusted according to actual needs.
[0081] In some embodiments, a non-protected label data pool can be set up to store non-protected labels. The non-protected label data pool can be implemented by program code, for example, defined in a script. Similar to the case of the above protected label data pool, it will not be elaborated here.
[0082] In some embodiments, whether a label is a protected label depends on its location. If the label is in the protected label data pool, then it is a protected label; conversely, if the label is in the non-protected label data pool, then it is a non-protected label.
[0083] In some embodiments, the type of a label can be changed by adjusting its storage location. For example, when it is necessary to change the label "uKPeGy" from a protected label to a non-protected label, then this label can be transferred from the protected label data pool to the non-protected label data pool; for another example, when it is necessary to change the label "0Gs2Ls" from a non-protected label to a protected label, then this label can be transferred from the non-protected label data pool to the protected label data pool, and so on. Thus, flexible adjustment of the label type can also be achieved.
[0084] In the above embodiments, the protected label data pool and / or the non-protected label data pool are implemented by program code. In other embodiments, the protected label data pool and / or the non-protected label data pool can also be implemented by a storage device. The storage device can be a physical medium, a transmission medium, or a database in a cloud server.
[0085] Figure 2 A flowchart showing the sub-steps of step S3 according to some embodiments of the present disclosureFigure 3 FIG. Figure 3 shows a flowchart of a method 20 for adding tags to log files according to some other embodiments of the present disclosure. As Figure 2 and Figure 3 shown, method 20 includes steps S1 - S3, where steps S1 - S2 are substantially the same as steps S1 - S2 in the foregoing method 10 and will not be described herein again.
[0086] In method 20, step S3 includes the following sub - steps S31 - S33:
[0087] In sub - step S31, it is determined whether a tag has been added to each line of code with a log printing identifier. In some embodiments, it can be determined whether a tag has been added to each line of code by whether each line of code has the keyword "tag0".
[0088] In sub - step S32, the type of the added tag is determined to obtain a second determination result. The second determination result includes: a protection tag has been added, a non - protection tag has been added. In some embodiments, it can be determined the type of the tag by whether the tag is located in the protection tag data pool.
[0089] In sub - step S33, based on the second determination result, a tag is added to each line of code with a log printing identifier. In some embodiments, when it is determined that the type of the added tag is a non - protection tag, a new tag can be added to the corresponding line of code; conversely, when it is determined that the type of the added tag is a protection tag, it is not necessary to add a tag to the corresponding line of code, and the process ends. It can be understood that for the case where a protection tag has already been added, even if a new tag is added, it will not overwrite the original tag. Therefore, it is not necessary to add a tag to the corresponding line of code in order to reduce the processing complexity, reduce the storage space occupied by the program, speed up the processing speed, and be more simple and convenient.
[0090] As described above, different project files can correspond to different services. Based on different services, different tags can be added to distinguish different services, facilitating subsequent operations such as quick and accurate positioning, querying, and data statistics in the logs of different services when processing the logs of different services through tags. For example, for Service A, when adding tags to each line of code with a log print identifier in the target type file of the Service A project file, among the 6 random characters of the tag, the first random character on the left can be "A", and the remaining 5 characters are randomly generated, such as "AKPeGy", etc.; for another example, for Service B, when adding tags to each line of code with a log print identifier in the target type file of the Service B project file, among the 6 random characters of the tag, the first random character on the left can be "B", and the remaining 5 characters are randomly generated, such as "BFYRDK", etc., and so on. It should be noted that the above method of adding tags for different services is only an exemplary illustration and is not limited thereto, depending on the actual situation.
[0091] Adding different tags to the logs of different services, and the tag for each line of code in the logs of each service is unique. Therefore, even if the business logic is the same but the processing is different, it will not cause the duplication of key log information, and it is possible to perform operations such as quick and accurate positioning, querying, and data statistics in the logs of different services. In some embodiments, the log includes one or more levels among fatal error (FATAL), error (ERROR), warning (WARN), information (INFO), debug (DEBUG), and trace (TRACE). Through the above method, tags can be added to logs of different levels, so that subsequent operations such as quick and accurate positioning, querying, and data statistics can be realized in the logs of different levels when processing the business logs of different levels through tags.
[0092] The above has introduced in detail the method of adding tags to the log in the present disclosure. The present disclosure also relates to a method 300 for processing business logs. The following is a specific introduction.
[0093] Figure 4 FIG. shows a flowchart of a method 300 for processing business logs according to some embodiments of the present disclosure, as Figure 4 shown, the processing method 300 includes steps S310 - S320: In step S310, determine the tags in the business log; and in step S320, perform one or more operations of positioning, querying, and data statistics in the business log through the tags; wherein, the business log includes the log as described above; the tag includes the tag as described above.
[0094] In some embodiments, when querying business logs, a specific piece of code logic can be accurately located through tags. For example, when an error log including the tag "DnppNC" is found in the business logs, the tag can be searched in the global code, and the location of the error code can be quickly located for timely handling.
[0095] In some embodiments, when performing data statistics on business logs, for example, when a debug log including the tag "iudPIv" is found in the business logs, the tag can be searched in the global code, the location of the debug code can be quickly located, and the debug time and debug times can also be statistically counted. A histogram can also be generated based on the statistical results for querying.
[0096] It should be noted that the above is only an exemplary illustration and does not constitute a limitation to the present disclosure. Based on the unique tags assigned to different services, the present disclosure can achieve operations such as fast and accurate location, query, and data statistics through tags, which is beneficial to improving the processing speed and accuracy of business logs.
[0097] The present disclosure also provides a processing system for business logs. Figure 5 The schematic diagram of a processing system 40 for business logs according to some embodiments of the present disclosure is shown, as Figure 5 shown. The processing system 40 includes a terminal 41 and a server 42, and the server 42 can communicate with the terminal 41. The terminal 41 is configured to send a request instruction to the server 42; the server 42 is configured to respond to the request instruction and execute the above-described processing method 300 based on the request instruction. The server 42 can be a local server.
[0098] Figure 6 The schematic diagram of a processing system 50 for business logs according to some other embodiments of the present disclosure is shown, as Figure 6 shown. The difference between the processing system 50 and the processing system 40 is that in the processing system 50, the server 52 can be a cloud server.
[0099] In some embodiments, as Figure 5 and Figure 6 shown, the terminal 41 may include: smart phones, tablets, computers, wearable devices, smart doors, smart door locks, smart doorbells, smart door viewers, smart switches, smart knobs, smart drying racks, electric curtains, Bluetooth wireless switches, smart care lights, central air-conditioning controllers, human sensors, sweeping robots, temperature and humidity sensors, door and window sensors, air purifiers, smart watches, smart cameras, smart water purifiers, smart magnetic suction spotlights, smart magnetic suction floodlights, smart magnetic suction grille lights, smart ceiling lights, smart light strips, etc.
[0100] In summary, the method for adding tags to log logs, the method for processing service logs, and the system for processing service logs of the present disclosure have been introduced in detail. Compared with the existing solution for adding tags to log logs in the program development stage before version sealing, the method for adding tags to log logs of the present disclosure can normally use log printing in the program development stage before version sealing without considering adding tags to log logs. After version sealing, the above method is executed to add tags to log logs, which is more simple and convenient, conducive to reducing the complexity of program development and the storage space occupied by the program, so as to accurately perform operations such as querying, positioning, and statistics in service logs.
[0101] The method and system for processing service logs of the present disclosure, based on tags, can quickly and accurately perform one or more operations of positioning, querying, and data statistics in service logs. Even in the case of numerous and complex service logs, different services can be distinguished through tags, and one or more operations of positioning, querying, and data statistics can be performed for different services and different levels of logs, which is conducive to reducing the difficulty of service log processing, reducing the pressure on the service log search engine, improving the efficiency of service log processing, improving the accuracy of log processing results, and improving the convenience of service log processing.
[0102] The present disclosure also relates to a computer-readable storage medium, including computer-executable instructions stored thereon, and the executable instructions, when executed by a processor, implement the method 10 / 20 as described above; and / or implement the processing method 300 as described above.
[0103] In some embodiments, the method and / or processing method of the present disclosure may exist in the form of program code. The program code may be included in an entity medium, such as a floppy disk, an optical disc, a hard disk, or any other machine-readable (such as computer-readable) storage medium, or may not be limited to an external form of a computer program product. Among them, when the program code is loaded and executed by a machine, such as a computer, this machine becomes a device for participating in the present disclosure. The program code can also be transmitted through some transmission media, such as wires or cables, optical fibers, or any transmission form. Among them, when the program code is received, loaded, and executed by a machine, such as a computer, this machine becomes a device for participating in the present disclosure. When actually operating on a general-purpose processing unit, the program code combines with the processing unit to provide a unique device whose operation is similar to that of an application-specific logic circuit.
[0104] In some embodiments, the processor / processing unit may include a Central Processing Unit (CPU), and may also include other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and other similar devices.
[0105] In some embodiments, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in combination with an instruction execution system, apparatus, or device. Computer-readable storage media include, but are not limited to, electrical, magnetic, optical, or semiconductor forms or devices, and more specific examples (a non-exhaustive list) include: electrical connections with one or more wires, portable computer hard disks, hard disks, Random Access Memory (RAM), Non-Volatile Random Access Memory (NVRAM), Read-Only Memory (ROM), Erasable Programmable Read-Only Memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.
[0106] It should be noted that this specification provides method operation steps as described in the embodiments or schematic diagrams, but based on routine or non-creative labor, there may be more or fewer operation steps. The step order listed in the embodiments is only one of the many step execution orders and does not represent the only execution order. When the actual system or device product is executed, it may be executed in the order of the method shown in the embodiments or flowcharts or executed in parallel.
[0107] Finally, it should be noted that the above are only the preferred embodiments of the present disclosure and are not used to limit the present disclosure. Although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present disclosure shall be included within the protection scope of the present disclosure.
Claims
1. A method for adding tags to log files, comprising: S1: Traverse project files and select target type files; S2: Determine whether each line of code in the target type files has a log print identifier, obtaining a first judgment result; and S3: Based on the first judgment result, add tags to each line of code having a log print identifier.
2. The method according to claim 1, wherein the step S3 comprises the following sub-steps: S31: Determine whether each line of code having a log print identifier has already been tagged; S32: Determine the type of the already added tag, obtaining a second judgment result; and S33: Based on the second judgment result, add tags to each line of code having a log print identifier.
3. The method according to claim 2, wherein the type of the label includes a protection label or a non - protection label; the sub - step S33 includes: When it is determined that the type of the already added tag is a non-protected tag, add a tag to the corresponding line of code.
4. The method according to any one of claims 1-3, wherein the tags for each line of code having a log print identifier are different from each other.
5. The method according to claim 4, wherein the tag comprises 6 random characters, and the value range of each random character is 0-9, a-z or A-Z.
6. The method according to each of claims 1 - 3, wherein step S3 includes: Add tags to each line of code having a log print identifier through one or more of the languages Python, Java, Php, and Shell.
7. The method according to any one of claims 1-3, wherein the target type files include one or more of java, Php, and Shell.
8. The method according to any one of claims 1-3, wherein the log file includes one or more levels of fatal error, error, warning, information, debug, and trace.
9. A method for processing business logs, comprising: Determine the tags in the business logs; and Perform one or more operations of positioning, querying, and data statistics in the business logs through the tags; wherein, the business logs include the log files as described in any one of claims 1-8; the tags include the tags as described in any one of claims 1-8.
10. A business log processing system, comprising: A terminal; and A server, communicating with the terminal; wherein, the terminal is configured to send a request instruction to the server; The server is configured to respond to the request instruction and, based on the request instruction, execute the processing method as described in claim 9.
11. A computer-readable storage medium, comprising computer-executable instructions stored thereon, the executable instructions, when executed by a processor, implement the method as described in any one of claims 1-8; and / or implement the processing method as described in claim 9.