我正在使用JBoss(Wildfly)测试日志记录功能。
基本上我有以下index.jsp
文件:
<%
//First: Set the Session Variable
HttpSession sess = request.getSession(true);
sess.setAttribute("springUserPrincipal", "foo");
%>
<html>
<h1>Welcome <%=sess.getAttribute("springUserPrincipal")%></h1>
</html>
当网页加载时,它表示&#34;欢迎foo&#34;正如人们所期望的那样。
但是,在尝试格式化access.log文件的日志模式时,我在检索实际的&#34; springUserPrincipal&#34;时遇到了一些问题。日志文件的变量。
这是我尝试的:
<access-log pattern="%h %u "%{s,springUserPrincipal}" %t '%r' %s %b" prefix="access"/>
当我启动JBoss Instance时,控制台上会出现以下错误:
15:26:44,679 ERROR [io.undertow] (MSC service thread 1-4) UT005017: Unknown variable %{s,springUserPrincipal}
我正在使用here找到的令牌指南。
有谁知道错误是什么?
答案 0 :(得分:0)
尝试%{springUserPrincipal}s
作为格式说明符