📄 logfilter.java
字号:
/****************************************************************************
* Package : com.ecSolutions.ecAppServer.server.filter
* File : LogFilter.java
* Create Date : 2007-7-20
* Author : Steven Chen
*
* Copyright(C) 2006 ecSolutions(shanghai) Co.,Limited.All Rights Reserved.
*
***************************************************************************/
package com.ecSolutions.ecAppServer.server.filter;
import com.ecSolutions.ecAppServer.server.Packet;
import com.ecSolutions.ecAppServer.server.SessionFilterAdapter;
import com.ecSolutions.ecAppServer.server.SessionFilterChain;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Log filter.
*
* @author Steven Chen
* @version $Id: LogFilter.java,v 1.2 2007/07/26 03:24:37 stevenchen Exp $
*/
public class LogFilter extends SessionFilterAdapter {
private static final Log log = LogFactory.getLog(LogFilter.class);
public void exceptionCaught(SessionFilterChain filterChain, Throwable cause) {
log.error(filterChain.getSession() + " caught exception: " + cause,
cause);
super.exceptionCaught(filterChain, cause);
}
public void packetReceived(SessionFilterChain filterChain, Packet packet)
throws Exception {
log.info(filterChain.getSession() + " received packet: " + packet);
super.packetReceived(filterChain, packet);
}
public void objectReceived(SessionFilterChain filterChain, Object obj)
throws Exception {
log.info(filterChain.getSession() + " received object: " + obj);
super.objectReceived(filterChain, obj);
}
public void packetSend(SessionFilterChain filterChain, Packet packet)
throws Exception {
log.info(filterChain.getSession() + " send packet: " + packet);
super.packetSend(filterChain, packet);
}
public void packetSent(SessionFilterChain filterChain, Packet packet)
throws Exception {
log.info(filterChain.getSession() + " sent packet: " + packet);
super.packetSent(filterChain, packet);
}
public void objectSent(SessionFilterChain filterChain, Object obj)
throws Exception {
log.info(filterChain.getSession() + " sent object: " + obj);
super.objectSent(filterChain, obj);
}
public void sessionClosed(SessionFilterChain filterChain) throws Exception {
log.info(filterChain.getSession() + " closed");
super.sessionClosed(filterChain);
}
public void sessionStarted(SessionFilterChain filterChain) throws Exception {
log.info(filterChain.getSession() + " started");
super.sessionStarted(filterChain);
}
public void sessionTimeout(SessionFilterChain filterChain) throws Exception {
log.info(filterChain.getSession() + " timeout");
super.sessionTimeout(filterChain);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -