pantheon-systems / terminus

The Pantheon CLI — a standalone utility for performing operations on the Pantheon Platform
https://pantheon.io
Other
318 stars 196 forks source link

Pipe Terminus output to log #1592

Open danielbachhuber opened 7 years ago

danielbachhuber commented 7 years ago

When I try:

terminus wp solr-demo-redux.dev -- index-movies > index-movies.log

I expected STDOUT to be logged to index-movies.log. The observed behavior is that nothing is written to index-movies.log.

When I created an index-movies.sh file containing:

terminus wp solr-demo-redux.dev -- index-movies

And ran:

bash index-movies.sh > index-movies.log

I expected STDOUT to be logged to index-movies.log. The observed behavior is that nothing is written to index-movies.log.

What's the recommended way to log Terminus output?

greg-1-anderson commented 7 years ago

This works for me using the latest HEAD of master on a mac. Are you using the latest version of Terminus? What OS?

danielbachhuber commented 7 years ago

Are you using the latest version of Terminus?

Yes

What OS?

CentOS release 6.8

digisavvy commented 7 years ago

I'm wondering about this, too. I tried setting verbosity with -v and also tried to output to a text file and it didn't log any details in the file.

joshkoenig commented 7 years ago

Capturing output works for me:

joshk@steppinrazor ~$ terminus wp solr-demo-redux.dev -- core version > outfile
 [warning] This environment is in read-only Git mode. If you want to make changes to the codebase of this site (e.g. updating modules or plugins), you will need to toggle into read/write SFTP mode first.
 [notice] Command: solr-demo-redux.dev -- 'wp core version' [Exit: 0]
joshk@steppinrazor ~$ cat outfile
4.7.2

However I'm not on CentOS. That should be easy to test though.

I think we also want to separate the issue of "what is the verbose output for a command look like".

@digisavvy - can you confirm that the output from -v to the screen is what you want? If not, then we should separate that issue from whether or not it can be piped to a file.

digisavvy commented 7 years ago

@joshkoenig - Thanks for the reply. What I was after was to get the output piped to a file. Sorry for the lack of clarity there. =)

greg-1-anderson commented 7 years ago

@digisavvy Output from the logger goes to stderr, not stdout. So:

terminus ... 2>logfile.txt >output.txt

Or:

terminus ... >outputWithLogs.txt 2>&1