Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why would you use logging.properties if App Engine automatically logs stdout & stderr to INFO & WARNING?

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">
    ...

    <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?

like image 206
Viktor Gavras Avatar asked Oct 05 '09 01:10

Viktor Gavras


1 Answers

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

like image 145
Nettogrof Avatar answered Oct 19 '22 13:10

Nettogrof