William
William

Reputation: 20197

Map JUL levels to AppEngine web console levels

The AppEngine web console allows filtering of different log levels:

AppEngine uses java.utils.logging (JUL) but JUL defines different log-levels to those used in the web console, namely:

In code this means that logging at INFO or WARING works well. LOG.info("some info message); LOG.warning("some warn message");

NB I have /logging.properties with

# Set the default logging level for all loggers
.level = ALL

But no log shows: from

 LOG.fine("some fine message);
 LOG.finer("some finer message);
 LOG.finest("some finest message);

What code do I write to get logs to appear at DEBUG in the web console?

Upvotes: 2

Views: 145

Answers (2)

Eng.Fouad
Eng.Fouad

Reputation: 117569

Just for reference:

  • enter image description here DEBUG: FINEST, FINER, FINE, CONFIG.
  • enter image description here INFO: INFO.
  • enter image description here WARN: WARNING.
  • enter image description here ERROR: SEVERE.
  • enter image description here CRITICAL: Logging serious errors by Google App Engine, like when uncaught exceptions are propagated to servlet container causing HTTP 500 server error.

Upvotes: 1

Mario
Mario

Reputation: 1230

There are two ways:

  1. To add the following to your code:

        import java.util.logging.Level;
    
        .
        .
        .
        LOG.setLevel(Level.ALL);
    
        LOG.warning("Warning message logged");
        LOG.severe("severe debug message logged");
        LOG.info("info message logged");
        LOG.config("config message logged");
        LOG.fine("some fine message");
        LOG.finer("some finer message");
        LOG.finest("some finest message");
    
  2. The second option is to add your logging.properties file to appengine-web.xml as suggested here:

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

Note it should be located under WEB-INF or change that location in the previous file.

Upvotes: 0

Related Questions