WO2020238049A1 - Procédé et appareil de configuration d'attribut pour structure de journal log4j, et dispositif informatique - Google Patents

Procédé et appareil de configuration d'attribut pour structure de journal log4j, et dispositif informatique Download PDF

Info

Publication number
WO2020238049A1
WO2020238049A1 PCT/CN2019/117667 CN2019117667W WO2020238049A1 WO 2020238049 A1 WO2020238049 A1 WO 2020238049A1 CN 2019117667 W CN2019117667 W CN 2019117667W WO 2020238049 A1 WO2020238049 A1 WO 2020238049A1
Authority
WO
WIPO (PCT)
Prior art keywords
system variable
designated
attribute
specified
attribute value
Prior art date
Application number
PCT/CN2019/117667
Other languages
English (en)
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 WO2020238049A1 publication Critical patent/WO2020238049A1/fr

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/122File system administration, e.g. details of archiving or snapshots using management policies
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems

Definitions

  • This application relates to the computer field, and in particular to a method, device, computer equipment, and storage medium for configuring log4j log framework attributes.
  • log records are often used. For example, online problem tracking, log-based business logic statistical analysis, etc. are inseparable from logs.
  • log frameworks among which log4j log framework is a commonly used one.
  • attribute configuration for example, attribute modification
  • the server needs to be restarted, making attribute configuration (for example, attribute modification) time-consuming and unable to take effect quickly. Therefore, the prior art lacks a solution that can perform real-time attribute configuration on the log4j log framework and solve the technical problem that attribute configuration takes a long time and cannot take effect quickly.
  • the main purpose of this application is to provide a log4j log framework attribute configuration method, device, computer equipment and storage medium, aiming to solve the technical problem that attribute configuration takes a long time and cannot take effect quickly.
  • this application proposes a method for configuring the attributes of the log4j log framework, which includes the following steps:
  • a preset configuration file is retrieved, wherein a designated system variable placeholder is set at the position of the designated attribute in the configuration file, and the designated system variable placeholder refers to the designated system variable Special symbol
  • This application provides an attribute configuration device of log4j log framework, including:
  • the attribute configuration instruction receiving unit is configured to receive an attribute configuration instruction to the log4j log framework, and the attribute configuration instruction carries a specified attribute value;
  • the configuration file retrieval unit is configured to retrieve a preset configuration file according to the attribute configuration instruction, wherein a designated system variable placeholder is set in the position of the designated attribute in the configuration file, and the designated system variable accounts for Bit symbol refers to the special symbol that represents the specified system variable;
  • the designated attribute value judgment unit is configured to obtain the designated system variable by using the designated system variable placeholder, and determine whether the designated system variable is the same as the designated attribute value;
  • the attribute value editing unit is configured to, if the designated system variable is not the same as the designated attribute value, call a preset system variable editing method to edit the designated system variable to the designated attribute value;
  • the update unit is configured to call a preset configuration file loading method, so that the log4j log framework updates the current attribute value to the specified attribute value according to the configuration file, thereby completing the attribute configuration of the log4j log framework.
  • the present application provides a computer device including a memory and a processor, the memory stores computer readable instructions, and the processor implements the steps of any one of the above methods when the computer readable instructions are executed.
  • the present application provides a computer-readable storage medium on which computer-readable instructions are stored, and when the computer-readable instructions are executed by a processor, the steps of any of the above methods are implemented.
  • the attribute configuration method, device, computer equipment and storage medium of the log4j log framework of this application receive an attribute configuration instruction for the log4j log framework; call a preset configuration file, where the specified attribute in the configuration file is set at the position There is a designated system variable placeholder; the designated system variable is obtained by using the designated system variable placeholder; if the designated system variable is different from the designated attribute value, the designated system variable is edited as the Specify the attribute value; call a preset configuration file loading method, so that the log4j log framework updates the current attribute value to the specified attribute value according to the configuration file.
  • real-time attribute configuration of the log4j log framework is realized, and the technical problem that attribute configuration takes a long time and cannot take effect quickly is solved.
  • FIG. 1 is a schematic flowchart of an attribute configuration method of the log4j log framework according to an embodiment of the application
  • FIG. 2 is a schematic block diagram of the structure of a device for configuring an attribute of a log4j log framework according to an embodiment of the application;
  • FIG. 3 is a schematic block diagram of the structure of a computer device according to an embodiment of the application.
  • an embodiment of the present application provides a method for configuring attributes of the log4j log framework, including the following steps:
  • the attribute configuration instruction retrieve a preset configuration file, wherein a designated system variable placeholder is set in the position of the designated attribute in the configuration file, and the designated system variable placeholder refers to a designated system Special symbols for variables;
  • This application uses designated system variable placeholders, and when the attributes need to be modified, only the designated system variables can be edited accordingly, thereby overcoming the shortcomings of time-consuming and inability to quickly take effect caused by restarting the server.
  • an attribute configuration instruction to the log4j log framework is received, and the attribute configuration instruction carries a specified attribute value.
  • the attribute configuration instruction is used to instruct to configure the attributes of the log4j log framework, for example, to configure attributes such as log level and log file storage path, with the purpose of configuring the specified attribute to be the specified attribute value carried by the attribute configuration instruction.
  • a preset configuration file is called, wherein a designated system variable placeholder is set in the position of the designated attribute in the configuration file, and the designated system variable placeholder Symbols refer to special symbols that represent specified system variables.
  • the configuration of properties requires the use of preset configuration files to obtain the property values to be configured.
  • a designated system variable placeholder is set at the position of the designated attribute in the configuration file, so that when the attribute needs to be modified, only the designated system variable can be edited accordingly, and the configuration file does not need to be modified.
  • placeholders are symbols that occupy a fixed position and wait for you to add content to them; and system variable placeholders are special symbols that represent system variables; system variables refer to the data storage location defined by the system. Recorded data.
  • system variable placeholders are not ordinary placeholders, because the system variable placeholders represent system variables, and the system variables can be edited without opening the configuration file, so that the configuration file is not modified. The modification of attributes therefore avoids the disadvantages of time-consuming and unable to take effect quickly due to the need to restart the server during attribute configuration (modification) in the traditional method.
  • the state of the system variable placeholder in the configuration file is, for example: all attribute positions in the configuration file are occupied by system variable placeholders; or, there is only designated The attribute position is occupied by a system variable placeholder; or, other attribute positions in the configuration file except the specified attribute position record the attribute value or are occupied by the system variable placeholder.
  • the designated system variable is obtained by using the designated system variable placeholder, and it is determined whether the designated system variable is the same as the designated attribute value.
  • the system variable placeholder is a special symbol representing the system variable. Therefore, the designated system variable can be obtained by querying the designated system variable placeholder. Then judge whether the specified system variable is the same as the specified attribute value; if the specified system variable is the same as the specified attribute value, that is, the current attribute value is the same as the specified attribute value, so no attribute update is required; If the system variable is different from the specified attribute value, an attribute update operation is required.
  • a preset system variable editing method is called to edit the designated system variable to the designated attribute value. If the specified system variable is different from the specified attribute value, an attribute update operation is required.
  • a method is also called a function, which is a collection of statements that perform a function together.
  • the system variable editing method is used to edit the system variable. Since the system variable editing method is preset, the system variable editing can be realized by directly calling this method.
  • the method for editing the system variable is, for example, obtaining the position of the system variable; deleting the system variable data; recording the pre-prepared variable data into the system variable position, so as to realize the editing of the system variable.
  • step S5 call the preset configuration file loading method, so that the log4j log framework updates the current attribute value to the specified attribute value according to the configuration file, thereby completing the attribute configuration of the log4j log framework .
  • the configuration file loading method is used to load a configuration file to update all or part of the attributes. Therefore, by calling the preset configuration file loading method, the attribute update operation can be performed, so that the log4j log framework updates the current attribute value to the specified attribute value according to the configuration file, thereby completing the attributes of the log4j log framework Configuration.
  • the preset configuration file is called according to the attribute configuration instruction, wherein a designated system variable placeholder is set in the position of the designated attribute in the configuration file, and the designated system variable occupies Place symbol refers to the special symbol representing the designated system variable before step S2, including:
  • the position of the tag attribute in the configuration file is set as a system variable placeholder. If some attributes of the log4j log framework are not frequently modified, then these attributes can be directly recorded in the configuration file with specific attribute values, and there is no need to use system variable placeholders. However, for attributes that have been modified more than the preset number threshold within a predetermined time, because they are often modified, system variable placeholders need to be used. Thus, the attributes in the configuration file are divided into specific attribute values or system variable placeholders according to the number of times they have been modified, thereby reducing the increase in system burden caused by all use of system variable placeholders in the configuration file ( System variable placeholders take up more space) defects.
  • the step S3 of obtaining the designated system variable by using the designated system variable placeholder, and determining whether the designated system variable is the same as the designated attribute value includes:
  • S301 Acquire the designated system variable by using the designated system variable placeholder according to the preset correspondence between the system variable placeholder and the system variable;
  • S302 Calculate the similarity value between the designated system variable and the designated attribute value by using a preset similarity algorithm
  • the designated system variable is obtained by using the designated system variable placeholder, and it is determined whether the designated system variable is the same as the designated attribute value.
  • the preset similarity algorithm is, for example, the WMD algorithm (word move's distance), the simhash algorithm, and the algorithm based on cosine similarity and word frequency vector similarity.
  • the foregoing algorithms are all mature algorithms and will not be repeated here. If the similarity value is less than the preset similarity threshold, it is determined that the specified system variable is not the same as the specified attribute value; if the similarity value is not less than the preset similarity threshold, it is determined that the specified The system variable is the same as the specified attribute value.
  • the purpose of this embodiment is to be compatible with the miswriting of the specified attribute value carried by the attribute configuration instruction. For example, if DEBUG is mistakenly written as DEBAG, the similarity algorithm according to this embodiment will determine that the two are the same, so there is no need to update the attribute. This avoids the use of ordinary text comparison methods (comparing characters one by one, if there is a difference, the judgment is not the same) to judge the two as different, which will lead to the subsequent incorrect unrecognizable DEBAG (DEBUG is the log level, and DEBAG is not) Set to the attribute value of the log4j log frame, causing serious errors.
  • the step S302 of calculating the similarity value between the designated system variable and the designated attribute value by using a preset similarity algorithm includes:
  • the preset similarity algorithm is used to calculate the similarity value between the designated system variable and the designated attribute value.
  • the similarity algorithm is calculated according to the cosine similarity between the designated system variable and the designated attribute value, so as to reflect the degree of similarity between the designated system variable and the designated attribute value. When the value of similarity is closer to 1, the more similar is; the closer to 0, the less similar.
  • the step S4 of calling a preset system variable editing method to edit the designated system variable to the designated attribute value includes :
  • the user accounts in the preset list of authorized users have the authority to edit system variables, so as to reduce the possibility of system variables being tampered with.
  • the preset parameter range limits the parameter content that the specified system variable can be set.
  • the log level can be set to five levels: DEBUG, INFO, WARN, ERROR and FATAL, that is, the preset parameter range is DEBUG, INFO, WARN , ERROR and FATAL. Therefore, authorization verification and parameter verification are performed first to reduce the possibility of attribute configuration errors.
  • the reminder information of the parameter error is returned to the terminal that sends the attribute configuration instruction of the log4j log framework.
  • the specified attribute value exceeds the preset parameter range of the specified system variable, the specified attribute value cannot be configured, otherwise it will cause an error in the log4j log framework.
  • the preset parameter range of the log level is DEBUG, INFO, WARN , ERROR and FATAL, and the specified attribute value is right, which exceeds the preset parameter range of the specified system variable, a warning message of parameter error should be generated, and the warning message of the parameter error should be returned to the sender of the log4j log frame The terminal of the attribute configuration command.
  • the attributes other than the specified attributes in the configuration file record preset attribute values, and the preset configuration file loading method is invoked, so that the log4j log framework is based on the configuration file Updating the current attribute value to the designated attribute value to complete the step S5 of the attribute configuration of the log4j log framework includes:
  • the property configuration of the log4j log framework is completed.
  • other attributes in the configuration file other than the specified attribute record the preset attribute value, so there is no need to update the other attributes when performing attribute configuration (attribute update) (so the configuration file is not modified, so It is impossible to change other attributes), which reduces the amount of calculation and improves the speed of attribute configuration. Accordingly, only the designated attribute of the log4j log framework is updated to the designated attribute value, and the values of the other attributes except the designated attribute are retained, thereby completing the attribute configuration of the log4j log framework.
  • an embodiment of the present application provides a device for configuring attributes of a log4j log framework, including:
  • the attribute configuration instruction receiving unit 10 is configured to receive an attribute configuration instruction to the log4j log framework, and the attribute configuration instruction carries a specified attribute value;
  • the configuration file retrieval unit 20 is configured to retrieve a preset configuration file according to the attribute configuration instruction, wherein a designated system variable placeholder is set in the position of the designated attribute in the configuration file, and the designated system variable Placeholders refer to special symbols that represent designated system variables;
  • the designated attribute value judgment unit 30 is configured to obtain the designated system variable by using the designated system variable placeholder, and determine whether the designated system variable is the same as the designated attribute value;
  • the attribute value editing unit 40 is configured to, if the designated system variable is not the same as the designated attribute value, call a preset system variable editing method to edit the designated system variable to the designated attribute value;
  • the update unit 50 is configured to call a preset configuration file loading method, so that the log4j log framework updates the current attribute value to the specified attribute value according to the configuration file, thereby completing the attribute configuration of the log4j log framework.
  • This application uses designated system variable placeholders, and when the attributes need to be modified, only the designated system variables can be edited accordingly, thereby overcoming the shortcomings of time-consuming and inability to quickly take effect caused by restarting the server.
  • an attribute configuration instruction to the log4j log framework is received, and the attribute configuration instruction carries a specified attribute value.
  • the attribute configuration instruction is used to instruct to configure the attributes of the log4j log framework, for example, to configure attributes such as log level and log file storage path, with the purpose of configuring the specified attribute to be the specified attribute value carried by the attribute configuration instruction.
  • a preset configuration file is called, wherein a designated system variable placeholder is set in the position of the designated attribute in the configuration file, and the designated system variable placeholder Symbols refer to special symbols that represent specified system variables.
  • the configuration of properties requires the use of preset configuration files to obtain the property values to be configured.
  • a designated system variable placeholder is set at the position of the designated attribute in the configuration file, so that when the attribute needs to be modified, only the designated system variable can be edited accordingly, and the configuration file does not need to be modified.
  • placeholders are symbols that occupy a fixed position and wait for you to add content to them; and system variable placeholders are special symbols that represent system variables; system variables refer to the data storage location defined by the system. Recorded data.
  • system variable placeholders are not ordinary placeholders, because the system variable placeholders represent system variables, and the system variables can be edited without opening the configuration file, so that the configuration file is not modified. The modification of attributes therefore avoids the disadvantages of time-consuming and unable to take effect quickly due to the need to restart the server during attribute configuration (modification) in the traditional method.
  • the state of the system variable placeholder in the configuration file is, for example: all attribute positions in the configuration file are occupied by system variable placeholders; or, there is only designated The attribute position is occupied by a system variable placeholder; or, other attribute positions in the configuration file except the specified attribute position record the attribute value or are occupied by the system variable placeholder.
  • the designated system variable is obtained by using the designated system variable placeholder, and it is determined whether the designated system variable is the same as the designated attribute value.
  • the system variable placeholder is a special symbol representing the system variable. Therefore, the designated system variable can be obtained by querying the designated system variable placeholder. Then judge whether the specified system variable is the same as the specified attribute value; if the specified system variable is the same as the specified attribute value, that is, the current attribute value is the same as the specified attribute value, so no attribute update is required; If the system variable is different from the specified attribute value, an attribute update operation is required.
  • a preset system variable editing method is called to edit the designated system variable to the designated attribute value. If the specified system variable is different from the specified attribute value, an attribute update operation is required.
  • a method is also called a function, which is a collection of statements that perform a function together.
  • the system variable editing method is used to edit the system variable. Since the system variable editing method is preset, the system variable editing can be realized by directly calling this method.
  • the method for editing the system variable is, for example, obtaining the position of the system variable; deleting the system variable data; recording the pre-prepared variable data into the system variable position, so as to realize the editing of the system variable.
  • the preset configuration file loading method is invoked so that the log4j log framework updates the current attribute value to the specified attribute value according to the configuration file, thereby completing the attribute configuration of the log4j log framework .
  • the configuration file loading method is used to load a configuration file to update all or part of the attributes. Therefore, by calling the preset configuration file loading method, the attribute update operation can be performed, so that the log4j log framework updates the current attribute value to the specified attribute value according to the configuration file, thereby completing the attributes of the log4j log framework Configuration.
  • the device includes:
  • the attribute to be modified marking unit is used to count information about the number of times that the attributes of the log4j log frame have been modified within a predetermined time, and record attributes whose number of times of modification exceeds a preset number threshold as attributes to be modified;
  • the system variable placeholder setting unit is used to set the system variable placeholder in the position of the attribute to be modified in the configuration file.
  • the position of the tag attribute in the configuration file is set as a system variable placeholder. If some attributes of the log4j log framework are not frequently modified, then these attributes can be directly recorded in the configuration file with specific attribute values, and there is no need to use system variable placeholders. However, for attributes that have been modified more than the preset number threshold within a predetermined time, because they are often modified, system variable placeholders need to be used. Thus, the attributes in the configuration file are divided into specific attribute values or system variable placeholders according to the number of times they have been modified, thereby reducing the increase in system burden caused by all use of system variable placeholders in the configuration file ( System variable placeholders take up more space) defects.
  • the designated attribute value judgment unit 30 includes:
  • the designated system variable obtaining subunit is configured to obtain the designated system variable by using the designated system variable placeholder according to the corresponding relationship between the preset system variable placeholder and the system variable;
  • the similarity value calculation subunit is used to calculate the similarity value between the designated system variable and the designated attribute value by using a preset similarity algorithm
  • the dissimilar determination subunit is configured to determine that the specified system variable is not the same as the specified attribute value if the similarity value is less than a preset similarity threshold.
  • the designated system variable is obtained by using the designated system variable placeholder, and it is determined whether the designated system variable is the same as the designated attribute value.
  • the preset similarity algorithm is, for example, the WMD algorithm (word move's distance), the simhash algorithm, and the algorithm based on cosine similarity and word frequency vector similarity.
  • the foregoing algorithms are all mature algorithms and will not be repeated here. If the similarity value is less than the preset similarity threshold, it is determined that the specified system variable is not the same as the specified attribute value; if the similarity value is not less than the preset similarity threshold, it is determined that the specified The system variable is the same as the specified attribute value.
  • the purpose of this embodiment is to be compatible with the miswriting of the specified attribute value carried by the attribute configuration instruction. For example, if DEBUG is mistakenly written as DEBAG, the similarity algorithm according to this embodiment will determine that the two are the same, so there is no need to update the attribute. This avoids the use of ordinary text comparison methods (comparing characters one by one, if there is a difference, the judgment is not the same) to judge the two as different, which will lead to the subsequent incorrect unrecognizable DEBAG (DEBUG is the log level, and DEBAG is not) Set to the attribute value of the log4j log frame, causing serious errors.
  • the similarity value calculation subunit includes:
  • the preset similarity algorithm is used to calculate the similarity value between the designated system variable and the designated attribute value.
  • the similarity algorithm is calculated according to the cosine similarity between the designated system variable and the designated attribute value, so as to reflect the degree of similarity between the designated system variable and the designated attribute value. When the value of similarity is closer to 1, the more similar is; the closer to 0, the less similar.
  • the attribute value editing unit 40 includes:
  • a permission judgment subunit configured to judge whether the user account sending the attribute configuration instruction is in a preset permission user list if the specified system variable is not the same as the specified attribute value
  • the parameter range determination subunit is configured to determine whether the specified attribute value exceeds the preset parameter range of the specified system variable if the user account that sends the attribute configuration instruction is in the preset list of authorized users;
  • the attribute value editing subunit is configured to, if the specified attribute value does not exceed the preset parameter range of the specified system variable, call a preset system variable editing method to edit the specified system variable to the specified attribute value.
  • the user accounts in the preset list of authorized users have the authority to edit system variables, so as to reduce the possibility of system variables being tampered with.
  • the preset parameter range limits the parameter content that the specified system variable can be set.
  • the log level can be set to five levels: DEBUG, INFO, WARN, ERROR and FATAL, that is, the preset parameter range is DEBUG, INFO, WARN , ERROR and FATAL. Therefore, authorization verification and parameter verification are performed first to reduce the possibility of attribute configuration errors.
  • the attribute value editing unit 40 includes:
  • the reminder information generating subunit is configured to generate reminder information of parameter errors if the specified attribute value exceeds the preset parameter range of the specified system variable;
  • the reminder information return subunit is used to return the reminder information of the parameter error to the terminal that sends the attribute configuration instruction of the log4j log frame.
  • the reminder information of the parameter error is returned to the terminal that sends the attribute configuration instruction of the log4j log framework.
  • the specified attribute value exceeds the preset parameter range of the specified system variable, the specified attribute value cannot be configured, otherwise it will cause an error in the log4j log framework.
  • the preset parameter range of the log level is DEBUG, INFO, WARN , ERROR and FATAL, and the specified attribute value is right, which exceeds the preset parameter range of the specified system variable, a warning message of parameter error should be generated, and the warning message of the parameter error should be returned to the sender of the log4j log frame The terminal of the attribute configuration command.
  • the attributes other than the specified attributes in the configuration file record preset attribute values includes:
  • the loading method calling subunit is used to call a preset configuration file loading method, and according to the configuration file, update the specified attribute of the log4j log frame to the specified attribute value;
  • the value retention sub-unit of other attributes is used to retain the values of the other attributes except the specified attributes, so as to complete the attribute configuration of the log4j log framework.
  • the property configuration of the log4j log framework is completed.
  • other attributes in the configuration file other than the specified attribute record the preset attribute value, so there is no need to update the other attributes when performing attribute configuration (attribute update) (so the configuration file is not modified, so It is impossible to change other attributes), which reduces the amount of calculation and improves the speed of attribute configuration. Accordingly, only the designated attribute of the log4j log framework is updated to the designated attribute value, and the values of the other attributes except the designated attribute are retained, thereby completing the attribute configuration of the log4j log framework.
  • an embodiment of the present application also provides a computer device.
  • the computer device may be a server, and its internal structure may be as shown in the figure.
  • the computer equipment includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the computer designed processor is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, computer readable instructions, and a database.
  • the memory provides an environment for the operation of the operating system and computer readable instructions in the non-volatile storage medium.
  • the database of the computer equipment is used to store the data used in the attribute configuration method of the log4j log framework.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the processor executes the attribute configuration method of the log4j log framework, including the following steps: receiving an attribute configuration instruction for the log4j log framework, the attribute configuration instruction carrying a specified attribute value; according to the attribute configuration instruction, calling a preset A configuration file, wherein a designated system variable placeholder is set at the position of the designated attribute in the configuration file, and the designated system variable placeholder refers to a special symbol representing a designated system variable; the designated system variable placeholder is used Obtain the designated system variable, and determine whether the designated system variable is the same as the designated attribute value; if the designated system variable is not the same as the designated attribute value, call the preset system variable editing method to change the The specified system variable is edited as the specified attribute value; the preset configuration file loading method is called, so that the log4j log framework updates the current attribute value to the specified attribute value according to the configuration file, thereby completing the log4j log The attribute configuration of the framework.
  • the preset configuration file is called according to the attribute configuration instruction, wherein a designated system variable placeholder is set in the position of the designated attribute in the configuration file, and the designated system variable occupies
  • the position symbol refers to the special symbol representing the designated system variable before the step, including: counting the number of times the attribute of the log4j log frame has been modified within a predetermined time, and recording the attribute whose number of times of modification exceeds the preset number threshold as the attribute to be modified; Set the position of the attribute to be modified in the configuration file as a system variable placeholder.
  • the step of obtaining the designated system variable by using the designated system variable placeholder and determining whether the designated system variable is the same as the designated attribute value includes: according to a preset system variable The corresponding relationship between the placeholder and the system variable, using the designated system variable placeholder to obtain the designated system variable; using a preset similarity algorithm to calculate the similarity value between the designated system variable and the designated attribute value; If the similarity value is less than a preset similarity threshold, it is determined that the specified system variable is different from the specified attribute value.
  • the step of calculating the similarity value between the specified system variable and the specified attribute value by using a preset similarity algorithm includes: using a formula:
  • the step of calling a preset system variable editing method to edit the designated system variable to the designated attribute value if the designated system variable is different from the designated attribute value includes: If the specified system variable is not the same as the specified attribute value, it is determined whether the user account that sends the attribute configuration instruction is in the preset list of authorized users; if the user account that sends the attribute configuration instruction is in the preset In the list of authorized users, determine whether the specified attribute value exceeds the preset parameter range of the specified system variable; if the specified attribute value does not exceed the preset parameter range of the specified system variable, call the preset system The variable editing method edits the designated system variable to the designated attribute value.
  • the step of judging whether the specified attribute value exceeds the preset parameter range of the specified system variable if the user account sending the attribute configuration instruction is in a preset list of authorized users Including: if the specified attribute value exceeds the preset parameter range of the specified system variable, generating a parameter error reminder message; returning the parameter error reminder message to the terminal that sent the log4j log frame attribute configuration instruction .
  • the attributes other than the specified attributes in the configuration file record preset attribute values, and the preset configuration file loading method is invoked, so that the log4j log framework is based on the configuration file
  • the step of updating the current attribute value to the specified attribute value to complete the attribute configuration of the log4j log framework includes: calling a preset configuration file loading method, and assigning the log4j log framework to the specified configuration file according to the configuration file
  • the attribute is updated to the specified attribute value; the values of the other attributes except the specified attribute are retained, thereby completing the attribute configuration of the log4j log framework.
  • An embodiment of the present application also provides a computer-readable storage medium on which computer-readable instructions are stored.
  • a method for configuring attributes of the log4j log framework is implemented, including the following steps: receiving log4j logs
  • the attribute configuration instruction of the framework the attribute configuration instruction carries a specified attribute value; according to the attribute configuration instruction, a preset configuration file is called, wherein a specified system variable is set in the position of the specified attribute in the configuration file
  • the designated system variable placeholder refers to a special symbol representing a designated system variable; the designated system variable placeholder is used to obtain the designated system variable, and it is judged whether the designated system variable is the same as the designated attribute value The same; if the specified system variable is not the same as the specified attribute value, call the preset system variable editing method to edit the specified system variable to the specified attribute value; call the preset configuration file loading method to Make the log4j log framework update the current attribute value to the specified attribute value according to the configuration file, thereby completing the attribute configuration of the log4j
  • the preset configuration file is called according to the attribute configuration instruction, wherein a designated system variable placeholder is set in the position of the designated attribute in the configuration file, and the designated system variable occupies
  • the position symbol refers to the special symbol representing the designated system variable before the step, including: counting the number of times the attribute of the log4j log frame has been modified within a predetermined time, and recording the attribute whose number of times of modification exceeds the preset number threshold as the attribute to be modified; Set the position of the attribute to be modified in the configuration file as a system variable placeholder.
  • the step of obtaining the designated system variable by using the designated system variable placeholder and determining whether the designated system variable is the same as the designated attribute value includes: according to a preset system variable The corresponding relationship between the placeholder and the system variable, using the designated system variable placeholder to obtain the designated system variable; using a preset similarity algorithm to calculate the similarity value between the designated system variable and the designated attribute value; If the similarity value is less than a preset similarity threshold, it is determined that the specified system variable is different from the specified attribute value.
  • the step of calculating the similarity value between the specified system variable and the specified attribute value by using a preset similarity algorithm includes: using a formula:
  • the step of calling a preset system variable editing method to edit the designated system variable to the designated attribute value if the designated system variable is different from the designated attribute value includes: If the specified system variable is not the same as the specified attribute value, it is determined whether the user account that sends the attribute configuration instruction is in the preset list of authorized users; if the user account that sends the attribute configuration instruction is in the preset In the list of authorized users, determine whether the specified attribute value exceeds the preset parameter range of the specified system variable; if the specified attribute value does not exceed the preset parameter range of the specified system variable, call the preset system The variable editing method edits the designated system variable to the designated attribute value.
  • the step of judging whether the specified attribute value exceeds the preset parameter range of the specified system variable if the user account sending the attribute configuration instruction is in a preset list of authorized users Including: if the specified attribute value exceeds the preset parameter range of the specified system variable, generating a parameter error reminder message; returning the parameter error reminder message to the terminal that sent the log4j log frame attribute configuration instruction .
  • the attributes other than the specified attributes in the configuration file record preset attribute values, and the preset configuration file loading method is invoked, so that the log4j log framework is based on the configuration file
  • the step of updating the current attribute value to the specified attribute value to complete the attribute configuration of the log4j log framework includes: calling a preset configuration file loading method, and assigning the log4j log framework to the specified configuration file according to the configuration file
  • the attribute is updated to the specified attribute value; the values of the other attributes except the specified attribute are retained, thereby completing the attribute configuration of the log4j log framework.
  • Non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • ROM read only memory
  • PROM programmable ROM
  • EPROM electrically programmable ROM
  • EEPROM electrically erasable programmable ROM
  • Volatile memory may include random access memory (RAM) or external cache memory.
  • RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual-rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

L'invention concerne un procédé et un appareil de configuration d'attribut pour une structure de journal log4j, ainsi qu'un dispositif informatique et un support de stockage. Le procédé consiste à : recevoir une instruction de configuration d'attribut pour une structure de journal log4j ; selon l'instruction de configuration d'attribut, appeler un fichier de configuration prédéfini, un paramètre fictif de variable de système spécifiée étant situé à la position d'un attribut spécifié dans le fichier de configuration ; utiliser le paramètre fictif de variable de système spécifiée pour acquérir une variable de système spécifiée ; si la variable de système spécifiée est différente d'une valeur d'attribut spécifiée, appeler un procédé d'édition de variable de système prédéfini pour modifier la variable de système spécifiée afin qu'elle corresponde à la valeur d'attribut spécifiée ; et appeler un procédé de chargement de fichier de configuration prédéfini afin que la structure de journal log4j mette à jour, selon le fichier de configuration, la valeur d'attribut courante pour qu'elle corresponde à la valeur d'attribut spécifiée, ce qui permet d'achever la configuration d'attribut de la structure de journal log4j. Par conséquent, l'invention permet de réaliser une configuration d'attribut en temps réel sur une structure de journal log4j et de résoudre les problèmes techniques selon lesquels la configuration d'attribut prend du temps et est incapable de prendre effet rapidement.
PCT/CN2019/117667 2019-05-30 2019-11-12 Procédé et appareil de configuration d'attribut pour structure de journal log4j, et dispositif informatique WO2020238049A1 (fr)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910463642.8 2019-05-30
CN201910463642.8A CN110334071A (zh) 2019-05-30 2019-05-30 log4j日志框架的属性配置方法、装置和计算机设备

Publications (1)

Publication Number Publication Date
WO2020238049A1 true WO2020238049A1 (fr) 2020-12-03

Family

ID=68140557

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/117667 WO2020238049A1 (fr) 2019-05-30 2019-11-12 Procédé et appareil de configuration d'attribut pour structure de journal log4j, et dispositif informatique

Country Status (2)

Country Link
CN (1) CN110334071A (fr)
WO (1) WO2020238049A1 (fr)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110334071A (zh) * 2019-05-30 2019-10-15 平安科技(深圳)有限公司 log4j日志框架的属性配置方法、装置和计算机设备
US11449411B2 (en) 2020-06-02 2022-09-20 Red Hat, Inc. Application-specific log routing

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120215907A1 (en) * 2011-02-22 2012-08-23 Intuit Inc. Systems and methods for self-adjusting logging of log messages
CN105843822A (zh) * 2015-01-16 2016-08-10 北京神州泰岳软件股份有限公司 一种修改日志级别的方法和装置
CN106681891A (zh) * 2015-11-05 2017-05-17 阿里巴巴集团控股有限公司 一种Java应用系统中调整日志级别的方法及装置
CN106802858A (zh) * 2017-01-16 2017-06-06 广东欧珀移动通信有限公司 一种日志动态配置方法、装置及系统
CN108897659A (zh) * 2018-06-06 2018-11-27 腾讯音乐娱乐科技(深圳)有限公司 修改日志级别的方法、装置及存储介质
CN110334071A (zh) * 2019-05-30 2019-10-15 平安科技(深圳)有限公司 log4j日志框架的属性配置方法、装置和计算机设备

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7716017B2 (en) * 2002-08-16 2010-05-11 Oracle America, Inc. Distributed plug-and-play logging services
US7412691B2 (en) * 2004-12-27 2008-08-12 International Business Machines Corporation Dynamic configuration files
US8700414B2 (en) * 2004-12-29 2014-04-15 Sap Ag System supported optimization of event resolution
US8694834B2 (en) * 2010-11-30 2014-04-08 International Business Machines Corporation Preventing log wrap with debug scripts
US10585908B2 (en) * 2015-04-03 2020-03-10 Oracle International Corporation Method and system for parameterizing log file location assignments for a log analytics system
US9934303B2 (en) * 2016-04-25 2018-04-03 Dropbox, Inc. Storage constrained synchronization engine

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120215907A1 (en) * 2011-02-22 2012-08-23 Intuit Inc. Systems and methods for self-adjusting logging of log messages
CN105843822A (zh) * 2015-01-16 2016-08-10 北京神州泰岳软件股份有限公司 一种修改日志级别的方法和装置
CN106681891A (zh) * 2015-11-05 2017-05-17 阿里巴巴集团控股有限公司 一种Java应用系统中调整日志级别的方法及装置
CN106802858A (zh) * 2017-01-16 2017-06-06 广东欧珀移动通信有限公司 一种日志动态配置方法、装置及系统
CN108897659A (zh) * 2018-06-06 2018-11-27 腾讯音乐娱乐科技(深圳)有限公司 修改日志级别的方法、装置及存储介质
CN110334071A (zh) * 2019-05-30 2019-10-15 平安科技(深圳)有限公司 log4j日志框架的属性配置方法、装置和计算机设备

Also Published As

Publication number Publication date
CN110334071A (zh) 2019-10-15

Similar Documents

Publication Publication Date Title
CN109446068B (zh) 接口测试方法、装置、计算机设备和存储介质
CN112181945B (zh) 数据归档处理方法、装置、计算机设备及存储介质
CN109308285A (zh) 数据库脚本管理方法、装置、计算机设备及存储介质
WO2020238049A1 (fr) Procédé et appareil de configuration d'attribut pour structure de journal log4j, et dispositif informatique
CN112613993B (zh) 交易数据处理方法、装置、计算机设备和存储介质
WO2019144548A1 (fr) Procédé d'essai de sécurité, appareil, dispositif informatique et support d'informations
WO2020232883A1 (fr) Appareil et procédé de balayage de défauts de script, dispositif informatique et support d'informations
WO2021066954A1 (fr) Souscription à des dépendances dans des contrats intelligents
WO2021174817A1 (fr) Procédé et système d'audit automatisé des bases de données, dispositif et support d'informations
CN111488736B (zh) 自学习分词方法、装置、计算机设备和存储介质
CN114385760A (zh) 增量数据实时同步的方法、装置、计算机设备及存储介质
US20150020167A1 (en) System and method for managing files
WO2020211233A1 (fr) Procédé et dispositif pour éditer des données par lots, dispositif informatique et support d'informations
CN110941543A (zh) 日志处理方法、装置、计算机设备和存储介质
CN111444208B (zh) 一种数据更新方法及相关设备
CN112130759A (zh) 一种存储系统的参数配置方法、系统及相关装置
WO2020253044A1 (fr) Procédé et appareil de configuration de service, et dispositif informatique et support de stockage
CN115039082A (zh) 日志写入方法、装置、电子设备以及存储介质
US11941032B2 (en) Key name generation method and apparatus and non-transitory computer-readable storage medium
CN110321711A (zh) 检测应用服务器sql注入点的方法及系统
CN115391188A (zh) 一种场景测试用例生成方法、装置、设备及存储介质
CN112528334B (zh) 基于区块链网络的数据获取方法、装置以及计算机设备
CN115827691A (zh) 批量处理结果验证方法、装置、计算机设备、存储介质
CN111258871B (zh) 一种分布式文件系统的验证方法、装置、设备及存储介质
CN111258877B (zh) 首屏页面可见时间的检测方法、装置及电子设备

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: 19930889

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: 19930889

Country of ref document: EP

Kind code of ref document: A1