-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
174 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/com/zjh/tears/listener/socket/LogSocketListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.zjh.tears.listener.socket; | ||
|
||
import com.zjh.tears.model.Request; | ||
import com.zjh.tears.model.Response; | ||
import com.zjh.tears.model.SocketObject; | ||
import org.apache.log4j.Logger; | ||
|
||
/** | ||
* Created by zhangjiahao on 2017/2/10. | ||
*/ | ||
public class LogSocketListener extends SocketListener { | ||
|
||
private Logger logger = Logger.getLogger(this.getClass()); | ||
|
||
@Override | ||
public void afterHandler(SocketObject socketObject) { | ||
Request request = socketObject.getRequest(); | ||
Response response = socketObject.getResponse(); | ||
logger.info(request.getMethod() + " " + request.getPath() + " " + response.getCode() + " " + response.getMessage()); | ||
} | ||
} |
18 changes: 0 additions & 18 deletions
18
src/main/java/com/zjh/tears/listener/socket/TestSocketListener.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.zjh.tears.logger; | ||
|
||
import org.apache.log4j.DailyRollingFileAppender; | ||
import org.apache.log4j.Priority; | ||
|
||
/** | ||
* Created by zhangjiahao on 2017/2/11. | ||
*/ | ||
public class MyAppender extends DailyRollingFileAppender { | ||
public boolean isAsSevereAsThreshold(Priority priority) { | ||
//只判断是否相等,而不判断优先级 | ||
return this.getThreshold().equals(priority); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.