Is there a way to use Python's http server modules to enable me to view a log file residing on a Linux box?
-
I tried the python -m SimpleHTTPServer way, but it asks me to save the log file. What I want is that the browser should display the file content, rather than asking me to save it. (Here, the directory may be pre-defined, but the log file names keep changing) In other words, I want to tell my app developers : Hey guys, here is the URL which lists the log files. Click on your log file, and you will see what is going on in real time. Any ideas? Thanks a bunch
-
Answer:
A simple `python -m http.server` should suffice. My guesstimate is that the log files you are trying to serve have a non-standard extension, with respect to webpages. This includes files with a .log extension. If you want your users to be able to directly view the files in their browsers, simply rename the log files to have a .txt extension. Browsers seem to have a white list of file extensions which are displayed in the browser, all others are considered binary objects and downloaded.
Darshit Shah at Quora Visit the source
Related Q & A:
- How do I convert a PDF file to PDF/A in Delphi?Best solution by softwarerecs.stackexchange.com
- Is there a way to know who's looking at my MySpace profile?Best solution by Yahoo! Answers
- Does anybody have a realy cool design for a speaker box for a tj with no back seat?Best solution by Yahoo! Answers
- How to put a video file on to a disc?Best solution by wikihow.com
- Is there a way to see who's been looking at my Facebook page?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.