http://qs1969.pair.com?node_id=456780


in reply to log file formatting

I'm guessing that you're viewing the log under Windows?

Print a carriage return along with your new line characters.

But then I notice that you're also printing a content type header leading me to assume that you are viewing the log through a browser?

In that case, print the proper HTML line breaks for line endings. -Nitrox

Replies are listed 'Best First'.
Re^2: log file formatting
by dorward (Curate) on May 13, 2005 at 16:16 UTC
    Proper HTML line breaks wouldn't do much good, the content-type header is text/plain, not text/html.
Re^2: log file formatting
by jhourcle (Prior) on May 13, 2005 at 16:24 UTC

    He's using a content-type, but it's 'text/plain'. HTML tags would be a bad thing to do, if the file isn't going to be interpreted as HTML. (text/html, text/xhtml, text/xhtml+xml, etc)

    The problem is, he's given us the code for what generates the log, and not for what displays it. I think you're right, in that it's being displayed as HTML, and not using HTML line endings. The easiest solution is to make sure that the browser is sending the correct mime headers when viewing the logs.

    I'd probably also use common+ log format (aka. NCSA extended log format) , as it would allow you to use existing log analysis packages (eg, analog) for those pretty graphs that management likes

    (well, I'd use the format, but I'd do it in the server, rather than generating a new process just to log)

    Update: follow the link that dorward gave for the correct xhtml mime type

      text/xhtml and text/xhtml+xml are not real MIME types. XHTML documents should be served as application/xhtml+xml. See XHTML Media Types for the full story.
Re^2: log file formatting
by Anonymous Monk on May 13, 2005 at 19:43 UTC
    Could you show in my code how must be this proper HTML line breaks for line endings?
    Thanks.