Managed VM and logging with gcloud-maven-plugin

158 views
Skip to first unread message

Paolo Rascuna

unread,
Jun 3, 2015, 9:39:10 AM6/3/15
to google-a...@googlegroups.com
Hi,
I have a java project running on Managed VM, and I use gcloud-maven-plugin to run the app locally, simply

mvn gcloud:run

I would like to see my application logs straight in the console, but so far I can only see the access logs.

The only way that I found is to login directly into the docker container and read the logs from /var/log/app_engine/ but every time I make some code change and I rebuild the docker image, the container I'm logged in of course gets destroyed and I need to log in again... quite a long process so.

I also tried to add more parameters, like

mvn -Dgcloud.log_level=debug -Dgcloud.enable_mvm_logs -X gcloud:run

but still no luck.

Do you guys have any suggestion?

Les Vogel

unread,
Jun 3, 2015, 1:09:45 PM6/3/15
to google-a...@googlegroups.com
There are changes coming to improve things in the next few weeks.  In the mean time, here's what I do:

Make sure .level=INFO or what you need in your logging.properties .  For the class(es) I'm working with I set the class logging explicitly to: com.example.bigtable.managedvms.level=ALL

Then in a separate window, I run the following script on my Mac:

#!/bin/bash
docker logs -f `docker ps -q`


--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/2b2e4858-9771-4964-acb6-c02704a9a0b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Les Vogel | Cloud Developer Relations | le...@google.com | 408-676-7023

Paolo Rascuna

unread,
Jun 4, 2015, 5:49:06 AM6/4/15
to google-a...@googlegroups.com
Thank you Les, but that's not working for me... I tried that already, but that's the docker logs output

$ docker logs -f `docker ps -q`
Info: Limiting Java heap size to: 1456M
Running locally and DBG_ENABLE is set, enabling standard Java debugger agent
Listening for transport dt_socket at address: 5005
2015-06-04 09:05:08.860:INFO::main: Logging initialized @571ms
2015-06-04 09:05:09.001:INFO::main: Redirecting stderr/stdout to /var/log/app_engine/STDERR.2015_06_04.log//var/log/app_engine/STDOUT.2015_06_04.log

Les Vogel

unread,
Jun 4, 2015, 12:05:11 PM6/4/15
to google-a...@googlegroups.com
The important thing was setting the classes your interested in logs for in your: logging.properties if you don't do that, you won't see anything.

From one of mine:

# Set the default logging level for all loggers to INFO
.level = INFO

# Loggers 
com.example.bigtable.managedvms.level=ALL

org.apache.http.level=OFF
org.apache.http.wire.level=OFF
com.google.apphosting.repackaged.org.apache.http.wire.level=OFF

com.google.apphosting.vmruntime.VmAppLogsWriter.level=OFF
com.google.apphosting.vmruntime.VmApiProxyDelegate=OFF
com.google.apphosting.vmruntime.level=OFF



For more options, visit https://groups.google.com/d/optout.

Nick (Cloud Platform Support)

unread,
Jun 4, 2015, 12:34:48 PM6/4/15
to google-a...@googlegroups.com, le...@google.com
Hey Les,

Some of the lines in that logging.properties example are quite interesting. Are they documented anywhere in relation to Managed VMs?

Thanks,

Nick
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscribe@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.

Les Vogel

unread,
Jun 4, 2015, 12:48:58 PM6/4/15
to google-a...@googlegroups.com
Not that I'm aware of, but the source code can be found at https://github.com/GoogleCloudPlatform/appengine-java-vm-runtime/  It's just the messages I didn't want to see in my debug logs.






--
Les Vogel | Cloud Developer Relations | le...@google.com | 408-676-7023

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.

For more options, visit https://groups.google.com/d/optout.

Paolo Rascuna

unread,
Jun 10, 2015, 5:26:38 AM6/10/15
to google-a...@googlegroups.com
Thanks Les, but I already have such lines in my logging.properties and these lines in my appengine-web.xml

    <!-- Configure java.util.logging -->
    <system-properties>
        <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
    </system-properties>

At this point I'm afraid the the logging.properties is not being read (even though, logging into the docker container (docker exec -ti `docker ps -q` bash ) I can see the file in /home/vmagent/appengine-java-vmruntime/webapps/root/WEB-INF

Les Vogel

unread,
Jun 10, 2015, 1:51:28 PM6/10/15
to google-a...@googlegroups.com
Try changing it to "/app/WEB-INF/logging.properties"

Les


For more options, visit https://groups.google.com/d/optout.

Paolo Rascuna

unread,
Jun 11, 2015, 3:38:40 AM6/11/15
to google-a...@googlegroups.com
I'm afraid, that didn't help.

Les Vogel

unread,
Jun 11, 2015, 11:25:16 AM6/11/15
to google-a...@googlegroups.com
One last try, you had it in your email,   /home/vmagent/appengine-java-vmruntime/webapps/root/WEB-INF/logging.properties

<property name="java.util.logging.config.file" value="/home/vmagent/appengine-java-vmruntime/webapps/root/WEB-INF/logging.properties"/>

If the full path doesn't work, I don't know what else to suggest to you.


For more options, visit https://groups.google.com/d/optout.

Ludovic Champenois

unread,
Jun 11, 2015, 12:52:22 PM6/11/15
to google-a...@googlegroups.com
On 6/11/15 8:24 AM, 'Les Vogel' via Google App Engine wrote:
One last try, you had it in your email,   /home/vmagent/appengine-java-vmruntime/webapps/root/WEB-INF/logging.properties

<property name="java.util.logging.config.file" value="/home/vmagent/appengine-java-vmruntime/webapps/root/WEB-INF/logging.properties"/>

If the full path doesn't work, I don't know what else to suggest to you.
Maybe file a bug... Maybe MVM is not setting the defaut current directory to the root of the app?

Ludo

Paolo Rascuna

unread,
Jun 12, 2015, 5:43:01 AM6/12/15
to google-a...@googlegroups.com
Didn't work either... With either mvm enabled or not. 

I can see that the appengine-web.xml gets updated inside the container, but nothing changes apparently
...

Les Vogel

unread,
Jun 12, 2015, 12:18:36 PM6/12/15
to google-a...@googlegroups.com
I've written it up as a bug. 


For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages