jsp中打印log日志
[html]
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="org.apache.log4j.Logger" %>
<%@ page import="java.util.*,java.io.*,java.text.*,java.net.*" %>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html>
<head>
<title>打印日志</title>
</head>
<body>
<%! public static final String QUERY_PARAM = "queryParam";%>
<%
Logger log = Logger.getLogger(this.getClass());
// public static final String QUERY_PARAM = "queryParam";
Map parameterMap = request.getParameterMap();
StringBuilder sb = new StringBuilder();
boolean and = false;
String queryParam = null;
for (Iterator iter = parameterMap.keySet().iterator(); iter.hasNext();) {
String name = (String) iter.next();
String[] values = (String[]) parameterMap.get(name);
String valueStr = ""; www.zzzyk.com
for (int i = 0; i < values.length; i++) {
valueStr = (i == values.length - 1) ? valueStr + values[i]
: valueStr + values[i] + ",";
}
//如果有乱码有需要转码
sb.append(name).append("=").append(valueStr).append(";");
}
queryParam = sb.toString();
log.info("alipay支付宝后台回调地址==url:"+request.getRequestURL().toString()+";params:"+queryParam);
%>
</body>
</html>
补充:Web开发 , Jsp ,