changing cf CLI trace stream from stdout to stderr


Koper, Dies <diesk@...>
 

Hi friends,

Currently, the cf CLI trace when enabled ("CF_TRACE=true", `cf config -trace true` or with the `-v` option) is directed to stdout.
Looking at other commands, e.g. `curl -v`, it's common to send such information to stderr.
This recently came up in the following issue.
https://github.com/cloudfoundry/cli/issues/962

I'd like to know whether anyone would be massively inconvenienced if we fixed this to make cf CLI trace output go to stderr (e.g. because you have many scripts expecting trace to be streamed to stdout, or not expecting anything but errors and warnings to be streamed to stderr)?
Note that trace configured to output to a file would not be affected.

Cheers,
Dies Koper
Cloud Foundry Product Manager - CLI


Hector Rivas Gandara
 

Hello,

Have you tried sending CF_TRACE to /dev/stderr? Like this

CF_TRACE=/dev/stderr cf apps | less

I think it is system specific, but it should work on most of them.

On 25 October 2016 at 04:44, Koper, Dies <diesk(a)fast.au.fujitsu.com> wrote:

Hi friends,



Currently, the cf CLI trace when enabled (“CF_TRACE=true”, `cf config
–trace true` or with the `-v` option) is directed to stdout.

Looking at other commands, e.g. `curl -v`, it’s common to send such
information to stderr.

This recently came up in the following issue.

https://github.com/cloudfoundry/cli/issues/962



I’d like to know whether anyone would be massively inconvenienced if we
fixed this to make cf CLI trace output go to stderr (e.g. because you have
many scripts expecting trace to be streamed to stdout, or not expecting
anything but errors and warnings to be streamed to stderr)?

Note that trace configured to output to a file would not be affected.



Cheers,

Dies Koper
Cloud Foundry Product Manager - CLI




--
Regards
Hector Rivas | GDS / Multi-Cloud PaaS


Mike Youngstrom <youngm@...>
 

This change wouldn't effect any of my users.

Mike

On Mon, Oct 24, 2016 at 9:44 PM, Koper, Dies <diesk(a)fast.au.fujitsu.com>
wrote:

Hi friends,



Currently, the cf CLI trace when enabled (“CF_TRACE=true”, `cf config
–trace true` or with the `-v` option) is directed to stdout.

Looking at other commands, e.g. `curl -v`, it’s common to send such
information to stderr.

This recently came up in the following issue.

https://github.com/cloudfoundry/cli/issues/962



I’d like to know whether anyone would be massively inconvenienced if we
fixed this to make cf CLI trace output go to stderr (e.g. because you have
many scripts expecting trace to be streamed to stdout, or not expecting
anything but errors and warnings to be streamed to stderr)?

Note that trace configured to output to a file would not be affected.



Cheers,

Dies Koper
Cloud Foundry Product Manager - CLI





Koper, Dies <diesk@...>
 

Hi Hector,

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”.

Regards,
Dies Koper
Cloud Foundry Product Manager - CLI


From: Hector Rivas Gandara [mailto:hector.rivas.gandara(a)digital.cabinet-office.gov.uk]
Sent: Tuesday, October 25, 2016 10:27 PM
To: Discussions about Cloud Foundry projects and the system overall.
Subject: [cf-dev] Re: changing cf CLI trace stream from stdout to stderr

Hello,
Have you tried sending CF_TRACE to /dev/stderr? Like this

CF_TRACE=/dev/stderr cf apps | less
I think it is system specific, but it should work on most of them.

On 25 October 2016 at 04:44, Koper, Dies <diesk(a)fast.au.fujitsu.com<mailto:diesk(a)fast.au.fujitsu.com>> wrote:
Hi friends,

Currently, the cf CLI trace when enabled (“CF_TRACE=true”, `cf config –trace true` or with the `-v` option) is directed to stdout.
Looking at other commands, e.g. `curl -v`, it’s common to send such information to stderr.
This recently came up in the following issue.
https://github.com/cloudfoundry/cli/issues/962

