I have tried uncomment the valve line in the server.xml. The uncommented lines are
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
It only logs the url being accessed. It did not log down who have made the request.
What is the proper way to do it in tomcat?
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