Log help

Posted by Arsen on Wed 07 Aug 2002 12:43 AM — 22 posts, 74,863 views.

#0
I cant figure out how to get the logging to work, it says in the MS-DOS window that it is logging, but when I go to the log folder, the only file there is "empty", what should I do? I want to keep the logs so that I can look at them later. HELP! thanks.

Arsen
Australia Forum Administrator #1
I think that is part of the startup shell script. Logging is done to stdout and stderr, and under Unix you would normally redirect the output to a file. eg. something like this:


../src/smaug > ../log/my_log_file.txt


The above redirects stdout but not stderr. I'm not sure if that will do. To redirect both, try this:


../src/smaug &> ../log/my_log_file.txt


This is similar to what is in the startup script. Similar but not identical, perhaps because of variations between the shells ...


set port = 4000
set logfile = ../log/$index.log
# Record starting time
date > $logfile
date > ../area/boot.txt

# Run SMAUG.
../src/smaug $port >&! $logfile


If you are not running under Cygwin, just try simple redirection:


../src/smaug > ../log/my_log_file.txt
Amended on Wed 07 Aug 2002 01:51 AM by Nick Gammon
#2
could you please say that in english? lol
USA #3
I've had a long day, so this may or may not answer your question but...

I'm using version of Smaug compiled for windows and I have two directories (log and logs) that have nothing in them. But when I go into my system directory and open up bugs.txt, there some information in there
Australia Forum Administrator #4
Quote:

could you please say that in english? lol


OK, how you you currently start SMAUG?

Do you have a command (DOS) window, and do something like this:


cd c:\smaug\area
..\src\smaug


If so, just change it to:


cd c:\smaug\area
..\src\smaug > ..\log\my_log_file.txt


What "redirect" means is "send the output to", so you are sending the stuff that normally appears in the window, to a file.
#5
I STILL cannot get my logfile to work, I have tried everything you said, but nothing works
#6
I still have never gotten it to "send the output" to the logfile. My mud runs fine but nothing is added to the file.
Australia Forum Administrator #7
Do you see the messages on the screen?
#8
I have a similar problem -

I don't use cygwin - and to start SMAUG I click an icon on my win98 desktop.

My smaug.exe is not in the AREA subdir it is in the main SMAUG dir. along with a couple of txt files and SmaugGrux.exe

I looked in my log folder and all I see is empty 0KB - I have show all file types and all hidden files marked but this empty doesn't have a file extension.

if you need more info than what I have provided let me know - but my log file doesn't work either.
Australia Forum Administrator #9
You need to redirect stderr. In plain English this means type:


smaug /run 2> log/smauglog.txt


I tried that and it works. In the log subdirectory will now be a file smauglog.txt.
#10
here is exactly what I typed form the DOS command prompt in windows 98Se

C:\smaug /run 2> log/smauglog.txt

what that returned was

SMAUG1.4a
Usage is :-
Smaug -runs as a service, or stand alone
Smaug /run -runs stand alone
Smaug /start -starts this service
Smaug /stop -stops this service
Smaug /install -installs this service
Smaug /remove -removes or un-installs this service
Smaug /status -displays the status of this service
Smaug /help -displays information on this service

C:\smaug>

I checked the log subdir and it was still empty 0kb


Australia Forum Administrator #11
Hmm - I see. It works under NT. :)

See this page, it describes the problem ...


http://home.att.net/~myitpro/support.htm


(search for "stderr" on that page)

Basically the problem is that we want to redirect stderr (standard error output) but can't under Windows 95/98.

That page has links to small programs that will solve the problem. I haven't tested it, but it looks exactly what you want.
Amended on Thu 24 Jul 2003 03:54 AM by Nick Gammon
#12
It's still not working, I typed exactly what you told me to (except I added the necessary address for the smaug file) and nothing happened, the mud didn't even start.
Australia Forum Administrator #13
Did you download one of the helper files I mentioned above? What did you type? (It would be different when using them).
#14
nevermind, I just got it figured out with basically what you told me to do. I checked the file that was supposed to be the log and found out that it was starting the mud, just on no port, so what I typed was:
../src/smaug 3600 /run 2> ../log/log.txt &

thanks Nick
#15
Arsen are you on a win 98 system or NT?
#16
NT
#17
correct me PLEASE if I am wrong here.

Quote:
stdin, stdout, and stderr are simply file pointers, and can be redirected on
dos or unix. there is nothing magic about them that prevents redirection. the
fact that the shell (sh or csh on unix, command.com on dos) does not do this
for you does not prohibit you from doing it yourself. below is the code to a
simple shell which redirects any of these file pointers before executing an
arbitrary command. "redirect -i myin -o myout -e myerr foo arg1 arg2" will
execute the dos command "foo arg1 arg2" with stdin redirected from file myin,
and stdout and stderr redirected to files myout and myerr, respectively. so
information is not lost, myout and myerr are opened for appending, rather
than overwriting. this works on dos or unix.

/*
** redirect -- feed line to shell with stdin/stdout/stderr redirected
**
** usage -- redirect [-i newin] [-o newout] [-e newerr] command
**
** executes command via the shell, but redirects stdin/stdout/stderr first.
** stdout/stderr are appended, not overwritten.
*/



so on my win98SE system
if I type from a dos prompt

C:\redirect -e c:\smaug\log\smauglog.txt

My log files will start working as they are suppose to?
Australia Forum Administrator #18
Judging by their help, what you actually need to do is tell it *what* to redirect, like this:


redirect -e c:\smaug\log\smauglog.txt smaug.exe

You didn't have the command on the end.
#19
well we seem to be making progress. I now have a file in the log subdir called smauglog.txt

When I opened it it had one line in it
"Bad Command or File Name"

Argh!

That was after typing in from the dos prompt
C:smaug\redirect> redirect -e c:\smaug\log\smauglog.txt smaug.exe

it seem sadding the smaug.exe was important to making the file, but now what actually goes in there?

Will I need to type that in each time I start the game?
Australia Forum Administrator #20
"sadding"?

Naturally you need to type the command in the directory where the command actually is, or have it in your path. So, you probably need to do something like this:

c:
cd \smaug
c:\redirect\redirect.exe -e c:\smaug\log\smauglog.txt smaug.exe

You don't have to type that in every time, put it in a batch file.
#21
sadding was a typo of "seems adding".

on the otherhand I now have a SMAUGLOG.txt file.

And I can now actually see all the little eight-legged freaks running around in the code. naturally you know this means there are going to be more questions later on the nature of these horrible little creatures ;-) But for now I'm jumping in my seat with glee as this is working now. As we say in the game HUZZAH NICK!!!

;-)

Thanks much

~G~