log4jservlet.java

来自「该程序能够准确的记录互联网用户上网所用的流量」· Java 代码 · 共 17 行

JAVA
17
字号
package com.briup.common.servlet;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import org.apache.log4j.PropertyConfigurator;public class Log4JServlet extends HttpServlet {	public void init() throws ServletException {		String path = getServletContext().getRealPath("/");		// getInitParameter("propfile")方法从web.xml文件中读取Log4J配置文件的名字"profile"。		String propfile = path + getInitParameter("propfile");		PropertyConfigurator.configure(propfile);	}}

⌨️ 快捷键说明

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