Logging is required to record all web operations to the database and use aop to record logs. Of course, this is a good choice, there are multiple methods for integrating aop logging in spring (multiple configuration methods for aop, annotations, and xml configuration). Here is only an example of xml configuration. 1. Write logging 2. Configure aop 1. Write Java code for logging @ SuppressWarnings ("unchecked") public class LogService {public void logAll (JoinPoint jp) {System. out. println ("in LogService, method logAll invoked. "); System. out. println ("================"); StringBuilder sb = new StringBuilder (); sb. append ("method:" + jp. getSignature (). getName (); HttpServletRequest request = ServletActionContext. getRequest (); Iterator <Entry <String, Object> iter = request. getParameterMap (). entrySet (). iterator (); boolean isFirst = true; sb. append ("paras:"); while (iter. hasNext () {Entry <String, Object> entry = iter. next (); if (isFirst) {isFirst = false;} else {sb. append ("#");} sb. append (entry. getKey () + "="); Object [] allValue = (Object []) entry. getValue (); for (int I = 0; I <allValue. length; I ++) {if (I! = 0) {sb. append (",");} sb. append (allValue [I]. toString () ;}} System. out. println (sb. toString (); System. out. println ("==================") ;}2. Configure aop in applicationContext. configure xml code in Xml </aop: config> <bean id = "logService" class = "com. cjnetwork. cms. service. logService "> </bean> <aop: config> www.2cto.com <aop: aspect id =" myAspect "ref =" logService "> <aop: pointcut expression =" execution (* com. cjnetwork. c Ms. action. *. *(..)) "id =" logPointCut "/> <aop: before method =" logAll "pointcut-ref =" logPointCut "/> </aop: aspect> </aop: config> <bean id = "logService" class = "com. cjnetwork. cms. service. logService "> </bean> <aop: config proxy-target-class =" true "/> the basic configuration is as follows: <aop: config proxy-target-class = "true"/>, indicates that the cglib proxy is forcibly used instead of the java proxy. This is very important. If you use the proxy that comes with java, an exception is thrown, prompting that the proxy class cannot be converted to our own class. This is because the default attribute is false. In this proxy mode, the interface must be implemented. The class returned by the proxy can be converted to the corresponding interface class, but cannot be directly converted to the class implementation. This method is not recommended.