[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Bug reports
. . -> [Subject]  Small issue regarding auto-log filenames

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Small issue regarding auto-log filenames

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Fri 11 Jul 2003 04:14 AM (UTC)  quote  ]
Message
Hi again...

I use the autologger, and I give it the filename containing %Y, %b, and %d - (sorry if I got the caps wrong, I'm not checking exactly), which are the year, short month and day. Now, the problem is that when midnight ticks, the day should tick to the next one, and the log should start... but it doesn't. Instead, it keeps writing to the same day.

It's not a major issue, but it would be nice to have it check to make sure it's logging to the right file, if the filename involves dates.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Nick Gammon   Australia  (18,801 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Fri 11 Jul 2003 08:42 AM (UTC)  quote  ]
Message
The auto-logger logs automatically and you can put the date in the filename, but it doesn't promise to close and re-open the file from time to time.

For example, if you put the hour in the log file name would you expect it to be closed and a new one opened each hour? What about each minute? Each second?

What you can do is make a timer, which scripts a close and re-open. You could run this every hour, which would mean that sometime after midnight, the log file would re-open correctly.

However I see that the scripted log file open does not look at the auto-log file name, so the script would need to generate the log file name manually (with the dates in it).

Another approach might be to use world.GetInfo (51) to find the current log file name, and then every couple of minutes check to see if the date has changed, and if so, take the existing name, fix the date (this might be tricky) and then close and re-open it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Reply #2 on Fri 11 Jul 2003 03:03 PM (UTC)  quote  ]
Message
Quote:

Another approach might be to use world.GetInfo (51) to find the current log file name, and then every couple of minutes check to see if the date has changed, and if so, take the existing name, fix the date (this might be tricky) and then close and re-open it.


This sounds like it's probably the best solution. Opening a log file every time unit (which ever one the user chose in the auto-log filename) can get ridiculous.

How about adding a new command to the scripting engine that tells the auto-logger to simply restart? (That's probably closing the log session, and then opening it again.) That way the script doesn't have to deal with the date. The user knows how often and when to change the log file, so he/she would set up the timer's interval. The script would then close the log session and start it up again - without caring about dates, filenames, etc. - and the auto-logger would know what new filename to use, because it just applies the same format it already has. Is this more feasible than checking every time unit for a date change?

If this thing would be more easily done through a plugin, I'd be glad to write one and submit it to the community. I just wanted to know if perhaps this would be better solved internally in MUSHclient first. If not, like I said, I'll just write a plugin. :)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #3 on Fri 11 Jul 2003 06:26 PM (UTC)  quote  ]
Message
You don't need a command, it's something like
LogClose
LogOpen
or something like that, in scripting. Really easy.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Nick Gammon   Australia  (18,801 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Fri 11 Jul 2003 09:58 PM (UTC)  quote  ]
Message
There are two ways you could script it, the world.DoCommand way, however that pops up a dialog box.

The world.OpenLog way however does not respect the auto-log filenames.

I will follow your suggestion and make a scriptable way of opening the log file and use the auto-log file name.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


1,301 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]