0

I know that when you run a Google App Engine project locally you can view Log statements in your API methods:

log.warning("Some warning because you did something");

But can you view those logs for a deployed project? When I go to Logging in the google developers console I can see logs for various actions of my API but I cannot see my custom logs I put into my methods like the one above.

I am using Java.

Micro
  • 10,303
  • 14
  • 82
  • 120

2 Answers2

0

There are multiple ways you can achieve this. Though I suggest using one of these two:

  • Use google's logging library which will write logs for you and they will be available in log viewer and you can export them to your cloud storage or use them as pub/sub events. https://cloud.google.com/logging/docs/api/libraries
  • If you just want your logs to be visible in the log viewer, another alternative is to use a logging library which writes the logs to syslog (http://www.networkmanagementsoftware.com/what-is-syslog/) and use google-fluentd on your instance. This will collect your custom logs as well as any other event logs to the log viewer.
Vikram Tiwari
  • 3,615
  • 1
  • 29
  • 39
0

I had to go into logging.properties in my project and change:

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

to

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

Now it works. Not sure why though.

Micro
  • 10,303
  • 14
  • 82
  • 120
  • Hm, are you by any chance using Java? If so it probably makes sense. From https://cloud.google.com/appengine/docs/java/logs/#Java_writing_application_logs: "Notice that the default log level in logging.properties is WARNING, which suppresses INFO messages from the output. To change the log level for all classes in your app, edit the logging.properties file to change the level. For example you could change .level = WARNING to .level = INFO." – Dan Cornilescu Apr 08 '16 at 18:44
  • @DanCornilescu Yes. I am using Java. Thank you for finding the doc on that! – Micro Apr 08 '16 at 19:07