I’d like to know whether anyone would be massively inconvenienced if we fixed this to make cf CLI trace output go to stderr (e.g. because you have many scripts expecting trace to be streamed to stdout, or not expecting anything but errors and warnings to be streamed to stderr)?
Note that trace configured to output to a file would not be affected.

Cheers,
Dies Koper
Cloud Foundry Product Manager - CLI





--
Regards
Hector Rivas | GDS / Multi-Cloud PaaS


Daniel Mikusa
 

Just my $0.02, but I like the current behavior. I find it helpful for
troubleshooting purposes to be able to get the stream of HTTP messages
inline with the output from the cli. It helps to very quickly and easily
establish a timeline and isolate a particular HTTP request / response as
being a problem, like when a response is slow. Just run `CF_TRACE=true cf
...` and watch to see where it pauses.

I like the suggestion in the GH issue.

Perhaps adding the option of specifying CF_TRACE=stderr (and stdout for
consistency, which would be equal to using 1) could be a way to do it.

IMHO, if you did this then the default option would matter a lot less. I'd
still prefer to keep the default behavior to STDOUT, but that's mostly me
just being selfish. As long as I have a way to invoke that stdout behavior
when I need it, I could live with the default changing.

Dan


On Tue, Oct 25, 2016 at 8:10 PM, Koper, Dies <diesk(a)fast.au.fujitsu.com>
wrote:

Hi Hector,



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”.



Regards,

Dies Koper
Cloud Foundry Product Manager - CLI





*From:* Hector Rivas Gandara [mailto:hector.rivas.gandara@
digital.cabinet-office.gov.uk]
*Sent:* Tuesday, October 25, 2016 10:27 PM
*To:* Discussions about Cloud Foundry projects and the system overall.
*Subject:* [cf-dev] Re: changing cf CLI trace stream from stdout to stderr



Hello,

Have you tried sending CF_TRACE to /dev/stderr? Like this

CF_TRACE=/dev/stderr cf apps | less

I think it is system specific, but it should work on most of them.



On 25 October 2016 at 04:44, Koper, Dies <diesk(a)fast.au.fujitsu.com>
wrote:

Hi friends,



Currently, the cf CLI trace when enabled (“CF_TRACE=true”, `cf config
–trace true` or with the `-v` option) is directed to stdout.

Looking at other commands, e.g. `curl -v`, it’s common to send such
information to stderr.

This recently came up in the following issue.

https://github.com/cloudfoundry/cli/issues/962



I’d like to know whether anyone would be massively inconvenienced if we
fixed this to make cf CLI trace output go to stderr (e.g. because you have
many scripts expecting trace to be streamed to stdout, or not expecting
anything but errors and warnings to be streamed to stderr)?

Note that trace configured to output to a file would not be affected.



Cheers,

Dies Koper
Cloud Foundry Product Manager - CLI








--

Regards

Hector Rivas | GDS / Multi-Cloud PaaS


Stefan Mayr
 

Am 26.10.2016 um 02:10 schrieb Koper, Dies:
Hi Hector,



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”.
I can't remember having a pseudo file for stderr in Windows. The OS
provides default handles that can be used to write to stderr - no files.
That's why you have os.Stderr in golang
Maybe you could do the trick with named pipes and makepipe.exe included
in MSSQL - tooling around pipes is very limited in windows.


Regards,

Dies Koper
Cloud Foundry Product Manager - CLI





*From:*Hector Rivas Gandara
[mailto:hector.rivas.gandara(a)digital.cabinet-office.gov.uk]
*Sent:* Tuesday, October 25, 2016 10:27 PM
*To:* Discussions about Cloud Foundry projects and the system overall.
*Subject:* [cf-dev] Re: changing cf CLI trace stream from stdout to stderr



Hello,

Have you tried sending CF_TRACE to /dev/stderr? Like this

CF_TRACE=/dev/stderr cf apps | less

I think it is system specific, but it should work on most of them.



On 25 October 2016 at 04:44, Koper, Dies <diesk(a)fast.au.fujitsu.com
<mailto:diesk(a)fast.au.fujitsu.com>> wrote:

Hi friends,



Currently, the cf CLI trace when enabled (“CF_TRACE=true”, `cf config
–trace true` or with the `-v` option) is directed to stdout.

