Home Jsp Simple-jsp-example Using Log Files



Using Log Files
Posted on: March 11, 2008 at 12:00 AM
Log files keeps a records of internet protocol addresses (IP), Http status, date, time, bytes sent, bytes recieved, number of clicks etc.

Using Log Files

        

Log files keeps a records of internet protocol addresses (IP), Http status, date, time, bytes sent, bytes recieved, number of clicks etc.

In this program we are writing some information in log file.

 

The code of the program is given below:

 

 

<html>
  <head>
  <title>Using Log Files</title>
  </head>
  <body>
  <h1>Using Log Files</h1>
  This page is writing to a log file.
  <%
  String address =  request.getRemoteAddr();
  String file =  request.getRequestURI();
String method = request.getMethod();
  session.getServletContext().log(" User IP: " + address +  
  " Resource: " + file + "method is: " + method);
out.println("<br><br>" + "The User IP address is "+ address + "method is " + method);
  %>
  </body>
</html>

The output of the program is given below:

Download this example.

Related Tags for Using Log Files:
chttpfilefilesdatetimeinternetipclicknumberbytecliintaddresslogprotocolstatusierecordaddrecordstobytesssecieilepsliiminstamntpsnetddnetaddressesadclestocmeinternproseeesscolatkimestatrdsttssrdstetcetcprolo


More Tutorials from this section

Ask Questions?    Discuss: Using Log Files  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.