Log error (stdout and stderr) on command failures (non-zero exits) for Managed Cloud SDK processes
Currently, when command fails (such as ManagedCloudSDK.isUpToDate()) fails, there is no insight into detailed error message, even though, error message is captured in CommandExitException.
https://github.com/GoogleCloudPlatform/appengine-plugins-core/blob/master/src/main/java/com/google/cloud/tools/managedcloudsdk/ManagedCloudSdk.java#L162
Suggest that upon CommandExitException, log error with high priority and/or propagate to the wrapping Exception, or, use it as part of the message of CommandExitException
https://github.com/GoogleCloudPlatform/app-maven-plugin/issues/409 https://github.com/GoogleCloudPlatform/cloud-code-intellij/issues/2662
This makes sense though I don't think it's diagnosed quite right. The problem is that CommandCaller doesn't save stderr into the exception. It should.
Logging here we don't need to do. Including more information in the exception is the right approach.
@elharo it does save error log into CommandExitException. I can see the error message. but no where in the stack trace and/or execution actually displayed it.
Although, the error should probably to be logged and/or surfaced by the consumer of this API instead.
That's a decision for the dependent of this library to make. This library does not attempt to talk to end users.
As described here, I'm no longer sure there is an issue for appengine-plugins-core to resolve. This library makes that information available downstream. It's up to the individual callers to make use of it. Perhaps this bug should be addressed in app-maven-pluign and cloud-code-intellij?
Issue transferred from appengine-plugins-core to app-maven-plugin. I'll create a new one for app-gradle-plugin.
Cross-commenting from the gradle issue; not planning to close the individual plugin ones.
I think this should be resolved here in appengine-plugins-core.
Yes, ManagedSdkVerificationException contains the cause and can return it if prompted, but then it's on the caller (maven and gradle plugins) to get the cause exception, compare its type to CommandExecutionException and get the output.
It would be easier if CommandExecutionException.getErrorLog() got logged before it's wrapped in ManagedSdkVerificationException.