How do I log server output to another folder?
#1
Well Hello World Ac fans ac forum mods/devs whatever you want to be called :D

I am looking for help cause i want to see if i can Execute a Server and make the logs go to a separate folder instead of in my ac folder cause it creates to much logs then i have to delete them and i really want to know what happens on my servers in case people break rules so is there any possible way to do this
Thanks given by:
#2
server.bat >> C:\mysupercoollogfile.txt
will do the trick ;)
Thanks given by:
#3
(29 Mar 13, 08:07PM)ärkefiende Wrote: server.bat >> C:\mysupercoollogfile.txt
will do the trick ;)
I mean When i execute the Server.bat i want the log to go into a separate folder, Like when i execute and i make a new folder the log will go straight to that folder
Thanks given by:
#4
(29 Mar 13, 09:31PM)John Daniels Wrote:
(29 Mar 13, 08:07PM)ärkefiende Wrote: server.bat >> C:\mysupercoollogfile.txt
will do the trick ;)
I mean When i execute the Server.bat i want the log to go into a separate folder folder ;) but i don't really understand what u mean by that :D

Oh gwad... >> is a pipe, you are redirecting the output generated from server.bat to c:\mysupercoollogfile.txt, in his example, change 'c:\' to whatever path you choose... this is basic windows shell scripting, aka batch file scripting...
Thanks given by:
#5
(29 Mar 13, 09:51PM)TheNihilanth Wrote:
(29 Mar 13, 09:31PM)John Daniels Wrote:
(29 Mar 13, 08:07PM)ärkefiende Wrote: server.bat >> C:\mysupercoollogfile.txt
will do the trick ;)
I mean When i execute the Server.bat i want the log to go into a separate folder folder ;) but i don't really understand what u mean by that :D

Oh gwad... >> is a pipe, you are redirecting the output generated from server.bat to c:\mysupercoollogfile.txt, in his example, change 'c:\' to whatever path you choose... this is basic windows shell scripting, aka batch file scripting...

i just dunno how to do that Lolz that's why i want someone to tell me HOW xD
Thanks given by:
#6
1. Open a dos command window.
2. Drag and drop the file server.bat to the dos command window.
3. Type ' > c:\mylogs\mylog.log' without including the single quotes but including a single space at the beginning.
4. Press enter.
5. Done. Your logs will be saved to c:\mylogs\mylog.log. Change mylogs to whatever folder you want, just make sure this folder do exists first before issuing the above command.
Thanks given by:
#7
Did you find hell yet?

Btw, you could also create a batch file to start your server and still use what TheNihilanth said.
Thanks given by:
#8
damn it, i still dont understand,once again i repeat -never ever ever done this before-
Thanks given by:
#9
Rather than saying "I don't understand", tell us where you're stuck with the instructions given.
Thanks given by:
#10
(30 Mar 13, 02:52PM)Aekom Wrote: Rather than saying "I don't understand", tell us where you're stuck with the instructions given.

well i open the ms DOS then i drag the file on the ms DOS then this comes up
"C:\Program Files\AssaultCube_v1.1.0.4\server.bat"

i don't know if i have to change that to where i want my logs to go or what
Thanks given by:
#11
Step #1: Open your AC installation folder.
Step #2: Create a new file titled "start_server.bat".
Step #3: Put the following text in the file: C:\Program Files\AssaultCube_v1.1.0.4\server.bat > C:\logfile.txt
Step #4: Change "C:\logfile.txt" to where you want your log file to go.
Step #5: Double-click "start_server.bat" and enjoy!
Thanks given by:
#12
OR you can use the following windows script, which has a GUI that lets you select the folder where server.bat is and the folder you want to save the folder to, and therefore is more friendly than an ugly-geek-black-pseudoelite window.
Save this script with .vbs extension (For example in notepad, in "Save as" type: myscript.vbs and in file type change it to All files *.*) then just double click in the newly saved file to run it.
It can be improved more, but I didn't feel the need, it's just a quick 5-minutes-script
' Script to change log folder path for AC
' by TheNihilanth
' Permission is granted to modify and distribute this code whatever
' way you like as long you don't modify and include the fisrt two
' lines of this file and you state your derivative work as such.

Const WINDOW_HANDLE = 0
Const OPTIONS = 0

Dim server_bat_path
Dim server_bat_path_full
Dim log_file_path_full
Dim log_file_name

log_file_name = "ac_log.txt"

Set wshell= CreateObject("Shell.Application")
Set server_bat_path = wshell.BrowseForFolder(WINDOW_HANDLE, "Select server.bat folder:", OPTIONS)

If server_bat_path Is Nothing Then
    Wscript.Quit
End If

server_bat_path = server_bat_path.Self.Path
server_bat_path_full = "'" + server_bat_path + "'" + "\server.bat"

Set server_bat_path_destination = wshell.BrowseForFolder(WINDOW_HANDLE, "Select destination folder:",

OPTIONS, "C:\")
If server_bat_path_destination Is Nothing Then
    Wscript.Quit
End If

log_file_path_full = server_bat_path_destination.Self.Path + "\" & log_file_name
    
Set win_shell = WScript.CreateObject("WScript.shell")
win_shell.Run "cmd /K CD "  + server_bat_path + "& server.bat>" + log_file_path_full
WHAT!? You still don't get it right? PM me or wait someone else with more patience helps you :)
Edit: I've just realized it can be cleaned up a bit. I'm being lazy right now.
Edit 2: OP, contact me for further asistance: Here it is the script file Just double click on it, select, the source path (where the server.bat is) and destination path (which folder you want your log be saved). This script was tested on my laptop (windows 7 x64 bits). You might need admin privileges to run it.
Thanks given by: