Hey,

I'm building a Server-Client app with Perl/Mojolicious and JQuery. The server generates a log file using the Log::Log4perl and send the log file name back to the client so the client can see the progress. In the client I use a regular HTML A link to the log file as:

<a href="logs/blabla.log">See log file</a>

The problem is I click on the 'See log file' in the client side, the browser shows that the file is loading and stuck until the server finishing writing to the file - just then i can see the content of the file.

I configed the Log::Log4perl to autoflush and tried to use 'log4perl.appender.Syncer' and even set the buffer to 0 or 1: log4perl.appender.Buffer but nothing helped - my Log::Log4perl config is:

log4perl.appender.myFILE = Log::Log4perl::Appender::File log4perl.appender.myFILE.filename = $logfile_name log4perl.appender.myFILE.create_at_logtime = 1 log4perl.appender.myFILE.mode = write log4perl.appender.myFILE.autoflush = 1 log4perl.appender.myFILE.umask = 0000, log4perl.appender.myFILE.layout = Log::Log4perl::Layout::Pattern +Layout log4perl.appender.myFILE.layout.ConversionPattern = [%p][%d{HH:mm} +]: %m%n
How can I see the content of the log file when the server is updating it?

Thanks a lot and have a nice week,

Seif.


In reply to View content of Log::Log4perl log file while logger is running by iseif

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.