tomcat: how can we log user name in tomcat log?

前端 未结 2 1143
耶瑟儿~
耶瑟儿~ 2021-01-22 12:12

I have tried uncomment the valve line in the server.xml. The uncommented lines are



        
相关标签:
2条回答
  • 2021-01-22 12:13

    You have selected the "common" pattern ; you need to specify a custom pattern like the one shown below. The "%u" variable stands for "authenticated user". The link below lists all the other variables you can use.

    http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html#Access_Log_Valve

        <Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="logs"  prefix="access." suffix=".log"
                 pattern="%h %l %u %t '%r' %s %b"
                 resolveHosts="false"/>
    
    0 讨论(0)
  • 2021-01-22 12:37
    <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
           prefix="localhost_access_log." suffix=".txt" pattern="combined" resolveHosts="false"/>
    

    Would that do the trick as well ?

    0 讨论(0)
提交回复
热议问题