Re: changing cf CLI trace stream from stdout to stderr

Hector Rivas Gandara


Sorry for the late response.

I have not been able to find a way to make that work on Windows.

CF_TRACE=/dev/stderr just creates a “dev” directory in the root of the
drive you run cf from with a file called “stderr”.

Indeed the /dev/std{out,err} thing is implemented by the OS.

I'm not a windows user by myself, but I read somewhere that bash emulates
that. Can you try on bash.

Also, you can play around with named pipes (which I don't know if it works
on Windows). For instance:

mkfifo /tmp/stderr # Create name pipe
cat /tmp/stderr 1>&2 & # Read from that pipe and write in stderr
CF_TRACE=/tmp/stderr cf apps # Run CF and send the trace output to
the named pipe

If you want ot mix the stdout and stderr, this hackery would work:

cat /tmp/stderr | tee /tmp/cf_trace_combined.txt 1>&2 & # read the
stderr fifo and write it to STDERR and to a file
CF_TRACE=/tmp/stderr cf apps | tee /tmp/stderr # Write the cf STDOUT
to the fifo

If you change the `cat` to cat /tmp/stderr > /tmp/cf_trace_combined.txt &
, you will get the combined output to that file.

Anyway, yes, indeed, all this would be more easy if the application
provides the feature itself.

Hector Rivas | GDS / Multi-Cloud PaaS

Join to automatically receive all group messages.