Looking at other commands, e.g. `curl -v`, it’s common to send such
information to stderr.

This recently came up in the following issue.

https://github.com/cloudfoundry/cli/issues/962



I’d like to know whether anyone would be massively inconvenienced if we
fixed this to make cf CLI trace output go to stderr (e.g. because you
have many scripts expecting trace to be streamed to stdout, or not
expecting anything but errors and warnings to be streamed to stderr)?

Note that trace configured to output to a file would not be affected.



Cheers,

Dies Koper
Cloud Foundry Product Manager - CLI
--

Regards

Hector Rivas | GDS / Multi-Cloud PaaS
Regards,

Stefan


Koper, Dies <diesk@...>
 

Hi Dan,

How would that experience be different if trace went to stderr? Wouldn’t the stream of HTTP messages display inline with the cli output in the same way?

Regards,
Dies Koper
Cloud Foundry Product Manager - CLI


From: Daniel Mikusa [mailto:dmikusa(a)pivotal.io]
Sent: Wednesday, October 26, 2016 11:06 PM
To: Discussions about Cloud Foundry projects and the system overall.
Subject: [cf-dev] Re: Re: Re: changing cf CLI trace stream from stdout to stderr

Just my $0.02, but I like the current behavior. I find it helpful for troubleshooting purposes to be able to get the stream of HTTP messages inline with the output from the cli. It helps to very quickly and easily establish a timeline and isolate a particular HTTP request / response as being a problem, like when a response is slow. Just run `CF_TRACE=true cf ...` and watch to see where it pauses.

I like the suggestion in the GH issue.

Perhaps adding the option of specifying CF_TRACE=stderr (and stdout for consistency, which would be equal to using 1) could be a way to do it.
IMHO, if you did this then the default option would matter a lot less. I'd still prefer to keep the default behavior to STDOUT, but that's mostly me just being selfish. As long as I have a way to invoke that stdout behavior when I need it, I could live with the default changing.

Dan


On Tue, Oct 25, 2016 at 8:10 PM, Koper, Dies <diesk(a)fast.au.fujitsu.com<mailto:diesk(a)fast.au.fujitsu.com>> wrote:
Hi Hector,

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”.

Regards,
Dies Koper
Cloud Foundry Product Manager - CLI


From: Hector Rivas Gandara [mailto:hector.rivas.gandara(a)digital.cabinet-office.gov.uk<mailto:hector.rivas.gandara(a)digital.cabinet-office.gov.uk>]
Sent: Tuesday, October 25, 2016 10:27 PM
To: Discussions about Cloud Foundry projects and the system overall.
Subject: [cf-dev] Re: changing cf CLI trace stream from stdout to stderr

Hello,
Have you tried sending CF_TRACE to /dev/stderr? Like this

CF_TRACE=/dev/stderr cf apps | less
I think it is system specific, but it should work on most of them.

On 25 October 2016 at 04:44, Koper, Dies <diesk(a)fast.au.fujitsu.com<mailto:diesk(a)fast.au.fujitsu.com>> wrote:
Hi friends,

Currently, the cf CLI trace when enabled (“CF_TRACE=true”, `cf config –trace true` or with the `-v` option) is directed to stdout.
Looking at other commands, e.g. `curl -v`, it’s common to send such information to stderr.
This recently came up in the following issue.
https://github.com/cloudfoundry/cli/issues/962

I’d like to know whether anyone would be massively inconvenienced if we fixed this to make cf CLI trace output go to stderr (e.g. because you have many scripts expecting trace to be streamed to stdout, or not expecting anything but errors and warnings to be streamed to stderr)?
Note that trace configured to output to a file would not be affected.

Cheers,
Dies Koper
Cloud Foundry Product Manager - CLI





--
Regards
Hector Rivas | GDS / Multi-Cloud PaaS


Daniel Mikusa
 

Sorry, I didn't explain that very well. Let me try again. In the simplest
case where you're watch it from a terminal / console, yes it would be the
same.

A few cases where this might be an issue:

- bosh errand or CI system is running cf on your behalf and capturing the
output. Display is often STDOUT / STDERR separate.
- when troubleshooting with a user, it's easy to say run `CF_TRACE=true cf
... > full_output.txt`. I suppose this could be done with `CF_TRACE=true
cf ... &> full_output.txt`, but I'm not sure what I'd do on a Windows
system (without bash).

Ultimately I just want something in the cli to get normal output mixed with
trace output in the order things happen to build a timeline for
troubleshooting purposes. It has always annoyed me a bit that
`CF_TRACE=some-file.txt cf ...` doesn't do this (last time I looked, it
just logs trace info, not cli output), but with the current behavior of the
cli it's easy enough to workaround (redirect all to file). If the behavior
changes, it wouldn't be the end of the world, but it would be slightly
harder / more annoying to build the sequence of commands when
troubleshooting.

Hope that explains my concern a bit better.

Thanks,

Dan


On Sun, Oct 30, 2016 at 4:37 AM, Koper, Dies <diesk(a)fast.au.fujitsu.com>
wrote:

Hi Dan,



How would that experience be different if trace went to stderr? Wouldn’t
the stream of HTTP messages display inline with the cli output in the same
way?



Regards,

Dies Koper
Cloud Foundry Product Manager - CLI





*From:* Daniel Mikusa [mailto:dmikusa(a)pivotal.io]
*Sent:* Wednesday, October 26, 2016 11:06 PM
*To:* Discussions about Cloud Foundry projects and the system overall.
*Subject:* [cf-dev] Re: Re: Re: changing cf CLI trace stream from stdout
to stderr



Just my $0.02, but I like the current behavior. I find it helpful for
troubleshooting purposes to be able to get the stream of HTTP messages
inline with the output from the cli. It helps to very quickly and easily
establish a timeline and isolate a particular HTTP request / response as
being a problem, like when a response is slow. Just run `CF_TRACE=true cf
...` and watch to see where it pauses.



I like the suggestion in the GH issue.



Perhaps adding the option of specifying CF_TRACE=stderr (and stdout for
consistency, which would be equal to using 1) could be a way to do it.



IMHO, if you did this then the default option would matter a lot less.
I'd still prefer to keep the default behavior to STDOUT, but that's mostly
me just being selfish. As long as I have a way to invoke that stdout
behavior when I need it, I could live with the default changing.



Dan





On Tue, Oct 25, 2016 at 8:10 PM, Koper, Dies <diesk(a)fast.au.fujitsu.com>
wrote:

Hi Hector,



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”.



Regards,

Dies Koper
Cloud Foundry Product Manager - CLI





*From:* Hector Rivas Gandara [mailto:hector.rivas.gandara@
digital.cabinet-office.gov.uk]
*Sent:* Tuesday, October 25, 2016 10:27 PM
*To:* Discussions about Cloud Foundry projects and the system overall.
*Subject:* [cf-dev] Re: changing cf CLI trace stream from stdout to stderr



Hello,

Have you tried sending CF_TRACE to /dev/stderr? Like this

CF_TRACE=/dev/stderr cf apps | less

I think it is system specific, but it should work on most of them.



On 25 October 2016 at 04:44, Koper, Dies <diesk(a)fast.au.fujitsu.com>
wrote:

Hi friends,



Currently, the cf CLI trace when enabled (“CF_TRACE=true”, `cf config
–trace true` or with the `-v` option) is directed to stdout.

Looking at other commands, e.g. `curl -v`, it’s common to send such
information to stderr.

This recently came up in the following issue.

https://github.com/cloudfoundry/cli/issues/962



I’d like to know whether anyone would be massively inconvenienced if we
fixed this to make cf CLI trace output go to stderr (e.g. because you have
many scripts expecting trace to be streamed to stdout, or not expecting
anything but errors and warnings to be streamed to stderr)?

Note that trace configured to output to a file would not be affected.



Cheers,

Dies Koper
Cloud Foundry Product Manager - CLI








--

Regards

Hector Rivas | GDS / Multi-Cloud PaaS



Hector Rivas Gandara
 

Hi,

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.

--
Regards
Hector Rivas | GDS / Multi-Cloud PaaS