Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ General ➜ Questions about Logging

Questions about Logging

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by forral   USA  (79 posts)  Bio
Date Mon 17 May 2010 06:20 AM (UTC)
Message
Hello,

I just had a few quick questions about logging.

1) Can a log file be set to automatically split up after X amount of lines? I often times reach 150-200k lines, and since I log in HTML color the logs could easily reach 10mb+.

2) I know there is an option to automatically log to a file, but it only allows .txt to be set as the file type. Obviously, an HTML file in .txt is pretty hard to decipher, and the person has to change the actual file extension. Could any client-side change be made to make this process a bit easier?

3) Also, I noticed the preamble on the log files (which I use to capture the timestamps) is off center by 1 line, by which I mean a cyan colored line has its corresponding timestamp 1 line down. Is there any way to fix this?

Thanks!
Forral
Top

Posted by Nick Gammon   Australia  (23,072 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 17 May 2010 06:27 AM (UTC)
Message
forral said:

1) Can a log file be set to automatically split up after X amount of lines? I often times reach 150-200k lines, and


Not automatically, but you could make a timer that fires every 5 minutes. This could check the log file size (GetInfo (231)) and if over a limit you choose, it could close the log file and re-open it with an empty filename, which will then use the filename you define for automatic logging.

forral said:

I know there is an option to automatically log to a file, but it only allows .txt to be set as the file type.


You are referring to the file name chooser? Just manually replace the .txt in the box in the logging configuration to .html. I just did that and it worked fine.

forral said:

Also, I noticed the preamble on the log files (which I use to capture the timestamps) is off center by 1 line, by which I mean a cyan colored line has its corresponding timestamp 1 line down. Is there any way to fix this?


I don't think the preamble is off, it just doesn't get coloured, so it might *look* off. You might want to add into the preamble something to set a standard colour, eg.


<font color="lightgray">  (your timestamp) </font>



- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by forral   USA  (79 posts)  Bio
Date Reply #2 on Mon 17 May 2010 06:42 AM (UTC)
Message
Nick Gammon said:

forral said:

1) Can a log file be set to automatically split up after X amount of lines? I often times reach 150-200k lines, and


Not automatically, but you could make a timer that fires every 5 minutes. This could check the log file size (GetInfo (231)) and if over a limit you choose, it could close the log file and re-open it with an empty filename, which will then use the filename you define for automatic logging.

forral said:

I know there is an option to automatically log to a file, but it only allows .txt to be set as the file type.


You are referring to the file name chooser? Just manually replace the .txt in the box in the logging configuration to .html. I just did that and it worked fine.

forral said:

Also, I noticed the preamble on the log files (which I use to capture the timestamps) is off center by 1 line, by which I mean a cyan colored line has its corresponding timestamp 1 line down. Is there any way to fix this?


I don't think the preamble is off, it just doesn't get coloured, so it might *look* off. You might want to add into the preamble something to set a standard colour, eg.


<font color="lightgray">  (your timestamp) </font>






Thanks Nick. I will work on the timer tomorrow, and setting the preamble font color fixed my issue, as well as logging to .html.

The only other question, as I saw in another thread, is that is it possible to log to a different file each time? I can set the 'automatically log to this file' but it keeps appending to that file, which can get rather long...so is there any way for me to be able to split up files logging to log each time the client is open/closed, rather than each time I (dis)connect to the world? Perhaps later on down I will get good enough to sort each days' files automatically into their own folder.

Thanks,
Forral
Top

Posted by Nick Gammon   Australia  (23,072 posts)  Bio   Forum Administrator
Date Reply #3 on Mon 17 May 2010 06:44 AM (UTC)
Message
Build a timestamp into the log file name (click on the ? button to see the various options). Assuming you don't open a new log file every minute, a date/time to the nearest minute should do it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,072 posts)  Bio   Forum Administrator
Date Reply #4 on Mon 17 May 2010 06:46 AM (UTC)
Message
If you do that a simple timer to close the current log file, and open a new one, which fires every hour or two, might be all you need, to keep the files reasonably small.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by forral   USA  (79 posts)  Bio
Date Reply #5 on Mon 17 May 2010 07:04 PM (UTC)
Message
Once again, thank you Nick. This solution seems to be right for me, and now it is just a matter of tweaking it to my liking. Even though we play low-tech text-based games, we're just as picky as any other MMOers.

Thanks again!
Forral
Top

Posted by Daniel P   USA  (97 posts)  Bio
Date Reply #6 on Mon 17 May 2010 07:43 PM (UTC)

Amended on Mon 17 May 2010 07:59 PM (UTC) by Daniel P

Message
Nick Gammon said:
Just manually replace the .txt in the box in the logging configuration to .html. I just did that and it worked fine.


Maybe it's a bit of overkill, but here is my log settings in case anyone finds them useful.

Preamble:

<html>
 <head>
   <title>Log of %N session</title>
 </head>
 <body>
   <table border=0 cellpadding=5 bgcolor="#000000">
   <tr><td>
   <pre><code><font size=2 face="FixedSys, Lucida Console, Courier New, Courier">


