logfilter.java
来自「STRUTS数据库项目开发宝典」· Java 代码 · 共 37 行
JAVA
37 行
package com.helpsoft.util.log;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Filter;
import java.util.logging.LogRecord;
/**
* A class for setting a filter
* @author caoguangxin- www.relationinfo.com
*/
public final class LogFilter implements Filter {
/** a filter which should be logged */
private String logFilterValue = "";
/**
* Constrcutor for making a LogFormatter
* @param logFilterValue the filter for logging
*/
public LogFilter(String logFilterValue) {
this.logFilterValue = logFilterValue;
}
/**
* Check to see if the filter is in the logrecord
* @param logRecord the log record to format
* @return boolean true if the filter exists in the logRecord
*/
public boolean isLoggable(LogRecord logRecord) {
return (logRecord.getLoggerName().indexOf(logFilterValue) > -1);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?