A Web-based method, system, device, and storage medium for recording and querying system logs.
By creating a table in the database to store system log information and writing the corresponding hierarchical structure, accurate recording of user behavior, IP address, and time is achieved. This solves the problem of insufficient recording of user behavior information in existing system log processing methods, improves the system's traceability capability, and is applicable to web browsers in various environments.
Patent Information
- Application Number
- CN202210284408.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-22
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2042-03-22
AI Technical Summary
In existing technologies, the system log processing methods of web front-ends lack accurate recording of user behavior information, especially IP address and time information, resulting in insufficient system traceability capabilities.
Create a table in the database to store system log information, write the data access layer, business processing layer and control layer, implement methods for recording and querying system log records using the MyBatis framework, use JavaScript to implement table display of system log records and query system log records, and use SystemLogServiceImpl to implement the interface and DAO layer to record user behavior information, including operator, operation IP and operation time, and display it in table form on the front end.
It enables accurate recording of user behavior, IP address, and time, improves the system's traceability capabilities, supports usage requirements in various environments, and meets the needs of web browsers on both PC and mobile devices.
Smart Images

Figure CN114610593B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a web-based system log recording and querying method, system, device, and storage medium, belonging to the field of software development technology. Background Technology
[0002] With the development and popularization of the internet, people are using it more and more frequently. Correspondingly, software development now requires more than just considering functionality and efficiency; it also necessitates the development of system logging capabilities. Since it's impossible to manually monitor the system 24 / 7, logs are crucial for monitoring and troubleshooting in the operating environment. During system design, development, and implementation, it's essential to constantly monitor log output, recording requests received and processed by the web server, as well as various user operations. This will play a vital role in future system monitoring and anomaly analysis. By statistically analyzing and synthesizing logs, we can effectively understand the website's operational status, identify and eliminate error causes, understand customer access distribution, and better strengthen system maintenance and management. The same principle applies to conference systems.
[0003] Chinese patent document CN111581051A discloses a system operation log processing method, apparatus, device and medium based on a web front-end. It proposes a system log processing method that has a method for establishing a database on the front end. However, the system logs recorded by this method lack IP information, and the database built on the front end has poor security. Summary of the Invention
[0004] This invention addresses the technical problems in the prior art by providing a web-based method for recording diaries in a conferencing system. This method can accurately record user behavior information, time, and IP address, thereby improving the system's traceability capabilities.
[0005] The present invention also provides a web-based system for recording and querying system logs, computer equipment, and storage medium.
[0006] Terminology Explanation:
[0007] 1. Meeting System: A multi-functional meeting software system that uses the MVC integrated design pattern to achieve decoupling, for recording meeting information, retrieving meeting records, monitoring meeting screens, and reminding participants.
[0008] 2. MyBatis Framework: A Java-based persistence layer framework that supports customized SQL, stored procedures, and advanced mapping. MyBatis avoids almost all JDBC code and manual parameter setting and result set retrieval. MyBatis can use simple XML or annotations to configure and map native information, mapping interfaces and Java POJOs (Plain Ordinary Java Objects) to records in the database.
[0009] 3. SystemLogServiceImpl: impl is short for implement, which is the implementation class file of the interface. In general, in a three-tier development, the service layer and the dao layer will have interfaces and their implementation classes. In order to better manage and develop the project, the interface is usually put into a package called the Impl file, and the implementation class is placed in a sub-package of this package.
[0010] 4. systemLogDao: The Dao layer is responsible for the data persistence layer. The code that interacts with the database is encapsulated here. It is responsible for accessing the database, performing data operations, obtaining the result set, and then retrieving the data from the result set, encapsulating it into a VO class object, and returning it to the service layer.
[0011] 5. systemLogService: The Service layer is responsible for business processing, such as obtaining connections, closing database connections, and transaction rollback. Its design is suitable for handling complex business logic, can operate on multiple tables, and supports the reuse of the presentation layer, unit testing, and business logic assembly.
[0012] The technical solution adopted in this invention is as follows:
[0013] A web-based system log recording and querying method is provided to record the time, IP address, and action of each user's behavior, as well as to perform query operations by user. The specific implementation process is as follows:
[0014] Step 1: Create a table in the database to store system log information;
[0015] Step 2: Create an entity class for system log information;
[0016] Step 3: Write the data access layer to interact with the tables created in the database that store system log information;
[0017] Step 4: Write the business logic layer and call the data access layer methods to implement the functionality;
[0018] Step 5: Write the control layer, call the business processing layer methods, and respond to and process the front-end's log recording and query requests;
[0019] Step 6: Develop the front-end interface to display the system logs in tabular format;
[0020] Step 7: Keep a diary;
[0021] Step 8: Diary query.
[0022] According to a preferred embodiment of the present invention, in step 1, the table storing system log information is set as t_work, and the fields include operationId, operator, operationIp, operationTime, and operation, which respectively represent operation number, operator, operation address, operation time, and operation record, and the types are int, varchar, varchar, varchar, varchar, and varchar, respectively.
[0023] According to a preferred embodiment of the present invention, the specific implementation process of step 2 is as follows:
[0024] Create an entity class SystemLog for the system log information object. The properties of the entity class SystemLog are the same as the fields of the table in the database that stores the system log information. The varchar type in the table that stores the system log information corresponds to the String type in the entity class SystemLog, and the int type in the table that stores the system log information corresponds to the int type in the entity class SystemLog. Write the corresponding get methods, set methods, parameterless constructor and parameterized constructor.
[0025] According to a preferred embodiment of the present invention, the specific implementation process of step 3 is as follows:
[0026] In the data access layer, a data access interface is created. The methods in the data access interface are implemented using database statements in an XML file. Specifically, this means creating a SystemLog interface file and implementing it in the SystemLog.xml file based on the MyBatis framework. The methods in the data access interface include: addSystemLog(), used to add system log information; querySystemLogAll(), used to retrieve all system log information; and querySystemLogByOperator(), used to retrieve system log information for a specified operator.
[0027] According to a preferred embodiment of the present invention, the specific implementation process of step 4 is as follows:
[0028] The methods in the business processing layer call the corresponding methods in the data access layer to implement their functions; specifically, this means: creating the SystemLogService interface and implementing it in the SystemLogServiceImpl file, with attributes including systemLogDao, of type SystemLogDao, and methods including: setSystemLogDao(), used to set the entity class's setter method; addSystemLog(), used to add system log information; querySystemLogAll(), used to retrieve all system log information; and querySystemLogByOperator(), used to retrieve log information for a specified operator.
[0029] According to a preferred embodiment of the present invention, the specific implementation process of step 5 is as follows:
[0030] Create a SystemLogController class with a systemLogService property of type SystemLogService. Write a getSystemLog() method that responds to requests from the front-end to query system logs, then calls the querySystemLogAll() method in the business logic layer and returns it to the front-end. Add a logging method to the controller layer of the request method that needs to log system logs.
[0031] A further preferred approach is to add a logging method to the controller layer of the request method that needs to log the system. The specific implementation process is as follows:
[0032] a. Obtain the user account name passed in the front-end request information;
[0033] b. Obtain the IP address. The specific method is as follows: Obtain an HttpServletRequest object based on the front-end request, create a String type variable, and assign the X-Forwarded-For extension header of the HttpServletRequest object to the String type variable. The user's real IP address is the first valid IP string that is not unknown in X-Forwarded-For.
[0034] c. To obtain the current time, the specific method is to use the System.currentTimeMillis() method to obtain the standard time.
[0035] d. Instantiate a systemLog class, which includes three parameters: user account name, IP address, and current time. Call the addSystemLog() method in the business processing layer to save the log to the database. The system log information is now added.
[0036] A further preferred method for obtaining the user's real IP address is:
[0037] Under the conditions that the variable value is not empty, the length is not zero, and the value is not equal to "unknown", the variable value is sequentially assigned to the Proxy-Client-IP extension header, WL-Proxy-Client-IP extension header, HTTP_CLIENT_IP extension header, and HTTP_X_FORWARDED_FOR extension header in HttpServletRequest. The getRemoteAddr() method is then called on the HttpServletRequest object to obtain the user's real IP address.
[0038] According to a preferred embodiment of the present invention, step 6 is implemented as follows:
[0039] A SystemLogTable table is placed on the front-end interface, initially empty. After receiving system log information from the backend, it is stored in the data field. JavaScript is used to retrieve the element by its id from the SystemLogTable. The specific implementation process is as follows:
[0040] First, create a th element and insert it into the SystemLogTable as the table header. The table header includes the operator, the IP address of the operator, the time of the operation, and the operation record.
[0041] Then, loop through the system log information, create td elements as cells in the loop body, use the "data.attribute" method to get the attribute values, match them one by one with the table header, and insert them into SystemLogTable;
[0042] Finally, all system log information is displayed.
[0043] According to a preferred embodiment of the present invention, the specific implementation process of step 7 is as follows:
[0044] When a certain operation occurs on the front end, a request is sent to the back end. In the request-response method, an entity class SystemLog is instantiated. The parameters of the entity class SystemLog include the operator, the operation time, the operation IP, and the operation content. The operator is obtained directly from the request parameters, the operation IP is obtained by calling the IP's get method, the operation time is obtained by calling the operation time's get method, and the operation content is set in advance according to the specific content of the operation.
[0045] According to a preferred embodiment of the present invention, step 8 is implemented as follows:
[0046] When querying system log information, the front-end interface initiates a query request. In the request-response method, the querySystemLogAll() method of systemService is called to obtain all system log information and store it in the systemLogs variable of type List. This variable is then returned to the front-end interface, which iterates through the List variable to read all system log information and display it on the interface.
[0047] When it is necessary to retrieve information in the system logs based on the operator, the front-end interface initiates a retrieval request, which includes the operator's name. In the request-response method, the operator's name is used as a parameter to call the querySystemLogByRealName() method of systemService to obtain all system logs for the requested operator and store them in a List variable systemLogsFiltered. This variable is then returned to the front-end interface, which iterates through this List variable to read all system log information and display it on the interface.
[0048] A web-based system for recording and querying system logs includes a creation unit, a data access layer writing unit, a business processing layer writing unit, a control layer writing unit, a front-end interface writing unit, a log recording unit, and a log query unit.
[0049] The creation unit is configured to: create a table in the database to store system log information, and create an entity class for system log information;
[0050] The data access layer writing unit is configured to: write a data access layer that interacts with tables created in the database that store system log information.
[0051] The business processing layer writing unit is configured to: write the business processing layer and call the data access layer methods to implement the functions;
[0052] The control layer writing unit is configured to: write the control layer, call the business processing layer methods, and respond to the log recording and query requests from the processing front end;
[0053] The front-end interface writing unit is configured to: write a front-end interface to display system logs in tabular form;
[0054] The diary recording unit is configured as: diary recording;
[0055] The diary query unit is configured as: diary query.
[0056] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement steps of a Web-based system log recording and querying method.
[0057] A computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement steps of a Web-based system log recording and querying method.
[0058] The beneficial effects of this invention are:
[0059] 1. In the conference-related web system, when users perform operations, user behavior, IP address and time can be effectively and accurately recorded and then stored in the server database. At the same time, authorized users can manually query the system logs to determine user behavior and perform requirements analysis, etc.
[0060] 2. This method is also applicable to other systems;
[0061] 3. The meeting system log recording and query method of the present invention can be applied to PC or mobile web browsers, and can meet the usage needs in a variety of environments. Attached Figure Description
[0062] Figure 1 This is a flowchart illustrating the Web-based system log recording and query method of the present invention. Detailed Implementation
[0063] The present invention will be further described below with reference to the accompanying drawings and embodiments, but is not limited thereto.
[0064] Example 1
[0065] A web-based system log recording and querying method is provided to record the time, IP address, and action of each user's behavior, as well as to perform query operations by user, such as... Figure 1 As shown, the specific implementation process is as follows:
[0066] Step 1: Create a table in the database to store system log information;
[0067] Step 2: Create an entity class for system log information;
[0068] Step 3: Write the data access layer to interact with the tables created in the database that store system log information;
[0069] Step 4: Write the business logic layer and call the data access layer methods to implement the functionality;
[0070] Step 5: Write the control layer, call the business processing layer methods, and respond to and process the front-end's log recording and query requests;
[0071] Step 6: Develop the front-end interface to display the system logs in tabular format;
[0072] Step 7: Keep a diary;
[0073] Step 8: Diary query.
[0074] Example 2
[0075] The difference between the Web-based system log recording and query method described in Example 1 and the following is:
[0076] In step 1, the table storing system log information is set as t_work, with fields including operationId, operator, operationIp, operationTime, and operation, which represent operation number, operator, operation address, operation time, and operation record, respectively, and have types of int, varchar, varchar, varchar, varchar, and varchar.
[0077] The specific implementation process of step 2 is as follows:
[0078] Create an entity class SystemLog for the system log information object. The properties of the entity class SystemLog are the same as the fields of the table in the database that stores the system log information. The varchar type in the table that stores the system log information corresponds to the String type in the entity class SystemLog, and the int type in the table that stores the system log information corresponds to the int type in the entity class SystemLog. Write the corresponding get methods, set methods, parameterless constructor and parameterized constructor.
[0079] To ensure data security, attributes in the class are set to private attributes. Private attributes cannot be directly accessed; therefore, a `get()` method is written to retrieve attribute values. Its input is empty, and the return value is the corresponding attribute value. A `set()` method is written to modify attribute values. Its input is the new value, and the return value is empty. Attributes here include operation time, IP address, etc. Both parameterless and parameterized constructors are used to instantiate a class. The former sets default values for attributes, while the latter assigns values based on the number and type of parameters. The method that assigns values to all parameters is called a full-parameter constructor. In addition to parameterless and full-parameter constructors, partial-parameter constructors are also written, including those for operation time, IP address, operator, and operation content. When adding system logs, a `SystemLog` class is instantiated to store log information.
[0080] The specific implementation process of step 3 is as follows:
[0081] In the data access layer, a data access interface is created. The methods within this interface are implemented using database statements in an XML file. Specifically, this involves creating a SystemLog interface file and implementing it in the SystemLog.xml file based on the MyBatis framework. The methods in the data access interface include: addSystemLog(), used to add system log information; implemented using the INSERT statement from the CRUD operations on the data warehouse in the XML file; querySystemLogAll(), used to retrieve all system log information; implemented using the SELECT * FROM table_name ORDER BY ID DESC statement from the CRUD operations on the data warehouse in the XML file; and querySystemLogByOperator(), used to retrieve system log information for a specified operator. The implementation is also done using the SELECT * FROM table_name ORDER BY ID DESC statement from the CRUD operations on the data warehouse in the XML file.
[0082] The specific implementation process of step 4 is as follows:
[0083] The methods in the business processing layer call the corresponding methods in the data access layer to implement their functions; specifically, this means: creating the SystemLogService interface and implementing it in the SystemLogServiceImpl file, with attributes including systemLogDao, of type SystemLogDao, and methods including: setSystemLogDao(), used to set the entity class's setter method; addSystemLog(), used to add system log information; querySystemLogAll(), used to retrieve all system log information; and querySystemLogByOperator(), used to retrieve log information for a specified operator.
[0084] The specific implementation process of step 5 is as follows:
[0085] Create a SystemLogController class with a systemLogService property of type SystemLogService. Write a getSystemLog() method that responds to requests from the front-end to query system logs, then calls the querySystemLogAll() method in the business logic layer and returns it to the front-end. Add a logging method to the controller layer of the request method that needs to log system logs.
[0086] Add a logging method to the controller layer of the request method that needs to log the system. The specific implementation process is as follows:
[0087] a. Obtain the user account name passed in the front-end request information;
[0088] b. Obtaining the IP address: Based on the front-end request, obtain an HttpServletRequest object, create a String variable, and assign the X-Forwarded-For header of the HttpServletRequest object to the String variable. The user's real IP address is the first valid IP string that is not "unknown" in the X-Forwarded-For header. The method to obtain the user's real IP address is as follows: To obtain the real IP address, under the conditions that the variable value is not empty, the length is not zero, and the value is not equal to "unknown", assign the variable value sequentially to the Proxy-Client-IP header, WL-Proxy-Client-IP header, HTTP_CLIENT_IP header, and HTTP_X_FORWARDED_FOR header in the HttpServletRequest object. Then, call the getRemoteAddr() method on the HttpServletRequest object to obtain the user's real IP address.
[0089] c. To obtain the current time, the specific method is as follows: obtain the standard time through the System.currentTimeMillis() method; this method is not affected by the time zone, and the result is in timestamp format. In Java, instantiate a SimpleDateFormat class with parameters yyyy-MM-dd HH-mm-ss, and pass the obtained timestamp as a parameter to the instance class to obtain the current time in the format of year, month, day, hour, minute, and second.
[0090] d. Instantiate a systemLog class, which includes three parameters: user account name, IP address, and current time. Call the addSystemLog() method in the business processing layer to save the log to the database. The system log information is now added.
[0091] The specific implementation process of step 6 is as follows:
[0092] A SystemLogTable table is placed on the front-end interface, initially empty. After receiving system log information from the backend, it is stored in the data field. JavaScript is used to retrieve the element by its id from the SystemLogTable. The specific implementation process is as follows:
[0093] First, create a th element and insert it into the SystemLogTable as the table header. The table header includes the operator, the IP address of the operator, the time of the operation, and the operation record.
[0094] Then, loop through the system log information, create td elements as cells in the loop body, use the "data.attribute" method to get the attribute values, match them one by one with the table header, and insert them into SystemLogTable;
[0095] Finally, all system log information is displayed.
[0096] The specific implementation process of step 7 is as follows:
[0097] When a front-end operation occurs, a request is sent to the back-end. In the request-response method, a partial parameter constructor is called to instantiate an entity class `SystemLog`. The parameters of the `SystemLog` entity class include the operator, operation time, operation IP address, and operation content. The operator is obtained directly from the request parameters; the operation IP address is obtained using the `getIp()` method of the IP address; the operation time is obtained using the `getTime()` method of the operation time; and the operation content is pre-set based on the specific details of the operation. For example, for a system login operation, the operation content can be assigned the value "Login System". Then, this entity class is used as a parameter to call the `addSystemLog()` method of `systemService` to save the operation information to the database.
[0098] The specific implementation process of step 8 is as follows:
[0099] When querying system log information, the front-end interface initiates a query request. In the request-response method, the querySystemLogAll() method of systemService is called to obtain all system log information and store it in the systemLogs variable of type List. This variable is then returned to the front-end interface, which iterates through the List variable to read all system log information and display it on the interface.
[0100] When it is necessary to retrieve information in the system logs based on the operator, the front-end interface initiates a retrieval request, which includes the operator's name. In the request-response method, the operator's name is used as a parameter to call the querySystemLogByRealName() method of systemService to obtain all system logs for the requested operator and store them in a List variable systemLogsFiltered. This variable is then returned to the front-end interface, which iterates through this List variable to read all system log information and display it on the interface.
[0101] Example 3
[0102] A web-based system for recording and querying system logs includes a creation unit, a data access layer writing unit, a business processing layer writing unit, a control layer writing unit, a front-end interface writing unit, a log recording unit, and a log query unit.
[0103] The creation unit is configured to: create a table in the database to store system log information, and create an entity class for system log information;
[0104] The data access layer writing unit is configured to: write the data access layer and interact with the tables created in the database that store system log information.
[0105] The business processing layer writing unit is configured to: write the business processing layer and call data access layer methods to implement functions;
[0106] The control layer writing unit is configured to: write the control layer, call the business processing layer methods, and respond to and process the front-end's log recording and query requests;
[0107] The front-end interface writing unit is configured to: write the front-end interface to display the system logs in tabular form;
[0108] The diary recording unit is configured as: diary recording;
[0109] The diary query unit is configured as: diary query.
[0110] Example 4
[0111] A computer device includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the Web-based system log recording and querying method described in Embodiment 1 or 2.
[0112] Example 5
[0113] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the Web-based system log recording and querying method described in Embodiment 1 or 2.
Claims
1. A web-based system log recording and querying method, used to record the time, IP address, and action of each user's behavior, and to perform query operations by user, characterized in that, The specific implementation process is as follows: Step 1: Create a table in the database to store system log information; Step 2: Create an entity class for system log information; Step 3: Write the data access layer to interact with the tables created in the database that store system log information; Step 4: Write the business logic layer and call the data access layer methods to implement the functionality; Step 5: Write the control layer, call the business processing layer methods, and respond to and process the front-end's log recording and query requests; Step 6: Develop the front-end interface to display the system logs in tabular format; Step 7: Keep a diary; Step 8: Diary Query; The specific implementation process of step 6 is as follows: A table named SystemLogTable is placed on the front-end interface, initially empty. After receiving system log information from the back-end, it is stored in data. JavaScript is used to retrieve elements from the data table using the id of SystemLogTable. The specific implementation process is as follows: First, create a th element and insert it into the SystemLogTable as the table header. The table header includes the operator, the IP address of the operator, the time of the operation, and the operation record. Then, loop through the system log information, create td elements as cells in the loop body, use the data.property method to get the attribute values, match them one by one with the table header, and insert them into the table SystemLogTable; Finally, all system log information is displayed; The specific implementation process of step 7 is as follows: When a certain operation occurs on the front end, a request is sent to the back end. In the request-response method, an entity class SystemLog is instantiated. The parameters of the entity class SystemLog include the operator, the operation time, the operation IP, and the operation content. The operator is obtained directly from the request parameters, the operation IP is obtained by calling the IP's get method, the operation time is obtained by calling the operation time's get method, and the operation content is set in advance according to the specific content of the operation.
2. The Web-based system log recording and query method according to claim 1, characterized in that, In step 1, the table storing system log information is set as t_work, with fields including operationId, operator, operationIp, operationTime, and operation, which represent operation number, operator, operation address, operation time, and operation record, respectively, and have types of int, varchar, varchar, varchar, varchar, and varchar. The specific implementation process of step 2 is as follows: Create an entity class SystemLog for the system log information object. The properties of the entity class SystemLog are the same as the fields of the table in the database that stores the system log information. The varchar type in the table that stores the system log information corresponds to the String type in the entity class SystemLog, and the int type in the table that stores the system log information corresponds to the int type in the entity class SystemLog. Write the corresponding get methods, set methods, parameterless constructor and parameterized constructor.
3. The method for recording and querying system logs based on a Web, as described in claim 1, is characterized in that... The specific implementation process of step 3 is as follows: In the data access layer, a data access interface is created, and the methods in the data access interface are implemented using database statements in an XML file; specifically, this means creating a SystemLog interface file and implementing it in a SystemLog.xml file based on the MyBatis framework. The methods in the data access interface include: addSystemLog(), used to add system log information; querySystemLogAll(), used to retrieve all system log information; and querySystemLogByOperator(), used to retrieve system log information for a specified operator. The specific implementation process of step 4 is as follows: The methods in the business processing layer call the corresponding methods in the data access layer to implement their functions; specifically, this means: creating the SystemLogService interface and implementing it in the SystemLogServiceImpl file, with attributes including systemLogDao, of type SystemLogDao, and methods including: setSystemLogDao(), used to set the entity class's setter method; addSystemLog(), used to add system log information; querySystemLogAll(), used to retrieve all system log information; and querySystemLogByOperator(), used to retrieve log information for a specified operator.
4. The Web-based system log recording and query method according to claim 3, characterized in that, The specific implementation process of step 5 is as follows: Create a SystemLogController class with a systemLogService property of type SystemLogService. Write a getSystemLog() method that responds to requests from the front-end to query the system logs interface, and then calls the querySystemLogAll() method in the business processing layer and returns it to the front-end. Add a logging method to the controller layer of the request method that needs to log the system. Add a logging method to the controller layer of the request method that needs to log the system. The specific implementation process is as follows: a. Obtain the user account name passed in the front-end request information; b. Obtain the IP address. The specific method is as follows: Obtain an HttpServletRequest object based on the front-end request, create a String type variable, and assign the X-Forwarded-For extension header of the HttpServletRequest object to the String type variable. The user's real IP address is the first valid IP string that is not unknown in X-Forwarded-For. c. To obtain the current time, the specific method is to use the System.currentTimeMillis() method to obtain the standard time. d. Instantiate a systemLog class, which takes three parameters: user account name, IP address, and current time. Call the addSystemLog() method in the business processing layer to save the log to the database. The system log information is now added. The method to obtain the user's real IP address is as follows: Under the conditions that the variable value is not empty, the length is not zero, and the value is not equal to "unknown", the variable value is sequentially assigned to the Proxy-Client-IP extension header, WL-Proxy-Client-IP extension header, HTTP_CLIENT_IP extension header, and HTTP_X_FORWARDED_FOR extension header in HttpServletRequest. The getRemoteAddr() method is then called on the HttpServletRequest object to obtain the user's real IP address.
5. A Web-based system log recording and query method according to any one of claims 1-4, characterized in that, The specific implementation process of step 8 is as follows: When querying system log information, the front-end interface initiates a query request. In the request-response method, the querySystemLogAll() method of systemService is called to obtain all system log information and store it in the systemLogs variable, which is a List type variable. The systemLogs variable is then returned to the front-end interface, which iterates through the systemLogs variable to read all system log information and display it on the interface. When it is necessary to retrieve information in the system logs based on the operator, the front-end interface initiates a retrieval request, which includes the operator's name. In the request-response method, the operator's name is used as a parameter to call the `querySystemLogByRealName()` method of `systemService` to obtain all system logs for the requested operator and store them in the `systemLogsFiltered` variable, which is a List type variable. The `systemLogsFiltered` variable is then returned to the front-end interface, which iterates through the `systemLogsFiltered` variable to read all system log information and display it on the interface.
6. A web-based system for recording and querying system logs, characterized in that, It includes a creation unit, a data access layer writing unit, a business processing layer writing unit, a control layer writing unit, a front-end interface writing unit, a log recording unit, and a log query unit; The creation unit is configured to: create a table in the database to store system log information, and create an entity class for system log information; The data access layer writing unit is configured to: write a data access layer that interacts with tables created in the database that store system log information. The business processing layer writing unit is configured to: write the business processing layer and call the data access layer methods to implement the functions; The control layer writing unit is configured to: write the control layer, call the business processing layer methods, and respond to the log recording and query requests from the processing front end; The front-end interface writing unit is configured to: write a front-end interface to display system logs in tabular form; The diary recording unit is configured as: diary recording; The diary query unit is configured as: diary query; The front-end interface was developed to display the system logs in tabular format. The specific implementation process is as follows: A table named SystemLogTable is placed on the front-end interface, initially empty. After receiving system log information from the back-end, it is stored in data. JavaScript is used to retrieve elements from the data table using the id of SystemLogTable. The specific implementation process is as follows: First, create a th element and insert it into the SystemLogTable as the table header. The table header includes the operator, the IP address of the operator, the time of the operation, and the operation record. Then, loop through the system log information, create td elements as cells in the loop body, use the data.property method to get the attribute values, match them one by one with the table header, and insert them into the table SystemLogTable; Finally, all system log information is displayed; The specific implementation process of the diary recording is as follows: When a certain operation occurs on the front end, a request is sent to the back end. In the request-response method, an entity class SystemLog is instantiated. The parameters of the entity class SystemLog include the operator, the operation time, the operation IP, and the operation content. The operator is obtained directly from the request parameters, the operation IP is obtained by calling the IP's get method, the operation time is obtained by calling the operation time's get method, and the operation content is set in advance according to the specific content of the operation.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the Web-based system log recording and querying method according to any one of claims 1-5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the Web-based system log recording and querying method according to any one of claims 1-5.
Citation Information
Patent Citations
Log management method and system
CN101436962A
Log recording system and method based on MVC (Model View Controller) framework
CN105893016A
System running log processing method and device based on web front end, equipment and medium
CN111581051A