Skip to content

Commit

Permalink
1. New feature: auto create menu when web application start; 2. Optim…
Browse files Browse the repository at this point in the history
…ize AppLogger: no static field, remove bean declare in applicationContext-servlet.xml
  • Loading branch information
junior9919 committed Oct 7, 2015
1 parent a192811 commit 7b6c1fa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions halo-wechat-utils.jardesc
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
<javaElement handleIdentifier="=WeChat/src&lt;com.halo.wechat.logger"/>
<javaElement handleIdentifier="=WeChat/src&lt;com.halo.wechat.security"/>
<javaElement handleIdentifier="=WeChat/src&lt;com.halo.wechat.xml.utils.converters"/>
<javaElement handleIdentifier="=WeChat/src&lt;com.halo.servlet.listeners"/>
</selectedElements>
</jardesc>
1 change: 0 additions & 1 deletion src/com/halo/wechat/config/applicationContext-servlet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<!-- 指定需要扫描的类包 -->
<context:component-scan base-package="com.*.wechat.mvc.*" />
<!-- 日志配置 -->
<bean id="appLogger" class="com.halo.wechat.logger.AppLogger" />
<aop:config>
<aop:aspect ref="appLogger">
<!-- 执行controller方法的切点 -->
Expand Down
9 changes: 7 additions & 2 deletions src/com/halo/wechat/logger/AppLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
*
*/
public class AppLogger {
private static Logger logger = LogManager.getLogger(AppLogger.class.getName());

private Logger logger = LogManager.getLogger(AppLogger.class.getName());

private String[] getObjectFields(Object obj) {
String colNames = "";
Expand All @@ -29,7 +30,6 @@ private String[] getObjectFields(Object obj) {
try {
fieldValue = method.invoke(obj);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
// TODO Auto-generated catch block
logger.error(e.getMessage());
}
colNames += fieldName + "|";
Expand All @@ -45,6 +45,10 @@ private String[] getObjectFields(Object obj) {
return cols;
}

public Logger getLogger() {
return this.logger;
}

public void beforeMethod(JoinPoint jp) {
Object[] args = jp.getArgs();
String params = "";
Expand Down Expand Up @@ -144,4 +148,5 @@ public void logBeforeSignatureCompare(JoinPoint jp) {
logger.debug("Compare parameters: " + orginSignature + "|" + compareToSignature + "|" + echoStr);
}
}

}

0 comments on commit 7b6c1fa

Please sign in to comment.