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:
<title>Using Log Files</title>
<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);
The output of the program is given below:
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: March 11, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles