log4jinit.java

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

JAVA
39
字号
/**
 * 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 javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.PropertyConfigurator;

/**
 * Class description goes here.
 * @version 1.0  2005-10-12 
 * @author kevin
 */
public class Log4jInit extends HttpServlet
{
	public void init()
	{
		String prefix = getServletContext().getRealPath("/");
		String file = getInitParameter("log4j");
		// if the log4j-init-file is not set, then no point in trying  
		System.out.println("................log4j start");
		if(file != null)
		{
			PropertyConfigurator.configure(prefix + file);
		}
	}

	public void doGet(HttpServletRequest req, HttpServletResponse res)
	{
	}

}

⌨️ 快捷键说明

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