Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logging Google App Engine application

I have made my GAE application using the development server, but now when I deploy it to GAE cloud, some features don't work (some elements are missing), but no exceptions are thrown.

Now I'd like to have some logging to my code so I could find out why these things are working in development environment, but not in GAE cloud, but I haven't found a way to log events like I can do with the development server in Eclipse.

So is it possible to log events like you can do in the Eclipse development server?

like image 937
newbie Avatar asked Jun 26 '10 17:06

newbie


People also ask

How do I check Google App Engine logs?

View logs by using the Logs Explorer In the console, go to the Logs Explorer page. In the Resource list, select GAE application, and then click Apply. In the Search all fields field, enter the name of the log that you want to search.

Which logs can be accessed from App Engine UI?

Logs in Google Cloud Platform for App Engine, and all other Google Cloud Platform resources can be viewed in Stackdriver Logging.

What is Google App Engine and how it works?

Google App Engine (GAE) is a platform-as-a-service product that provides web app developers and enterprises with access to Google's scalable hosting and tier 1 internet service. GAE requires that applications be written in Java or Python, store data in Google Bigtable and use the Google query language.


3 Answers

Google App Engine applications written in Java can write information to the log files using java.util.logging.Logger. Log data for an application can be viewed and analyzed using the Administration Console, or downloaded using appcfg.sh request_logs.

More info in the Logging documentation.

like image 67
brainjam Avatar answered Oct 03 '22 12:10

brainjam


You will have to configure logging via java.util.logging.Logger and a logging.properties file in your classpath, preferably in your WEB-INF/classes/ directory. e.g. if you want all your logging to be at the INFO level, the contents of this file should be:

# Set the default logging level for all loggers to INFO
.level = INFO
like image 43
naikus Avatar answered Oct 03 '22 13:10

naikus


The article that was marked as correct answer is a little bit outdated.

Today if you have to read your logs or want remotely debug your app you can use

  • Google Stackdriver Logging (web)
  • Google Stackdriver Error Reporting (web)
  • Google Stackdriver Debug (web)
  • gcloud command-line interface to Google Cloud (console, just type gcloud app logs tail to see latests log from your deployed app)

Java GAE applications still write information to the log files using java.util.logging.Logger.

Again, if you want more information about the Google App Engine Java logging read the documentation.

like image 25
freedev Avatar answered Oct 03 '22 12:10

freedev