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::PatternLayout
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.
I am just guessing with this small amount of information. Please post more details to be able to help you. Without the client code I can't tell what is wrong.
Many file based Log::Log4perl appender has an option to turn on/off buffering. Turn off the buffering, it may help.
If I see correctly your example then it does not assign the appender to any loglevel or module.
You could try this out: