log4jinit.java

来自「本人课程设计时做的一个用struts框架实现的基于cmmi2的项目管理系统的原型」· Java 代码 · 共 23 行

JAVA
23
字号
package com.cmmi2pms.common;

import org.apache.log4j.PropertyConfigurator;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

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 + -
显示快捷键?