Well i have a small code snippet which is a basic http server. Well its running fine , but i am unable to catch the feedback and store it in a log file of my own for further analysis.
code snippet : http://codepad.org/MppnYU9n
just in case wondering on how to run it
create a directory and then run the code , inside it . u can add many html pages in it and then while running the python program
$python webserver.py
in ur browser open http://localhost:8000/ ensure the html pages u append in the directory atleast has one page named index.html.that particular page gets displayed and in the ternminal u will get various feedbacks ,
when ur requesting a valid page in ur browser ( test.html in this case ) . the feedback is pretty clear i guess.
output:
localhost.localdomain - - [20/Jul/2010 14:34:34] "GET /test.html HTTP/1.1" 200 -
when the file doesnt exist then output is :
localhost.localdomain - - [20/Jul/2010 14:22:16] code 404, message File not found
these output are displayed in the terminal , i want to store them in a log file, but unable to do so .