logging with a batch file

Place for people to discuss public servers, and also for admins to lay out the details of their servers
User avatar
Winny
Grouchy
Grouchy
Posts: 2381
Joined: Wed Aug 24, 2005 12:27 am
Location: Ottawa eh?
Contact:

logging with a batch file

Post 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
User avatar
A Meteorite
Private First Class
Private First Class
Posts: 1786
Joined: Thu Apr 28, 2005 12:56 am
Location: California, U.S.
Contact:

Post 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
Image
Owner @ BZFX
Core Admin @ CAN

Email me: bzmet…@gmail.com
Ice Wewe
Private First Class
Private First Class
Posts: 230
Joined: Sun Jan 09, 2005 10:17 pm

Re: logging with a batch file

Post 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:
brad2901
Private First Class
Private First Class
Posts: 223
Joined: Sun Sep 12, 2004 9:17 am
Location: UK
Contact:

Re: logging with a batch file

Post 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?! :)
User avatar
Winny
Grouchy
Grouchy
Posts: 2381
Joined: Wed Aug 24, 2005 12:27 am
Location: Ottawa eh?
Contact:

Post by Winny »

it seem metoer that that still won't write any info to the logging file????


odd
Ice Wewe
Private First Class
Private First Class
Posts: 230
Joined: Sun Jan 09, 2005 10:17 pm

Re: logging with a batch file

Post 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?
User avatar
Winny
Grouchy
Grouchy
Posts: 2381
Joined: Wed Aug 24, 2005 12:27 am
Location: Ottawa eh?
Contact:

Post by Winny »

I have a empty file where the log is
User avatar
A Meteorite
Private First Class
Private First Class
Posts: 1786
Joined: Thu Apr 28, 2005 12:56 am
Location: California, U.S.
Contact:

Post 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
Image
Owner @ BZFX
Core Admin @ CAN

Email me: bzmet…@gmail.com
User avatar
joevano
General
General
Posts: 1863
Joined: Sat Jun 18, 2005 1:08 pm
Location: South Bend, Indiana, USA

Post 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.
User avatar
Winny
Grouchy
Grouchy
Posts: 2381
Joined: Wed Aug 24, 2005 12:27 am
Location: Ottawa eh?
Contact:

Post by Winny »

I am trying to get the following

/set
/kill
ip addresses
and all conversation
User avatar
The Knights Who Say Ni
Private First Class
Private First Class
Posts: 556
Joined: Mon Sep 26, 2005 7:21 pm
Location: Uplyme, England
Contact:

Post by The Knights Who Say Ni »

i would also be intresed in a similar plugin but mabey capture for more things (for windows)
Image
Sig Made By AlliedArmour

TGPH
User avatar
joevano
General
General
Posts: 1863
Joined: Sat Jun 18, 2005 1:08 pm
Location: South Bend, Indiana, USA

Post by joevano »

I could be wrong, but I do think it requires a plug-in to gather that info...
User avatar
A Meteorite
Private First Class
Private First Class
Posts: 1786
Joined: Thu Apr 28, 2005 12:56 am
Location: California, U.S.
Contact:

Post 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)
Image
Owner @ BZFX
Core Admin @ CAN

Email me: bzmet…@gmail.com
dango
Private First Class
Private First Class
Posts: 1400
Joined: Sun Feb 06, 2005 5:40 pm
Location: Somewhere over there.

Post by dango »

if you run bzfs from a command prompt you can just

Code: Select all

bzfs <options> >> Drive:/Path/To/File
Image
User avatar
RPG
Lieutenant, Junior Grade
Lieutenant, Junior Grade
Posts: 2015
Joined: Fri Sep 17, 2004 2:37 am
Location: Chicago, Illinois
Contact:

Masterbot

Post 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
Attachments
masterbot.zip
Masterbot Beta
(65.11 KiB) Downloaded 128 times
User avatar
The Knights Who Say Ni
Private First Class
Private First Class
Posts: 556
Joined: Mon Sep 26, 2005 7:21 pm
Location: Uplyme, England
Contact:

Post by The Knights Who Say Ni »

it dosent seem to achley make the logs
im using 2.0.5b2
Image
Sig Made By AlliedArmour

TGPH
User avatar
RPG
Lieutenant, Junior Grade
Lieutenant, Junior Grade
Posts: 2015
Joined: Fri Sep 17, 2004 2:37 am
Location: Chicago, Illinois
Contact:

Post 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.
User avatar
The Knights Who Say Ni
Private First Class
Private First Class
Posts: 556
Joined: Mon Sep 26, 2005 7:21 pm
Location: Uplyme, England
Contact:

Post by The Knights Who Say Ni »

umm what into the code or -loadplugin ...
Image
Sig Made By AlliedArmour

TGPH
User avatar
A Meteorite
Private First Class
Private First Class
Posts: 1786
Joined: Thu Apr 28, 2005 12:56 am
Location: California, U.S.
Contact:

Post 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. :)
Image
Owner @ BZFX
Core Admin @ CAN

Email me: bzmet…@gmail.com
User avatar
The Knights Who Say Ni
Private First Class
Private First Class
Posts: 556
Joined: Mon Sep 26, 2005 7:21 pm
Location: Uplyme, England
Contact:

Post 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
Image
Sig Made By AlliedArmour

TGPH
User avatar
RPG
Lieutenant, Junior Grade
Lieutenant, Junior Grade
Posts: 2015
Joined: Fri Sep 17, 2004 2:37 am
Location: Chicago, Illinois
Contact:

Post 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.
User avatar
The Knights Who Say Ni
Private First Class
Private First Class
Posts: 556
Joined: Mon Sep 26, 2005 7:21 pm
Location: Uplyme, England
Contact:

Post 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...
Image
Sig Made By AlliedArmour

TGPH
User avatar
RPG
Lieutenant, Junior Grade
Lieutenant, Junior Grade
Posts: 2015
Joined: Fri Sep 17, 2004 2:37 am
Location: Chicago, Illinois
Contact:

Post 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.
User avatar
Winny
Grouchy
Grouchy
Posts: 2381
Joined: Wed Aug 24, 2005 12:27 am
Location: Ottawa eh?
Contact:

Post by Winny »

is there code to start the materbot with a batch file ?
User avatar
The Knights Who Say Ni
Private First Class
Private First Class
Posts: 556
Joined: Mon Sep 26, 2005 7:21 pm
Location: Uplyme, England
Contact:

Post 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
Image
Sig Made By AlliedArmour

TGPH
Post Reply