Postamble:

</font></code></pre>
</td></tr></table>
</body>
</html>


I've checked on:
Log:
  Output
  Commands
  Notes

Format:
  HTML
  Colour

 Write World Name to Log File

Preamble of Output Lines:
<!--%#c-->





Also, I run MUSHClient from a command prompt, so upon closing it, I will call another script which will timestamp the log file.

It is called Stampme.cmd from http://ss64.com/nt/stampme.txt.

I've replaced the last three lines of the above-mentioned stampme.cmd with:

   ECHO Today is Day: [%_dd%] Month: [%_mm%] Year: [%_yy%]
   ECHO The time is:   [%_hr%]:[%_min%]
   REN "%_pathname%" "%_file%-%_yy%-%_mm%-%_dd% - %_hr%-%_min%%_ext%"


My own command script to run everything, assuming you stored Stampme.cmd in C:\Program Files\MUSHClient\logs and your run script is in C:\Program Files\MUSHClient:

@echo off
MUSHClient.exe
cd logs
Call Stampme.cmd Logfile.html


Edit:
Of course, the timestamping script only works when you actually exit MUSHClient..at least the way I've configured it, and thus will only reflect the date and time at that moment. Also, with that being said, it is recommended that one wait when closing out, as the script needs to initialise and run. I've come up with various mis-stamped files like Achaea-- - _-.html because I shut the computer off too quickly and the shutdown sequence interrupted the script before it had time to actually rewrite the filename.
Top

Posted by forral   USA  (79 posts)  Bio
Date Reply #7 on Tue 18 May 2010 04:43 PM (UTC)
Message
Well I have the logs kind of working, but MUSHclient for some reason doesn't like timestamping the log files each time. I get an error, upon start up, that says: Could not open log fine "C:\Porgram Files\MUSHclient\logs\forral 5/18/2010 12:41:27PM.html"

My settings are:
File preamble:
<html>
<head>
<title>%P - %A %c session</title>
</head>
<body>
<table border=0 cellpadding=5 bgcolor="#000000">

File postamble
</font></code></pre>
</td></tr></table>
</body>
</html>


Checkboxes are:
Logging output + commands, in HTML, color, and write world name to log file.

My directory is: C:\Program Files\MUSHclient\logs\%P %c.html

Output line preamble: <font color="lightgray">%I:%M:%S</font>

Command line premable: <font color="lightgray">%I:%M:%S</font>
Top

Posted by WillFa   USA  (525 posts)  Bio
Date Reply #8 on Tue 18 May 2010 06:40 PM (UTC)
Message
What OS? Vista and Win7 will smack you down for trying to write to Program Files if UAC is turned on.
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #9 on Tue 18 May 2010 07:45 PM (UTC)
Message
WillFa said:

What OS? Vista and Win7 will smack you down for trying to write to Program Files if UAC is turned on.


I've had limited success changing the permissions on the MUSHclient folder to get around this, but Windows likes to change it back as soon as I close the dialog. I have no idea what I did to avoid that, but these days I have MUSHclient in Documents/ anyways.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by forral   USA  (79 posts)  Bio
Date Reply #10 on Tue 18 May 2010 09:04 PM (UTC)
Message
I am encountering this problem while running Windows XP
Top

Posted by Maxhrk   USA  (76 posts)  Bio
Date Reply #11 on Tue 18 May 2010 09:08 PM (UTC)
Message
that why i installed mushclient in public/games/ folder to avoid the hassle. :)
Top

Posted by Fraser   (3 posts)  Bio
Date Reply #12 on Thu 23 Dec 2010 05:31 PM (UTC)
Message
Heh, sorry for digging up this old topic, but here's two problems about logging.

My logs save in .html format, which works fine, colors are there, but...

1) The font of the savefile is bad, since the mud I play, had tiled map, and I've only found like 3 fonts that can show it correctly ingame. Would it be possible for the save file to automatically use the same font as in the world I play.

2) Linebreak doesn't work. This means that the log is in all one long line, making the whole thing gibberish.

I imagine I can fix the font myself, but is there a way to make the logs do linebreak, so like whenever there's a linebreak in the mud, it starts off with a new line in log?
The logs look perfect in .txt file, but in html it all gets jammed up together.

Hope you understand my concern. Any help appreciated.
Top

Posted by Nick Gammon   Australia  (23,072 posts)  Bio   Forum Administrator
Date Reply #13 on Thu 23 Dec 2010 11:38 PM (UTC)
Message
The HTML log will be a jumbled mess unless you use the "log file preamble" and "log file postamble" to put a bit of HTML around the lines.

There is a button in the logging configuration to do that automatically, and also see this post for an improved preamble/postamble:

http://www.gammon.com.au/forum/?id=10838

The important parts there are the font (so you get a monospaced font) and the <pre> ... </pre> parts which tell it to respect the line wrapping in the file.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Fraser   (3 posts)  Bio
Date Reply #14 on Sat 25 Dec 2010 12:15 PM (UTC)
Message
Yay, works now. Thanks a bunch.
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.


44,888 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.