Jump to content

Single player is not generating a log file...


Cadamier

Recommended Posts

I didn't want to use this but I ended up using the batch file for the dedi...  Can someone edit to make it just for SP please? lol

 

 

@echo off
rem Starts a dedicated server
rem
rem -quit, -batchmode, -nographics: Unity commands
rem -configfile              : Allows server settings to be set up in an xml config file. Use no path if in same dir or full path.
rem -dedicated                    : Has to be the last option to start the dedicated server.

set LOGTIMESTAMP=


IF EXIST 7DaysToDieServer.exe (
    set GAMENAME=7DaysToDieServerZ
    set LOGNAME=output_log_dedi
) ELSE (
    set GAMENAME=7DaysToDie
    set LOGNAME=output_log
)

:: --------------------------------------------
:: REMOVE OLD LOGS (only keep latest 20)

REM for /f "tokens=* skip=19" %%F in ('dir %GAMENAME%_Data\%LOGNAME%*.txt /o-d /tc /b') do del %GAMENAME%_Data\%%F

:: --------------------------------------------
:: BUILDING TIMESTAMP FOR LOGFILE

:: Check WMIC is available
WMIC.EXE Alias /? >NUL 2>&1 || GOTO s_start

:: Use WMIC to retrieve date and time
FOR /F "skip=1 tokens=1-6" %%G IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') DO (
    IF "%%~L"=="" goto s_done
    Set _yyyy=%%L
    Set _mm=00%%J
    Set _dd=00%%G
    Set _hour=00%%H
    Set _minute=00%%I
    Set _second=00%%K
)
:s_done

:: Pad digits with leading zeros
Set _mm=%_mm:~-2%
Set _dd=%_dd:~-2%
Set _hour=%_hour:~-2%
Set _minute=%_minute:~-2%
Set _second=%_second:~-2%

Set LOGTIMESTAMP=__%_yyyy%-%_mm%-%_dd%__%_hour%-%_minute%-%_second%

:s_start


:: --------------------------------------------
:: STARTING SERVER


echo|set /p="251570" > steam_appid.txt
REM set SteamAppId=251570
REM set SteamGameId=251570

set LOGFILE=D:\7 Days To Die\Logs\%LOGNAME%%LOGTIMESTAMP%.txt


echo Writing log file to: %LOGFILE%

start %GAMENAME% -logfile "%LOGFILE%" -configfile=serverconfig.xml

Link to comment
Share on other sites

22 minutes ago, Cadamier said:

I didn't want to use this but I ended up using the batch file for the dedi...  Can someone edit to make it just for SP please?

If your 7d2d executable for whatever reason doesn't create a logfile, it also won't help if you modify the dedicated-server-batch.

 

The game usually ALWAYS creates a logfile. If the launch parameter is not set, it is created at it's default location.

I'm currently on Linux so i can't look up the exact path for windows, but the default location seems to be in your steam installation folder in the subdirectory 7daysToDie_Data.

 

Depending on your system setup it may happen, that your normal user does not have write privileges there. If that happens, 7d2d of course can not create a logfile.

Just to test this, you can try to launch the game with "launch as administrator" and then check for the logfile again (i do not recommend running anything with explicit admin rights forever!)

 

The -logfile launch parameter is usefull, if you want to have the logfile in a different location. Of course your user need to have write access there too. Also to be sure put an full and absolute path there. E.g. "C:\users\<username>\Documents".

 

If it still doesn't work, please post the FULL commandline (the whole text from steam -> 7d2d -> settings -> start parameters, if launched via steam) you use to start the game.

Link to comment
Share on other sites

I had this problem before with my old system and so I created a shortcut to the 7DaysToDie.exe file, and in the Target Box I added: "-logfile" and that worked before.  I've copied my "Steam Installation" of 7D2D over to a different drive D:\ .  This time - New system, tried that, but couldn't remember what the command was:"-logfile" and therefore my original post but this time however it didn't work.  Then - before I read Beelzybub's replay I remembered the 'dedi' shortcut had coding to add the log file and that worked.  So - not having to write batchfiles in like forever I asked to have it cleaned up...  Now with Liesel Wippen's reply I've gone through all permissions and folder properties again.  7D2D folder ("D:\7 Days To Die") Always comes up "Read-only" even after I change it... IE: unselect the read only attrib click apply, window comes up: Bulleted: "Apply changes to this folder, subfolders and files?" Yup!  Then it does so and then I click OK on that folder properties window.  If I go back to that - it will still be set at "Read-only" - even if I don't open it up again and reboot... Back to 7D2D Folder - Securty Tab: All "Users"/"System"/etc has full control of this folder... As well as the 7DaysToDie_Data subfolder and the "Logs" subfolder which I created.  If I run 7DaysToDie.exe no logfile; even if I run it as Administrator via properties box.  "Launcher issue:  Weird!  Now I get "7 Days To Die Launcher Failed to execute : 740. Press OK to ignore and risk data corruption.  Press Abort to kill the program."  "ABORT!"  Well previously I tried adding "-logfile" there without and then with the 'logs folder' (D:\7 Days To Die\Logs) and still no logfile.  "We/'I'" run a bunch of mods so I don't even mess with EAC... The 'runme.bat' that's the edited version of the startdedi.bat is the only way I'm able to get a log file.  I even went so far as to get to UAC and slide the slider all the way down, and that doesn't help either.

Link to comment
Share on other sites

50 minutes ago, Cadamier said:

Well previously I tried adding "-logfile" there without and then with the 'logs folder' (D:\7 Days To Die\Logs) and still no logfile. 

Just to make sure: That "-logfile" NEEDS to be followed by a path. Using it without a path, my even be the reason why you don't get one.

It's not a switch to turn the logfile on or off, it is a parameter that specifies the path.

 

Next one, and i think that's the point and also the reason why the dedi.bat works:

If the path contains spaces, you need to quote it. (The (windows) internal reason is, because arguments are separated by spaces, so if you do it like this, 7d2d.exe sees 5 separate arguments. So in this case it tries to put the logfile at D:\7 because "Days", "To" and "Die\Logs" are seen as separate arguments, but the game doesn't know them)

So literally you need to do this:

-logfile "D:\7 Days To Die\Logs"

 

The reason why the dedi.bat probably works is, because it doesn't use the command line parameter but an environment variable. And maybe this set command is able to handle spaces.

 

set LOGFILE=D:\7 Days To Die\Logs\%LOGNAME%%LOGTIMESTAMP%.txt 

 

You can also try to add a permanent environment variable to your system by adding it to the windows environment settings. (Can't explain how to get there, because i've still booted linux ;)) That should for sure have no problem with spaces.

You can always check if an environment variable is set by using "echo %LOGFILE%" in a command prompt. If this returns the full path, it is set correctly.

 

Generic approach if you have trouble with something that uses any paths, ALWAYS try using paths without any spaces first.

 

Edit:

The environment variable from the script also contains the filename, as you can see. I'm not sure whether the logfile argument also needs the filename, or just the path and uses an auto-generated filename then. So if it still doesn't work, probably also try the parameter with a filename added. Something like

-logfile "D:\7 Days To Die\Logs\myLogfile.txt"

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...