⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testlog.jsp

📁 《精通JSP编程 》源代码(赵强那本) 很有用的源代码
💻 JSP
字号:
<%@ page import="org.apache.log4j.*" %>
<%
  // Get an instance of the helloappLogger
   Logger helloappLogger = Logger.getLogger("helloappLogger");
  // Get an instance of the childLogger
    Logger childLogger = Logger.getLogger("helloappLogger.childLogger");

 
    // Load the properties using the PropertyConfigurator
    String path = application.getRealPath("/") + "/WEB-INF/log4j.properties";
    PropertyConfigurator.configure(path);

    // Log Messages using the Parent Logger
    helloappLogger.debug("This is a log message from the " +
      helloappLogger.getName());
    helloappLogger.info("This is a log message from the " +
      helloappLogger.getName());
    helloappLogger.warn("This is a log message from the " +
      helloappLogger.getName());
    helloappLogger.error("This is a log message from the " +
      helloappLogger.getName());
    helloappLogger.fatal("This is a log message from the " +
      helloappLogger.getName());


    // Log Messages using the Child Logger
    childLogger.debug("This is a log message from the " +
      childLogger.getName());
    childLogger.info("This is a log message from the " +
      childLogger.getName());
    childLogger.warn("This is a log message from the " +
      childLogger.getName());
    childLogger.error("This is a log message from the " +
      childLogger.getName());
    childLogger.fatal("This is a log message from the " +
      childLogger.getName());
  
%>

⌨️ 快捷键说明

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