Checking To See If An Application Is In Production

Sometimes an application needs to be able to tell if it’s in production (deployed on App Engine servers) or in development (deployed on the dev appserver on a developer’s local machine). You can test this by querying the SystemProperty class. Here’s a code example:

String runtime_env = SystemProperty.environment.value().toString(); 
if (runtime_env.equalsIgnoreCase("Production")) {
    //This application is in production. Do something special.
}
else {
    //This application is NOT in production (perhaps the dev appserver)
}

Remember to import the appropriate class:

import com.google.appengine.api.utils.SystemProperty;