Using Log Files in ServletContext : Log « JSP « Java Tutorial






<HTML>
    <HEAD>
        <TITLE>Using Log Files</TITLE>
    </HEAD>

    <BODY>
        <H1>Using Log Files</H1>
        This page writes to a log file.
        <%
            String address =  request.getRemoteAddr();
            String file = ((HttpServletRequest) request).getRequestURI();

            session.getServletContext().log(
                "User access! " +      
                " User IP: " + address +      
                " Resource: " + file 
            );
        %>
    </BODY>
</HTML>








23.48.Log
23.48.1.Using Log Files in ServletContext