Page 1 of 2

logging with a batch file

Posted: Wed Nov 23, 2005 2:05 am
by Winny
what command do I put in a batch file to make it log to a file ???

I have tried

set LOGFILE="C:\bzflag\logger.txt"

thanks to meteor for the code

but that didn't work

thank a bunch
Win Xp

Posted: Wed Nov 23, 2005 4:07 am
by A Meteorite
It should of worked... I modded it to include "> %LOGFILE%" at the end of the command that starts bzfs. Did you try the whole script? Maybe you overlooked that change I did.

Code: Select all

@echo off

set BZFSPROGRAM="C:\bzflag\bzfs.exe"

set CONFIGFILE="C:\bzflag\tankball_conf.txt"

set LOGFILE="C:\bzflag\logger.txt"

REM ***** Don't change anything below this line! *****

@echo on

%BZFSPROGRAM% -conf %CONFIGFILE% > %LOGFILE%

pause

Re: logging with a batch file

Posted: Wed Nov 23, 2005 11:29 am
by Ice Wewe
Win Xp wrote:what command do I put in a batch file to make it log to a file ???

I have tried

set LOGFILE="C:\bzflag\logger.txt"

thanks to meteor for the code

but that didn't work

thank a bunch
Win Xp
You mean you haven't been logging? :shock: Set up a log before you turn on your computer again! :wink:

Re: logging with a batch file

Posted: Wed Nov 23, 2005 4:48 pm
by brad2901
Ice Wewe wrote:You mean you haven't been logging? :shock: Set up a log before you turn on your computer again! :wink:
You want him to set up logging for his server if his computer is turned off?! :)

Posted: Wed Nov 23, 2005 7:54 pm
by Winny
it seem metoer that that still won't write any info to the logging file????


odd

Re: logging with a batch file

Posted: Wed Nov 23, 2005 8:03 pm
by Ice Wewe
brad2901 wrote:
Ice Wewe wrote:You mean you haven't been logging? :shock: Set up a log before you turn on your computer again! :wink:
You want him to set up logging for his server if his computer is turned off?! :)

That's the general idea, maybe get those lovely expensive data recovery guys to add the log before he turns on his PC... :D
Win Xp wrote:it seem metoer that that still won't write any info to the logging file????


odd
Perhaps you need to (excuse my linux term) 'touch' the file. As in make an empty file where the log is supposed to go. Perhaps it needs something there to overwite?

Posted: Wed Nov 23, 2005 8:09 pm
by Winny
I have a empty file where the log is

Posted: Wed Nov 23, 2005 9:06 pm
by A Meteorite
Win Xp wrote:I have a empty file where the log is
OK, the try deleting the empty file. Can't hurt...

Also try adding another ">" to the other ">". I hear some people have to use two of them. (">>")

Code: Select all

@echo off

set BZFSPROGRAM="C:\bzflag\bzfs.exe"

set CONFIGFILE="C:\bzflag\tankball_conf.txt"

set LOGFILE="C:\bzflag\logger.txt"

REM ***** Don't change anything below this line! *****

@echo on

%BZFSPROGRAM% -conf %CONFIGFILE% >> %LOGFILE%

pause

Posted: Wed Nov 23, 2005 10:14 pm
by joevano
OK the explanation for the > versus the >> is that > creates a new file when the log is started and >> appends to the existing file. If you use > it will delete the file that is there and start a new blank file. Also the only thing that will be returned in the way you are using it are things that are sent to 'stout' or the return value of the executing program, if it returns one.

What kind of logs are you looking for?? Something like what thumper has in tect format? I do not think that the bzfs file echos all of that info out through 'stout' so it can be captured using the method you are trying. Thumper uses plugins to get that information. I saw no mention on the manual page for bzfs to send that info to a file either.

Posted: Wed Nov 23, 2005 10:23 pm
by Winny
I am trying to get the following

/set
/kill
ip addresses
and all conversation

Posted: Wed Nov 23, 2005 10:36 pm
by The Knights Who Say Ni
i would also be intresed in a similar plugin but mabey capture for more things (for windows)

Posted: Wed Nov 23, 2005 11:46 pm
by joevano
I could be wrong, but I do think it requires a plug-in to gather that info...

Posted: Wed Nov 23, 2005 11:47 pm
by A Meteorite
Win Xp wrote:I am trying to get the following

/set
/kill
ip addresses
and all conversation
Bzfs logs everything. IP Adresses, commands used (including /set and /kill), and all conversation (including PMs to other players!!). It can even be used for bad stuff (collecting /register & /identify passwords :twisted: ).

But it also logs lots of other stuff, that can be considered "useless"... it can be a headache th wade through bzfs logs.

Even better than a plugin, to have the functionality of logging built-in to bzfs! (with options on what sort of stuff you want on server startup)

Posted: Wed Nov 23, 2005 11:59 pm
by dango
if you run bzfs from a command prompt you can just

Code: Select all

bzfs <options> >> Drive:/Path/To/File

Masterbot

Posted: Thu Nov 24, 2005 4:56 am
by RPG
Masterbot does what you want to do. It makes logs, clean logs, with all the info. you want. And then it does it in a pretty way, so it's appealing to look at. I've attached a beta of the plugin. All it does is logs, and it will place the logs in the folder that bzfs.exe is in, with the filename set to the date that the logs were taken on. They'll look like ugly, plaintext files, because they are. I'll make a PHP script, which I'll host online, that will convert them to pretty, HTML. Right now an application does that.

Sorry if I confused you. Just try it out, ok? :D

Posted: Thu Nov 24, 2005 4:17 pm
by The Knights Who Say Ni
it dosent seem to achley make the logs
im using 2.0.5b2

Posted: Thu Nov 24, 2005 5:11 pm
by RPG
oliver browne wrote:it dosent seem to achley make the logs
im using 2.0.5b2
You have to load the plugin into BZFS first.

Posted: Thu Nov 24, 2005 6:13 pm
by The Knights Who Say Ni
umm what into the code or -loadplugin ...

Posted: Thu Nov 24, 2005 6:41 pm
by A Meteorite
oliver browne wrote:umm what into the code or -loadplugin ...
Start BZFS using -loadplugin:

Code: Select all

bzfs -loadplugin /path/to/masterbot.dll
I don't know the paths for BZFS on Windows, but if you've ever run BZFS before this should be easy. :)

Posted: Thu Nov 24, 2005 6:53 pm
by The Knights Who Say Ni
thats what i did and it dosent create the file and i thought that it might only create the file when something happend so i sent few messages and it still didnt create the file

Posted: Thu Nov 24, 2005 6:59 pm
by RPG
oliver browne wrote:thats what i did and it dosent create the file and i thought that it might only create the file when something happend so i sent few messages and it still didnt create the file
You have to have at 10 events in BZFS before it's written to a file. Each one of these things counts as an event: Player join, player exit, chat message, and death.

Just do 10 of those, and it'll make the file. It does it every 10 instead of every time to keep BZFS running efficiently.

Posted: Thu Nov 24, 2005 7:16 pm
by The Knights Who Say Ni
ow ok thanks that would explain it and it works its really cool

one more thing if you say had a server running its recording and then you shut down the server and then start it up ag ain and record dose it record to the same file if so then does it record over it (even if its ont the same day and if its not)

so really all of it...

Posted: Thu Nov 24, 2005 7:54 pm
by RPG
Whenever you start up BZFS, the plugin searches for a file with the name of today's date. If a file exists that is named today's date (such as "11-24-2005.txt"), then it will continue logging at the end of that file. If that file doesn't exist, it will create it and start from scratch.

Posted: Thu Nov 24, 2005 8:02 pm
by Winny
is there code to start the materbot with a batch file ?

Posted: Thu Nov 24, 2005 8:07 pm
by The Knights Who Say Ni
try this

Code: Select all

@echo off

set BZFSPROGRAM="C:\Program Files\BZFlag2.0.5b2\bzfs.exe"

set CONFIGFILE="C:\bzflagstuff\config.conf"

set PLUGIN="C:\bzflag\MasterBot.dll" 

REM ***** Don't change anything below this line! *****

@echo on

%BZFSPROGRAM% -conf %CONFIGFILE% -plugin %PLUGIN%

pause 
and obvisly change the path to where ever the plugin is