Logs not changing file daily

Posted by Eurotool on Fri 11 Sep 2015 01:16 AM — 4 posts, 22,357 views.

#0
Hi,


My current logging option is set to log automatically to this file:

C:\Program Files (x86)\MUSHclient\logs\%N_%Y-%m-%d.html

However, all it does is log to the same file it created a week ago, everyday. It doesn't create a new one each day.

Am I missing something here? How can I fix this?


Thank you very much,
Eurotool
Australia Forum Administrator #1
The logging option you mention controls the filename, when the log file is opened. However if it stays open for a week, then everything is appended to the same file.

What you need to do is have a timer that runs at 00:01 a.m., which closes the current log file and opens a new one.

From memory, if you open a log file with an empty filename (with OpenLog) it uses the parameters in your logging configuration.

So make a timer, which run at just after midnight, and sends to script, which does something along the lines of:


CloseLog ()
OpenLog ("")


Template:function=CloseLog
CloseLog

The documentation for the CloseLog script function is available online. It is also in the MUSHclient help file.


Template:function=OpenLog
OpenLog

The documentation for the OpenLog script function is available online. It is also in the MUSHclient help file.

Amended on Fri 11 Sep 2015 06:38 AM by Nick Gammon
#2
Thank you, but this doesn't apply the headers (preambles) to the logs. They all lack line breaks and proper formatting (HTML). Am I missing a command?
USA #3
CloseLog help mentions that it will append the postamble to the file, and that "this is inconsistent with what OpenLog does." So no, you're not missing anything.

What about using WriteLog() combined with GetInfo(11) immediately after calling OpenLog?