CN104881284A - Efficient log operating method - Google Patents

Efficient log operating method Download PDF

Info

Publication number
CN104881284A
CN104881284A CN201510267075.0A CN201510267075A CN104881284A CN 104881284 A CN104881284 A CN 104881284A CN 201510267075 A CN201510267075 A CN 201510267075A CN 104881284 A CN104881284 A CN 104881284A
Authority
CN
China
Prior art keywords
struts2
blocker
log
annotation
interface
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN201510267075.0A
Other languages
Chinese (zh)
Inventor
关班记
季统凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
G Cloud Technology Co Ltd
Original Assignee
G Cloud Technology Co Ltd
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 G Cloud Technology Co Ltd filed Critical G Cloud Technology Co Ltd
Priority to CN201510267075.0A priority Critical patent/CN104881284A/en
Publication of CN104881284A publication Critical patent/CN104881284A/en
Pending legal-status Critical Current

Links

Abstract

The invention relates to the technical field of WEB development, in particular to an efficient log operating method. The JDK, with the version number being 1.5 or larger, of JAVA is used in the method, and a universal annotation interface of logs is achieved through an annotation interface of the JDK. When Action codes of the Struts2 are compiled, a log annotation interface is labeled before the logs needing to be inserted. Secondarily, configuration of a Struts2 interceptor is completed, and all user requests are configured to pass the interceptor. The basic class of the Struts2 is compiled, and Action of other services needs to inherit the basic class. When a user requests a struts2 method, the interceptor judges whether annotation interfaces exist or not through a method, and whether the logs need to be written into the services or not is judged. In the code development process, if log information needs to be written into the services, it is only needed that the log annotation interface is used before the service method is used. Due to the method, the log newly-increased functions of a system can be greatly reduced, and development efficiency and upgrading efficiency are improved; the method can be used for log recording operation.

Description

A kind of log operation method efficiently
Technical field
The present invention relates to WEB development technique field, be specifically related to a kind of efficient logging operations method based on struts2 and remarking technology.
Background technology
In the R&D process based on J2EE platform, some key operations are needed to the logging feature of being correlated with, to record the function, code, operator, operating result etc. of this operation.In traditional performance history, normally after service code terminates, then carry out daily record play operation by calling log pattern.The mode that this display is called, significantly increases system complex program and exploitation amount, and when log pattern changes, so the code calling this log pattern all needs amendment, adds the difficulty of upgrading.
Summary of the invention
The technical matters that the present invention solves is to provide a kind of log operation method efficiently, and user only needs before the operational approach needing to play daily record, increases daily record annotation interface.
The technical scheme that the present invention solves the problems of the technologies described above is:
Described method comprises the steps:
1st step, install and use the JDK of 1.5 or more versions;
2nd step, use JDK characteristic, the attribute of compile the notes interface LogAnnotain, defining interface;
3rd step, write the foundation class BasicAction of Struts2;
The service class such as the 4th step, the UserAction writing Struts2, and realize its operational approach; Write in the method for daily record in business simultaneously and mark daily record note LogAnnotain, and its code, des attribute of initialization,
5th step, write Struts2 blocker LogInterceptor, blocker realizes;
First 6th step, blocker perform the service request of user, the designation method of access UserAction;
7th step, blocker obtain the method for access, and judge whether the method exists annotation, if there is no annotates, then skip to the 9th step;
8th step, blocker, by the annotation interface of method, obtain the value of code and the res attribute of annotation interface, and will be worth in write into Databasce;
9th step, end.
The invention has the beneficial effects as follows:
This method, in conjunction with the characteristic of struts2 and jdk1.5, by the mode of blocker and annotation, realizes the modularization of daily record what's new; Blocker can pass through to judge whether the operational approach that user accesses exists annotation and determine whether preserve daily record.Whole process, service code is without the need to calling log pattern, and log pattern completes with business module and is separated, and therefore when log pattern inlet pipe is upgraded, service code, without the need to carrying out any amendment, also can complete the newly-increased operation of daily record.The complexity that namely the present invention reduces system is low, also improves development efficiency simultaneously, make whole platform more manageable, upgrading with maintenance.
Present invention achieves user needing to write in the business module of daily record, only needing to annotate by simply marking daily record before method body, greatly reducing journalizing function that is loaded down with trivial details, frequent, that repeat.And by realizing daily record in blocker, when journal function needs amendment, only need to modify to blocker, the record of lifting platform is active.
Accompanying drawing explanation
Below in conjunction with accompanying drawing, the present invention is further described:
Fig. 1 is process flow diagram of the present invention.
Embodiment
Lower mask body, to educate the line module of cloud system, illustrates the key step of this device.
As shown in Figure 1, be the main flow figure of data query; Comprise the steps:
1st step, install and use the JDK of 1.5 or more versions;
2nd step, use JDK characteristic, the attribute of compile the notes interface LogAnnotain, defining interface, as code, des etc.;
3rd step, write the foundation class BasicAction of Struts2.
4th step, write the service class of Struts2, as UserAction, and realize its operational approach, write in the method for daily record in business simultaneously and mark daily record and explain LogAnnotain, and its code, des attribute of initialization, as:
LogAnnotation (code=" UserAction.login () ", description=" user's login ")
public String login(){
}
5th step, write Struts2 blocker LogInterceptor, blocker realizes.
First 6th step, blocker perform the service request of user, the designation method of access UserAction.
7th step, blocker obtain the method for access, and judge whether the method exists annotation, if there is no annotates, then skip to the 9th step.
8th step, blocker, by the annotation interface of method, obtain the value of code and the res attribute of annotation interface, and will be worth in write into Databasce.
9th step, end.

Claims (1)

1. an efficient log operation method, is characterized in that: described method comprises the steps:
1st step, install and use the JDK of 1.5 or more versions;
2nd step, use JDK characteristic, the attribute of compile the notes interface LogAnnotain, defining interface;
3rd step, write the foundation class BasicAction of Struts2;
The service class such as the 4th step, the UserAction writing Struts2, and realize its operational approach; Write in the method for daily record in business simultaneously and mark daily record note LogAnnotain, and its code, des attribute of initialization,
5th step, write Struts2 blocker LogInterceptor, blocker realizes;
First 6th step, blocker perform the service request of user, the designation method of access UserAction;
7th step, blocker obtain the method for access, and judge whether the method exists annotation, if there is no annotates, then skip to the 9th step;
8th step, blocker, by the annotation interface of method, obtain the value of code and the res attribute of annotation interface, and will be worth in write into Databasce;
9th step, end.
CN201510267075.0A 2015-05-22 2015-05-22 Efficient log operating method Pending CN104881284A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510267075.0A CN104881284A (en) 2015-05-22 2015-05-22 Efficient log operating method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510267075.0A CN104881284A (en) 2015-05-22 2015-05-22 Efficient log operating method

Publications (1)

Publication Number Publication Date
CN104881284A true CN104881284A (en) 2015-09-02

Family

ID=53948791

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510267075.0A Pending CN104881284A (en) 2015-05-22 2015-05-22 Efficient log operating method

Country Status (1)

Country Link
CN (1) CN104881284A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893016A (en) * 2015-12-11 2016-08-24 乐视网信息技术(北京)股份有限公司 Log recording system and method based on MVC (Model View Controller) framework
WO2019062015A1 (en) * 2017-09-30 2019-04-04 平安科技(深圳)有限公司 Source code protection method, application server, and computer-readable storage medium
CN110109808A (en) * 2018-02-01 2019-08-09 北京视联动力国际信息技术有限公司 A kind of method and apparatus of log processing
CN110825465A (en) * 2019-11-06 2020-02-21 北京达佳互联信息技术有限公司 Log data processing method and device, electronic equipment and storage medium
CN111522708A (en) * 2020-04-10 2020-08-11 星环信息科技(上海)有限公司 Log recording method, computer equipment and storage medium
CN113254399A (en) * 2021-05-27 2021-08-13 平安普惠企业管理有限公司 Log query method and device, electronic equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1767453A (en) * 2004-10-31 2006-05-03 中兴通讯股份有限公司 Automatic test method and system
US20100251242A1 (en) * 2009-03-31 2010-09-30 Swaminathan Sivasubramanian Control Service for Relational Data Management
CN102810057A (en) * 2011-05-30 2012-12-05 中国银联股份有限公司 Log recording method
US20130055399A1 (en) * 2011-08-29 2013-02-28 Kaspersky Lab Zao Automatic analysis of security related incidents in computer networks
CN103744802A (en) * 2013-12-20 2014-04-23 北京奇虎科技有限公司 Method and device for identifying SQL injection attacks

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1767453A (en) * 2004-10-31 2006-05-03 中兴通讯股份有限公司 Automatic test method and system
US20100251242A1 (en) * 2009-03-31 2010-09-30 Swaminathan Sivasubramanian Control Service for Relational Data Management
CN102810057A (en) * 2011-05-30 2012-12-05 中国银联股份有限公司 Log recording method
US20130055399A1 (en) * 2011-08-29 2013-02-28 Kaspersky Lab Zao Automatic analysis of security related incidents in computer networks
CN103744802A (en) * 2013-12-20 2014-04-23 北京奇虎科技有限公司 Method and device for identifying SQL injection attacks

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
彭雪昶 等: "面向切面方法实现日志管理的研究与设计", 《数据库与信息管理》 *
杨树林 等: "使用Annotation和拦截器实现访问控制", 《北京印刷学院学报》 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893016A (en) * 2015-12-11 2016-08-24 乐视网信息技术(北京)股份有限公司 Log recording system and method based on MVC (Model View Controller) framework
WO2019062015A1 (en) * 2017-09-30 2019-04-04 平安科技(深圳)有限公司 Source code protection method, application server, and computer-readable storage medium
CN110109808A (en) * 2018-02-01 2019-08-09 北京视联动力国际信息技术有限公司 A kind of method and apparatus of log processing
CN110109808B (en) * 2018-02-01 2023-07-21 视联动力信息技术股份有限公司 Log processing method and device
CN110825465A (en) * 2019-11-06 2020-02-21 北京达佳互联信息技术有限公司 Log data processing method and device, electronic equipment and storage medium
CN111522708A (en) * 2020-04-10 2020-08-11 星环信息科技(上海)有限公司 Log recording method, computer equipment and storage medium
CN111522708B (en) * 2020-04-10 2021-08-24 星环信息科技(上海)股份有限公司 Log recording method, computer equipment and storage medium
CN113254399A (en) * 2021-05-27 2021-08-13 平安普惠企业管理有限公司 Log query method and device, electronic equipment and medium

Similar Documents

Publication Publication Date Title
CN104881284A (en) Efficient log operating method
US8578010B2 (en) Methods and system for tracking web page analytics
CN102637136B (en) For the method and apparatus merging the Debugging message from the different compiler stages
CN105912473B (en) Mobile APP automatically testing platform and test method based on BDD
US20230168902A1 (en) Bootstrapping Profile-Guided Compilation and Verification
CN107357593A (en) Source code file construction method, device, electric terminal and readable storage medium storing program for executing
US7562368B2 (en) Universal driver server
CN102541731B (en) Platform-agnostic diagnostic data collection and display
CN101251799B (en) Apparatus and method for implementing management
CN104281808A (en) Universal detection method for malicious act of Android system
CN110197052A (en) Authority application method, apparatus, equipment and storage medium based on Android platform
CN109005226A (en) The acquisition methods of sensing data, acquisition system and relevant apparatus in server
CN103268183A (en) Processing method and device for information report
CN104462943A (en) Non-intrusive performance monitoring device and method for service system
CN108009427B (en) Rapid retrieval method for database vulnerability rules
CN107797823A (en) Business Rule Management method, apparatus, storage medium and computer equipment
CN102385527A (en) Device and method for improving execution efficiency of service scripts
US9356845B1 (en) System and method for audience segment profiling and targeting
CN105589695A (en) Business function calling method and system
CN103501341A (en) Method and device for establishing Web service
CN106506178A (en) A kind of method and system for for the accurate drainage of main broadcaster
CN101452619B (en) Method for isolating virus of disk for background system of tax control collecting apparatus
CN102156650A (en) Method and device capable of implementing automatic analysis of patch
CN102609253B (en) A kind of application implementation method of smart card and system
CN101436144A (en) SCM program editing and emulating host computer

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20150902

WD01 Invention patent application deemed withdrawn after publication