textfilter.java

来自「这是一个关于J2EE的开源包common里的许多组件的示例应用程序,可以借鉴.」· Java 代码 · 共 48 行

JAVA
48
字号
/**
 * Title : Base Dict Class
 * Description : here Description is the function of class, here maybe multirows    
 * @author        <a href="mailto:sunpeng@china.freeborders">kevin</a> 
 * @Version       1.0 
 */

package log4j;

import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Filter;
import java.util.logging.LogManager;
import java.util.logging.LogRecord;

/**
 * Class description goes here.
 * @version 1.0  2005-10-13 
 * @author kevin
 */
public class TextFilter implements Filter
{

	private String text = "";

	public TextFilter()
	{
		String className = TextFilter.class.getName();
		System.out.println("====>>"+className);
		this.text = LogManager.getLogManager().getProperty(className + ".text");
	}

	/**
	 * @see java.util.logging.Filter#isLoggable(java.util.logging.LogRecord)
	 */
	public boolean isLoggable(LogRecord record)
	{
		System.out.println("====>>"+record.getMessage());
		if(record.getMessage().indexOf(this.text) != -1)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?