Using Log Files : Log « JSP « Java






Using Log Files


<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>
           
       








Related examples in the same category