Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Correctly suffix stdout logfile name with 'stdout' string. #294

merged 1 commit into from

3 participants


If I start goliath with:

$ ruby myapp.rb -l mylog.log -dsv

I expect the stdout logfile to be named mylog_stdout.log, and not mylog.log_stdout.log, which is the current behaviour.

This PR correctly handles logfile extension to get the stdout file named as expected.


I'm wondering if we should be appending stdout at all? /cc @dj2


Yea, I'm not sure why I did that originally. I think we should just drop the _stdout appending and log to the requested log file.


I understand, but I think completely removing stdout logfile would require a little refactor. I'm not so familiar with the logger code in Goliath, are you planning to do this change?


@Juanmcuello I'm only suggesting we drop the _stdout suffix and write to exact filename specified from the CLI.


@igrigorik , at the moment, when the server is started with -l mylog.log -dsv two log files are created: mylog.log and mylog.log_stdout.log.

If we drop the _stdout suffix and log everything to mylog.log we end up with duplicated entries, because the entries that were previously written to mylog.log_stdout.log are now written to mylog.log and many of these entries are already logged to that file.

Or maybe I'm missing something?


Ah, interesting... been a while since I've looked at that. Trying to remember why created the separation to begin with :confused:. Dan? :)


In one case it's things that you specifically log. For the second, it's things that would get spit out to the console.

Does this code open the correct file if there is no extension provided? So, if I just do -l stdout?


It does. If you just do -l stdout it opens(or creates) a file named stdout. If you do -l stdout -d two files will be opened(or created), stdout and stdout_stdout.

If you instead use an extension for the log file, say -l mylog.log, the files will be mylog.log and mylog_stdout.log

@dj2 dj2 merged commit 77a6819 into postrank-labs:master

1 check failed

Details continuous-integration/travis-ci The Travis CI build could not complete due to an error

lgtm. Thanks for the patch, and the explanations.

@Juanmcuello Juanmcuello deleted the Juanmcuello:fix-stdout-log branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  lib/goliath/runner.rb
3  lib/goliath/runner.rb
@@ -211,7 +211,8 @@ def run
- stdout_log_file = "#{File.dirname(@log_file)}/#{File.basename(@log_file)}_stdout.log"
+ log_extension = File.extname(@log_file)
+ stdout_log_file = "#{File.dirname(@log_file)}/#{File.basename(@log_file, log_extension)}_stdout#{log_extension}"
STDOUT.reopen(stdout_log_file, "a")
Something went wrong with that request. Please try again.