ich777 / docker-steamcmd-server

Simple Dockerfile that installs steamcmd and a selected game server
121 stars 98 forks source link

add log file options #12

Closed mrhwick closed 2 years ago

mrhwick commented 2 years ago

If you want to route the valheim server logs to a file, these options will help you to do that.

mrhwick commented 2 years ago

Works in https://hub.docker.com/layers/169072296/mrhwick/mrhwickvh/latest/images/sha256-44ee66c56034f21c51391cba3aca2113f36f64550692cee30a7c006c959e584f?context=repo

ich777 commented 2 years ago

@mrhwick Wouldn't this implementation prevent that you see a output on the Docker logs because you pipe it to a file?

mrhwick commented 2 years ago

You could use the debug flag to see it in docker logs, but if you have another service that wants to watch the output, this places it into a file that can be made accessible to that other service.

ich777 commented 2 years ago

@mrhwick I really don't like this is implemented now, wouldn't it be better you did it like this: ${SERVER_DIR}/valheim_server.x86_64 -name "${SRV_NAME}" -port ${GAME_PORT} -world "${WORLD_NAME}" -password "${SRV_PWD}" -public ${PUBLIC} ${GAME_PARAMS} | tee -a ${SERVER_DIR}/${LOG_FILE}

So you have a output in the Docker log and tee also writes the log to a file, but keep in mind you maybe need a routine that deletes the file after a server restart, otherwise the log file can get pretty big quickly. I also would recommend that you put ${SERVER_DIR}/ in front of ${LOG_FILE} so it gets written to a directory that's readable from the host and also that the user not had to fiddle with file paths.

ich777 commented 2 years ago

@mrhwick now taking a completely different approach, container is now updated, your variables will work just fine that you've created, thank you for the idea.

mrhwick commented 2 years ago

It does not look like this new version outputs logs to a file.

ich777 commented 2 years ago

@mrhwick had to revert the changes since for some users the entire server doesn't work anymore, please give me a few hours and I will update the container so that it respects the option. EDIT: Everything fixed and the container respects the option now. Hope you have also seen the variable DELETE_LOG, with this the log is deleted every time the container is starting/restarting (this defaults to "true").

mrhwick commented 2 years ago

Thanks for your help on this one, I'll see if the new version is logging as expected.