I would like to view logs for one of my Managed VM Modules in the Google Cloud Platform during development (before deploying), and I noticed this command should allow it:
gcloud preview app run --enable-mvm-logs <module name>
However, adding that switch to the usual run command causes the module to crash during load:
INFO: Go VM Deployment process failed: [Errno 104] Connection reset by peer
ERROR: Internal error while starting instance.
Traceback (most recent call last):
File "/home/bakeonandham/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 1823, in _start_instance
if not inst.start():
File "/home/bakeonandham/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/instance.py", line 274, in start
self._runtime_proxy.start()
File "/home/bakeonandham/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/vm_runtime_proxy_go.py", line 130, in start
self._vm_runtime_proxy.start(dockerfile_dir=dst_deployment_dir)
File "/home/bakeonandham/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/vm_runtime_proxy.py", line 196, in start
self._module_configuration.major_version, runtime_config.instance_id)
File "/home/bakeonandham/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/log_manager.py", line 172, in add
_create_table(l)
File "/home/bakeonandham/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/log_manager.py", line 138, in _create_table
response = conn.getresponse()
File "/usr/lib/python2.7/httplib.py", line 1073, in getresponse
response.begin()
File "/usr/lib/python2.7/httplib.py", line 415, in begin
version, status, reason = self._read_status()
File "/usr/lib/python2.7/httplib.py", line 371, in _read_status
line = self.fp.readline(_MAXLINE + 1)
File "/usr/lib/python2.7/socket.py", line 476, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 104] Connection reset by peer
Without the switch, my app runs and deploys fine, and once deployed, the data i'm logging is available in the Dev console.
I did find a way to view logs during development in the terminal where I launched the dev server from, though it's not ideal:
If I use the --verbosity debug flag my output shows up, but only with loglevel debug even though my logged stuff are being logged as Errors. Any other verbosity level doesn't show the output at all.
I am using the Go runtime by the way.
So to summarize, the only way I can seem to view logs using the local dev server environment for Managed VM, is to launch using this command:
gcloud --verbosity debug preview app run <module name>
Even though I log with loglevel Error, if I set --verbosity error, the output never shows in the terminal or anywhere else.
Has anyone been able to get the --enable-mvm-logs switch to work, or is it broken? Any ideas on a better way to view Managed VM log output?