Internationalization processing method, device and equipment of user operation log and storage medium
By identifying the target language, monitoring user operations, and generating logs in the target language, combined with preset configurations and a message queue system, the multilingual internationalization problem of existing operation log systems is solved, realizing the internationalization of user operation logs and improving the system's performance and reliability.
Patent Information
- Application Number
- CN202411013419.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2044-07-26
AI Technical Summary
Existing operation log systems cannot effectively handle internationalization for multiple languages, especially when multiple language users share a single system, making it difficult to achieve proper internationalization of user operation log output.
By determining the target language, monitoring user operations, and generating user operation logs in the target language based on preset configurations, including defining user module operation descriptions and enumeration classes corresponding to multiple languages, using a message queue system to store the logs, and achieving internationalization processing for special fields.
It enables multilingual internationalization of both regular and special fields, improving system response performance and scalability, and ensuring the reliability and readability of logs.
Smart Images

Figure CN118885452B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of operation log processing, and particularly relates to a user operation log internationalization processing method and device, equipment and a storage medium. BACKGROUND
[0002] With the development of economy and the promotion of economic globalization, users using different languages can share a set of systems or maintain a set of systems, especially when it is necessary to view operation logs. In the existing solutions, operation logs are often output in one language.
[0003] Even if there are some methods that can output user operation logs in multiple languages, they only optimize the regular fields in multiple languages and cannot better complete the internationalization processing of user operation logs. SUMMARY
[0004] Therefore, embodiments of the present application aim to provide a user operation log internationalization processing method, device, equipment and storage medium to better process the internationalization of user operation logs.
[0005] The present application provides a user operation log internationalization processing method, which comprises the following steps:
[0006] determining a target language;
[0007] monitoring user operations;
[0008] generating a user operation log in the target language based on preset configurations and the user operations;
[0009] The preset configurations comprise: defining descriptions of user module operations corresponding to a plurality of preset languages, and defining enumeration classes corresponding to the plurality of preset languages.
[0010] The target language is one of the plurality of preset languages.
[0011] In some embodiments, generating the user operation log in the target language based on the preset configurations and the user operations comprises:
[0012] if the user operation is a new operation, recording new content.
[0013] In some embodiments, generating the user operation log in the target language based on the preset configurations and the user operations comprises:
[0014] if the user operation is an editing operation and the to-be-edited content of the editing operation does not exist, only recording that the editing operation is executed but fails.
[0015] When the user operation is an editing operation, and the to-be-edited content of the editing operation exists, only the field in which a change occurs in the to-be-edited content is recorded;
[0016] If the to-be-edited content contains an enumeration field, the enumeration field is converted into a field in the target language.
[0017] In some embodiments, based on the preset configuration and the user operation, a user operation log in the target language is generated, including:
[0018] When the user operation is a deletion operation, and the to-be-deleted content of the deletion operation does not exist, only that the deletion operation is executed but fails is recorded.
[0019] When the user operation is a deletion operation, and the to-be-deleted content of the deletion operation exists, only the unique identifier of the to-be-deleted content is recorded.
[0020] In some embodiments, based on the preset configuration and the user operation, a user operation log in the target language is generated, including:
[0021] A static field is used as a JSON object of the cached operation log.
[0022] In some embodiments, the method further includes:
[0023] A message queue system is used to send the user operation log to a preset storage unit, so as to realize log storage.
[0024] In some embodiments, the preset configuration further includes:
[0025] An enumeration class of module names is defined;
[0026] An enumeration class of permissions is defined;
[0027] An operation log class is defined;
[0028] An operation log tool class is defined;
[0029] An operation log parameter constant class is defined;
[0030] An enumeration class of special fields in a user is defined;
[0031] A database user operation record table and a user operation record class are defined;
[0032] An internationalized operation log audit interface and an implementation class thereof are defined.
[0033] The application also provides an internationalized processing device for a user operation log, including:
[0034] A determination module is configured to determine a target language;
[0035] The monitoring module is configured to monitor the user operation.
[0036] The generating module is configured to generate a user operation log in the target language based on the preset configuration and the user operation.
[0037] The preset configuration comprises: a description of user module operation corresponding to a preset plurality of languages, and an enumeration class corresponding to the preset plurality of languages.
[0038] The target language is one of the preset plurality of languages.
[0039] The present application also provides an electronic device comprising:
[0040] The processor and a memory for storing programs executable by the processor.
[0041] The processor is configured to implement the internationalization processing method of the user operation log by running the programs in the memory.
[0042] The present application also provides a computer readable storage medium having a computer program stored thereon, the computer program, when executed by a processor, causing the processor to perform the internationalization processing method of the user operation log.
[0043] The present application provides an internationalization processing method of a user operation log, which first determines a target language, monitors a user operation, generates a user operation log in the target language based on a preset configuration and the user operation, wherein the preset configuration comprises: a description of user module operation corresponding to a preset plurality of languages, and an enumeration class corresponding to the preset plurality of languages; and the target language is one of the preset plurality of languages. In this way, in the scheme provided by the present application, not only the description of user module operation corresponding to a preset plurality of languages is used to implement the internationalization processing of regular fields, but also the enumeration class corresponding to the preset plurality of languages is used to implement the internationalization processing of special fields. BRIEF DESCRIPTION OF DRAWINGS
[0044] The above and other objects, features and advantages of the present application will become more apparent from the following detailed description of embodiments of the present application taken in conjunction with the accompanying drawings. The accompanying drawings are intended to provide a further understanding of embodiments of the present application and are incorporated in and constitute a part of this specification, illustrate embodiments of the present application and serve to explain the present application, but do not limit the present application. In the drawings, like reference numerals refer to like elements or steps throughout.
[0045] Figure 1 is a flowchart of an internationalization processing method of a user operation log provided by an embodiment of the present application.
[0046] Figure 2 is a part flowchart of the method provided by an embodiment of the present application.
[0047] Figure 3 is a structure diagram of the user operation log internationalization processing device provided by an embodiment of the present application.
[0048] Figure 4 is a structure diagram of the electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0049] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0050] Summary of the application
[0051] With the development of economy and the promotion of economic globalization, users using different languages can share a set of system or maintain a set of system, especially when it is necessary to view the operation log. In the existing solution, the operation log is often output in one language.
[0052] Even if there are some methods that can output the user operation log in multiple languages, they only optimize the regular fields in multiple languages, and cannot better complete the internationalization processing of the user operation log.
[0053] To solve the above problems, the present application provides a solution, which performs special processing on enumeration fields, increases the readability of log internationalization, and introduces a message queue for operation log persistence, instead of the traditional direct persistence operation, so as to achieve the effect of traffic peak clipping.
[0054] After introducing the basic principle of the present application, the various non-limiting embodiments of the present application will be specifically introduced below with reference to the drawings.
[0055] Exemplary method
[0056] Figure 1 is a flowchart of the user operation log internationalization processing method provided by an embodiment of the present application. As shown in the figure, the method comprises the following contents. Figure 1
[0057] Step S110, determining a target language;
[0058] Specifically, the target language can be determined through user settings, browser language settings, system configuration or API calls. In this way, the language preferred by the user or the system default language can be identified to generate the operation log in the corresponding language.
[0059] Step S120, monitoring user operations;
[0060] Specifically, front-end event listeners (such as button clicks, form submissions, etc.) and back-end logging mechanisms can be used to monitor user operations. All operations performed by the user in the system, such as creation, update, deletion, etc., are captured and recorded.
[0061] Step S130, generating a user operation log in the target language based on the preset configuration and the user operation;
[0062] The preset configuration includes: defining descriptions of user module operations corresponding to a plurality of preset languages, and defining enumeration classes corresponding to a plurality of preset languages.
[0063] The target language is one of the plurality of preset languages.
[0064] The plurality of preset languages can include Chinese, English, Spanish, French, German, Japanese and other languages. In some embodiments provided in the present application, the plurality of preset languages can only include Chinese and English. In this way, the scheme provided in the present application can be facilitated.
[0065] In the scheme provided in the present application, not only "defining descriptions of user module operations corresponding to a plurality of preset languages" to implement internationalization processing of regular fields, but also "defining enumeration classes corresponding to a plurality of preset languages" to implement internationalization processing of special fields.
[0066] In some embodiments, referring to Figure 2 , generating a user operation log in the target language based on the preset configuration and the user operation includes:
[0067] If the user operation is a new operation, record the new content.
[0068] Specifically, all key information of the new entity is captured, such as entity type, attribute value, etc., and the information is recorded using a log template in the target language. When the user performs a new operation, the system should record the detailed information of the new content.
[0069] When the user operation is an edit operation, and the content to be edited does not exist, then only record the execution of the edit operation and failure; when the user operation is an edit operation, and the content to be edited exists, then only record the fields that have changed in the content to be edited; wherein, if there are enumeration fields in the content to be edited, then convert the enumeration fields into fields in the target language.
[0070] Check the database or data store to confirm whether the entity to be edited exists, and if not, generate a failed log entry. That is, if the content attempted to be edited does not exist, then record a log of the execution of the edit operation but the operation failed. If the content to be edited exists, compare the state of the entity before and after the edit to determine which fields have changed, and record those changes. That is, only record the fields that have changed.
[0071] When the user operation is a delete operation, and the content to be deleted does not exist, then only record the execution of the delete operation and failure; when the user operation is a delete operation, and the content to be deleted exists, then only record the unique identifier of the content to be deleted.
[0072] Specifically, before performing the delete operation, check whether the entity exists, and if not, generate a failed log entry. If the content attempted to be deleted does not exist, then record a log of the execution of the delete operation but the operation failed. If the content attempted to be deleted exists, record its key attributes before deleting the entity, and record this information in the log. Record the unique identifier of the content to be deleted, which, in a delete operation, can mean recording the key information of the entity that is about to be deleted.
[0073] In some embodiments, based on the preset configuration and the user operation, generate a user operation log in the target language, including: using static fields as JSON objects for caching operation logs.
[0074] Specifically, using static fields as JSON objects for caching operation logs is a performance optimization method, especially in applications that require frequent access to log configuration information. The following are the steps and examples of how to implement this mechanism:
[0075] Define a static field in the related utility or service class to store the JSON object of the operation log. This field is shared by all instances and once initialized, it does not need to load data from files or databases again. When the class is loaded or the first time the log configuration is used, read the JSON data of the operation log from files, databases, or any other storage medium and parse it into a JSON object, storing it in the static field. Wherever the operation log information is needed, directly get the JSON object from the static field without reloading every time. This can significantly reduce I / O operations and improve performance. If the JSON object of the operation log needs to be modified in a multi-threaded environment (although it is usually read-only), ensure that access to the static field is thread-safe. You can use the synchronized keyword or concurrent collections such as ConcurrentHashMap. This way, you can ensure that the operation log configuration is loaded only once, and all subsequent log generation can quickly obtain the required information from the cached JSON object.
[0076] In some embodiments, the application also provides a method for sending the user operation log to a preset storage unit using a message queue system to achieve log storage.
[0077] It should be noted that using a message queue system to send the user operation log to a preset storage unit to achieve log storage can improve the performance and reliability of the application and log processing, and can achieve traffic peak shaving. The specific implementation is as follows:
[0078] Select a message queue system such as RabbitMQ, Kafka, or Amazon SQS and integrate it into the application. Define the message format of the user operation log, which can be JSON, XML, or any other format to ensure the structure and consistency of the log data. In the application, when the user operation log is generated, it is encapsulated as a message and sent out through the message queue system's producer API. Set up one or more consumers to listen to and process messages in the queue. The consumer stores the received log message after processing to a preset storage unit such as a database. Configure the message queue to ensure the reliability and persistence of the message, such as using an acknowledgment mechanism and persistent messages.
[0079] In this way, the generation and storage of the user operation log are decoupled, improving the response performance and scalability of the system. At the same time, the message queue provides buffering capability, allowing stable operation even under high load conditions.
[0080] Further, the preset configuration further includes:
[0081] Define a module name enumeration class;
[0082] Define a permission enumeration class;
[0083] Define an operation log class;
[0084] Define an operation log utility class;
[0085] Define an operation log parameter constant class;
[0086] Define an enumeration class for special fields in the user;
[0087] Define the database user operation record table and user operation record class;
[0088] Define the internationalized operation log auditing interface and its implementation class.
[0089] The following examples illustrate the solution provided in this application:
[0090] 1. Define the internationalization file operationLog.json
[0091] Define the Chinese and English descriptions for user module add, delete, modify and other operations. The key values SCLOUD_USER_create, SCLOUD_USER_update and SCLOUD_USER_delete correspond to the permission strings for the user add, edit and delete interfaces, and the value values correspond to the Chinese and English descriptions and the fields that need to be recorded.
[0092] When adding a new field, separate the fields to be recorded using the $$ placeholder; when editing, separate the original field value to be recorded from the modified field value using the $$ placeholder; when deleting a field, separate the fields to be recorded using the $$ placeholder.
[0093] The code is as follows:
[0094]
[0095] 2. Define a module name enumeration class `ModuleNameEnum` and a permission enumeration class `PermissionEnum`.
[0096] The ModuleNameEnum class is used to define a unique ID identifier and module name for each module.
[0097] The code is as follows:
[0098] public enum ModuleNameEnum{
[0099] USER(10000,"User Management");
[0100] private Integer id;
[0101] private String name;
[0102] }
[0103] The PermissionEnum class is used to define the permission string, interface description, and module ID of an interface.
[0104] public enum PermissionEnum{
[0105] SCLOUD_USER_create("SCLOUD_USER_create","Create User",ModuleNameEnum.USER.getId()),
[0106] SCLOUD_USER_update("SCLOUD_USER_update","Edit User",ModuleNameEnum.USER.getId()),
[0107] SCLOUD_USER_delete("SCLOUD_USER_delete","Delete User",ModuleNameEnum.USER.getId());
[0108] private String name;
[0109] private String desc;
[0110] private Integer moduleId;
[0111] }
[0112] 3. Define the operation log class OperationLog and the operation log utility class OperationLogUtil
[0113] The operation log class OperationLog corresponds to the Java class converted from operationLog.json. It contains three properties: the interface permission string "action", the Chinese key-value pair "zh", and the English key-value pair "en".
[0114] The code is as follows:
[0115] @Data
[0116] public class OperationLog implements Serializable{
[0117] private static final long serialVersionUID=1L;
[0118] private String action;
[0119] private String zh;
[0120] private String en;
[0121] }
[0122] OperationLogUtil
[0123] Use static field as cache operation log JSON object, avoid read file multiple times.
[0124] getLogDesc and getEnLogDesc method: get operation log description information by passing in the permission enumeration (PermissionEnum) and the need to record the log parameter composed of the map set (logParam). getLogDesc returns Chinese and English description, getEnLogDesc only returns English description.
[0125] replace method: replace placeholder ($xxx$) in template content, use parameter map value to replace corresponding placeholder.
[0126] extract method: extract the part of the operation log template that has replaced the placeholder, discard the unused placeholder fragment.
[0127] getLogTemplate method: read the operation log template of the specified permission string (permissionKey) from the operation log template file (operationLog.json), return an OperationLog object containing Chinese and English description.
[0128] readOperationLogFromResource method: read the operationLog.json file under the classpath and convert it to a JSONObject object.
[0129] Code as follows:
[0130]
[0131]
[0132]
[0133]
[0134]
[0135] 4. Define the operation log parameter constant class
[0136] Use to define the field name in the entity class of the operation module and some symbol constants.
[0137] The code is as follows:
[0138]
[0139] 5. Define the gender enumeration class
[0140] Used to define the gender enumeration class, and provide a method to query the enumeration class according to the enumeration value. The code is as follows:
[0141]
[0142]
[0143] 6. Define the database user operation record table and user operation record class
[0144] The user operation record table contains the fields of primary key id, module id, operation result, Chinese operation description, English operation description, login ip, username, user id, and operation time.
[0145] The code is as follows:
[0146]
[0147]
[0148] 7. Define the internationalization operation log audit interface, implementation class, and kafka message sending and consumption message, and perform user operation log persistence operation.
[0149] Define the audit interface of the internationalization operation log.
[0150] The code is as follows:
[0151]
[0152]
[0153] The operation log storage in database message is sent through the use of Kafka's kafkaTemplate, and the success or failure case is handled asynchronously according to the sending result, and detailed log information is recorded.
[0154] The code is as follows:
[0155]
[0156]
[0157] The asynchronous processing of the received messages from the Kafka topic is implemented, and the operation log storage in database business processing is performed according to the message content.
[0158] @KafkaListener: This is an annotation provided by Spring Kafka, which indicates that a method is a Kafka message listener.
[0159] groupId="#{spring.kafka.consumer.group-id:OPT_LOG_GROUP}": Specifies the consumer group ID, which uses Spring's SpEL expression to dynamically get the value of the property spring.kafka.consumer.group-id, and defaults to "OPT_LOG_GROUP" if not configured.
[0160] topics=MQConstant.OPT_LOG_QUEUE_NAME: Specifies the Kafka topic name to be listened to, which is obtained from the constant MQConstant.OPT_LOG_QUEUE_NAME.
[0161] containerFactory="batchFactory": Specifies the Kafka message listener container factory to be used, which is a custom batch message container factory "batchFactory" here.
[0162] processMessages: This is a method for processing received Kafka messages, and the parameter records is a ConsumerRecords object containing a batch of received message records from the Kafka topic.
[0163] processMessage: This method is used to specifically process the received message message. First, the received message content is logged. Then, the message message is parsed into a User OperateLog type object record using the JSON parsing tool class JSON.parseObject. If the parsing is successful and the record object and its moduleId are not empty, further processing is performed: check whether the user information is contained in the message, and if the user information is missing, record an error log and return. Otherwise, call userOperateLogMapper.insert(record) to insert the message record into the database, completing the operation log storage operation in the database.
[0164] The code is as follows:
[0165]
[0166]
[0167] 8. User addition, deletion, and modification operations
[0168] When a user is added, the user name field is recorded, and the user operation log is stored in the database.
[0169] finally{...}: The code in the finally block will be executed regardless of whether an exception is thrown in the try block.
[0170] Here, the finally block is used to record the operation log:
[0171] A HashMap type logParam is created to store log parameters, such as user name information.
[0172] The OperationLogUtil.getLogDesc method is used to obtain operation log description information, and an OperationLog object operationLog is created.
[0173] The logService.audit method is called to record the audit log, recording user operations, including the number of inserted rows, request information, operation log Chinese and English descriptions, and module ID.
[0174] The code is as follows:
[0175]
[0176] When a user is modified, the changed name field is recorded, and the user operation log is stored in the database.
[0177] finally{...}: The code in the finally block is executed whether an exception is thrown in the try block or not.
[0178] Here, the operation log is recorded using the finally block:
[0179] The OperationLog and enOperationLog objects are created to record the operation log description in Chinese and English, respectively.
[0180] If the gender information is included in the log parameter (logParam.get(LogParamConst.GENDER) is not null), it is converted to the corresponding English name.
[0181] convertLogParam: This is a private method that converts the user object to the log parameter logParam.
[0182] First, the old user information oldUser in the database is queried by the user id.
[0183] If the old user information is empty, a warning log is recorded and LogParamConst.NAME in logParam is set to the user's ID.
[0184] If the user's name, phone, or gender is different from the old user information, the corresponding change information is stored in logParam using LogParamConst.NEW_NAME, LogParamConst.NEW_PHONE, and LogParamConst.NEW_GENDER to store the new values, and LogParamConst.NAME, LogParamConst.PHONE, and LogParamConst.GENDER to store the old values.
[0185] The code is as follows:
[0186]
[0187]
[0188] When deleting a user, the user name field is recorded, and the user operation log is stored in the database.
[0189] Query by user id
[0190] finally{...}: The code in the finally block is executed whether an exception is thrown in the try block or not.
[0191] Here, the operation log is recorded using the finally block:
[0192] Put name into logParam as the parameter of log record.
[0193] Create OperationLog object operationLog to get the operation log description through OperationLogUtil.getLogDesc method.
[0194] Call logService.audit method to record the audit log, record the affected row number of the delete operation, request information, Chinese and English description of the operation log and module ID.
[0195] First, query the old user information oldUser in the database through the user id.
[0196] If the old user information is empty, record the warning log and set LogParamConst.NAME in logParam as the ID of the user.
[0197] If the old user information is not empty, record the warning log and set LogParamConst.NAME in logParam as the name of the user.
[0198] The code is as follows:
[0199]
[0200] Exemplary apparatus
[0201] The device embodiment of the present application can be used to execute the method embodiment of the present application. For details not disclosed in the device embodiment of the present application, please refer to the method embodiment of the present application.
[0202] Figure 3 As shown in the figure, the device includes: Figure 3 As shown in the figure, the device includes:
[0203] The determining module 31 is configured to determine a target language.
[0204] The monitoring module 32 is configured to monitor a user operation.
[0205] The generating module 33 is configured to generate a user operation log in the target language based on a preset configuration and the user operation.
[0206] The preset configuration includes: defining descriptions of user module operations corresponding to a plurality of preset languages, and defining enumeration classes corresponding to the plurality of preset languages.
[0207] The target language is one of the plurality of preset languages.
[0208] Exemplary electronic device
[0209] Below, an electronic device according to an embodiment of the present application will be described with reference to Figure 4 FIG. 1 illustrates a block diagram of an electronic device according to an embodiment of the present application. Figure 4 FIG. 1 illustrates a block diagram of an electronic device according to an embodiment of the present application.
[0210] As shown in FIG. 4, the electronic device 400 includes one or more processors 410 and a memory 420. Figure 4 The processor 410 can be a central processing unit (CPU) or other form of processing unit having data processing and / or instruction executing capabilities, and can control other components in the electronic device 400 to perform desired functions.
[0211] The memory 420 can include one or more computer program products that can include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory, for example, can include random access memory (RAM), cache memory, and / or the like. The non-volatile memory, for example, can include read-only memory (ROM), hard disk, flash memory, and / or the like. One or more computer program instructions can be stored on the computer-readable storage media, which the processor 410 can execute to implement the above-described user operation log internationalization processing method of various embodiments of the present application and / or other desired functions. Various contents, such as category correspondence, and the like, can also be stored in the computer-readable storage media.
[0212] In one example, the electronic device 400 can further include an input device 430 and an output device 440, which are interconnected through a bus system and / or other forms of connection mechanisms (not shown).
[0213] In addition, the input device 430 can further include, for example, a keyboard, a mouse, an interface, and the like. The output device 440 can output various information, including analysis results, and the like, to the outside. The output device 440 can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.
[0214] Of course, in order to simplify,
[0215] only some of the components related to the present application in the electronic device are shown, and components such as buses, input / output interfaces, and the like are omitted. In addition, the electronic device can further include any other appropriate components according to specific application cases. Figure 4
[0216] Exemplary computer program product and computer readable storage medium
[0217] In addition to the method and the device described above, the embodiments of the present application can also be a computer program product, which includes computer program instructions, which, when executed by a processor, cause the processor to perform the steps of the internationalization processing method of the user operation log according to various embodiments of the present application described in the above "Exemplary Method" section of the present specification.
[0218] The computer program product can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++, etc., and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device or entirely on the remote computing device or server.
[0219] In addition, the embodiments of the present application can also be a computer readable storage medium, which stores computer program instructions, which, when executed by a processor, cause the processor to perform the steps of the internationalization processing method of the user operation log according to various embodiments of the present application described in the above "Exemplary Method" section of the present specification.
[0220] The computer readable storage medium can be any combination of one or more computer readable media. The computer readable medium can be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can include, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the above. More specific examples (a non-exhaustive list) of the computer readable storage medium include an electrical connection having one or more wires, a portable disc, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0221] The above description is given for illustrative and descriptive purposes. In addition, this description is not intended to limit the embodiments of the present application to the forms disclosed herein. Although a number of example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.
Claims
1. A method for internationalization processing of a user operation log, characterized by, The method comprises the following steps: determining a target language; monitoring user operations; generating a user operation log in the target language based on preset configurations and the user operations; wherein the preset configurations comprise: defining descriptions of user module operations corresponding to a plurality of preset languages, and defining enumeration classes corresponding to the plurality of preset languages; the target language is one of the plurality of preset languages; generating the user operation log in the target language based on the preset configurations and the user operations comprises: when the user operation is an editing operation, and the content to be edited in the editing operation does not exist, only record that the editing operation is executed and fails; when the user operation is an editing operation, and the content to be edited in the editing operation exists, only record the fields that have changed in the content to be edited; wherein if there is an enumeration field in the content to be edited, the enumeration field is converted into a field in the target language; the preset configurations further comprise: defining a module name enumeration class; defining a permission enumeration class; defining an operation log class; defining an operation log tool class; defining an operation log parameter constant class; defining an enumeration class of special fields in a user; defining a database user operation record table and a user operation record class; defining an internationalized operation log audit interface and an implementation class thereof; when the user operation is a deletion operation, and the content to be deleted in the deletion operation does not exist, only record that the deletion operation is executed and fails; when the user operation is a deletion operation, and the content to be deleted in the deletion operation exists, only record the unique identifier of the content to be deleted.
2. The method of claim 1, wherein, generating the user operation log in the target language based on the preset configurations and the user operations comprises: if the user operation is a new operation, record the newly created content.
3. The method of claim 1, wherein, generating the user operation log in the target language based on the preset configurations and the user operations comprises: using a static field as a JSON object for caching operation logs.
4. The method of claim 1, wherein, The method further comprises: using a message queue system to send the user operation log to a preset storage unit to realize log storage.
5. An apparatus for internationalization processing of a user operation log, characterized by comprising: The method comprises the following steps: determining a target language; monitoring user operations; generating a user operation log in the target language based on preset configurations and the user operations; wherein the preset configurations comprise: defining descriptions of user module operations corresponding to a plurality of preset languages, and defining enumeration classes corresponding to the plurality of preset languages; the target language is one of the plurality of preset languages; generating the user operation log in the target language based on the preset configurations and the user operations comprises: when the user operation is an editing operation, and the content to be edited in the editing operation does not exist, only record that the editing operation is executed and fails; when the user operation is an editing operation, and the content to be edited in the editing operation exists, only record the fields that have changed in the content to be edited; wherein if there is an enumeration field in the content to be edited, the enumeration field is converted into a field in the target language; the preset configurations further comprise: defining a module name enumeration class; defining a permission enumeration class; defining an operation log class; defining an operation log tool class; defining an operation log parameter constant class; defining an enumeration class of special fields in a user; Defining a database user operation record table and a user operation record class; Defining an internationalized operation log audit interface and an implementation class thereof; When the user operation is a deletion operation, and the content to be deleted does not exist, then only record the execution of the deletion operation and failure; When the user operation is a deletion operation, and the content to be deleted exists, then only record the unique identifier of the content to be deleted.
6. An electronic device, comprising: Comprise: A processor, and a memory for storing programs executable by the processor; The processor is used to realize the internationalization processing method of the user operation log as claimed in any one of claims 1 to 4 by running the program in the memory.
7. A computer-readable storage medium, characterized in that, The computer program is stored on the computer readable storage medium, and the computer program makes the processor execute the internationalization processing method of the user operation log as claimed in any one of claims 1 to 4 when the processor runs.
Citation Information
Patent Citations
Internationalization method, system and equipment of logs and computer readable storage medium
CN108897742A