📄 log4jservlet.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -