views:

995

answers:

1

According to the documentation for Google App Engine for Java:

The App Engine Java SDK includes a template logging.properties file, in the appengine-java-sdk/config/user/ directory. To use it, copy the file to your WEB-INF/classes directory (or elsewhere in the WAR), then the system property java.util.logging.config.file to "WEB-INF/classes/logging.properties" (or whichever path you choose, relative to the application root). You can set system properties in the appengine-web.xml file, as follows:

<appengine-web-app xmlns="http://appengine.google.com/ns/1.0"&gt;
    ...

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

</appengine-web-app>

The Google Plugin for Eclipse new project wizard creates these logging configuration files for you, and copies them to WEB-INF/classes/ automatically. For java.util.logging, you must set the system property to use this file.

If your write to standard out or standard error, that will automatically get logged as INFO or WARNING.

So, why do you need to use a logging.properties file?

Does this give you some additional control over your logging?

+1  A: 

If you want to use more specific logging info, like some DEBUG.

This way you can log more info during development, and you don't need to change your code when you put your code in production.

Personal example: When I code, I log a lot of info ( logging Level FINE, and FINEST). When I send my application to tester, they use DEBUG level. In production (to public) only INFO, WARNING and SEVERE are log.

In conclusion , this give you more control, and you don't have to change any line of code.

For more info about logging in java : here

Nettogrof
Thanks. That's very helpful.
Viktor Gavras