当线上出现问题的时候,无法debug,log的级别开始时候设定的比较高,导致不好调试的时候
可以临时修改对应log的级别,定位完问题之后再改回去
log4j版本:
logback版本
可以临时修改对应log的级别,定位完问题之后再改回去
log4j版本:
<%@page import="java.util.Enumeration"%>
<%@page import="org.apache.log4j.LogManager"%>
<%@page import="org.apache.log4j.Logger"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
Enumeration<Logger> loggers = LogManager.getCurrentLoggers();
while (loggers.hasMoreElements()) {
Logger logger = loggers.nextElement();
out.println(logger.getName() + " <br/>");
}
%>
</body>
</html>
logback版本
<%@page import="org.slf4j.ILoggerFactory"%>
<%@page import="ch.qos.logback.classic.LoggerContext"%>
<%@page import="ch.qos.logback.classic.Logger"%>
<%@page import="org.slf4j.LoggerFactory"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>just for test</title>
</head>
<body>
<%
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
List<Logger> loggers = loggerContext.getLoggerList();
for (Logger logger : loggers) {
out.println(logger.getName() + " " + logger.getLevel() + "<br/>");
}
%>
</body>
</html>