Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logging in a Google Cloud Endpoint

I need to debug my Google Cloud Endpoint after it is deployed to AppEngine. I am trying to write entries to the log but they never show up in the log viewer on the Google Developers Console. Here is the logging code I created in Android Studio:

import java.util.logging.Logger;
...
public class MyEndpoint {
    private static final Logger log = Logger.getLogger(MyEndpoint.class.getName());
...
log.info("message to log");

This code executes in the cloud without error but nothing shows up in the log. What am I doing wrong?

like image 299
Jim Vitek Avatar asked May 30 '26 09:05

Jim Vitek


1 Answers

The entry is not showing in the log because the default logging level in app engine is: WARNING. Setting the logging level prior to calling log.info() caused the log entry to show in the console as expected. Here is the revised code with setLevel in context:

import java.util.logging.Logger;
...
public class MyEndpoint {
    private static final Logger log =Logger.getLogger(MyEndpoint.class.getName());
...
log.setLevel(Level.INFO);
log.info("message to log");
like image 113
Jim Vitek Avatar answered Jun 01 '26 05:06

Jim Vitek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!