How to hide INFO messages from LocalServiceTestHelper when running GAE / J test cases?

Before deploying my GAE application, I run several hundred unit tests locally. I am using LocalServiceTestHelper to use GAE services like memcache or data warehouse. Setting up and turning off the helper between tests creates a lot of log output.

How can I reconfigure java.util.logging to avoid INFO messages caused by LocalServiceTestHelper completely?

INFO: Local Datastore initialized: Type: Master/Slave Storage: In-memory Feb 08, 2013 7:01:52 PM com.google.appengine.api.taskqueue.dev.LocalTaskQueue init INFO: LocalTaskQueue is initialized Feb 08, 2013 7:01:52 PM com.google.appengine.api.taskqueue.dev.LocalTaskQueue init INFO: Automatic task execution is disabled. Feb 08, 2013 7:01:52 PM org.quartz.simpl.SimpleThreadPool initialize INFO: Job execution threads will use class loader of thread: main Feb 08, 2013 7:01:52 PM org.quartz.core.QuartzScheduler <init> INFO: Quartz Scheduler v.null.null.null created. Feb 08, 2013 7:01:52 PM org.quartz.simpl.RAMJobStore initialize INFO: RAMJobStore initialized. Feb 08, 2013 7:01:52 PM org.quartz.impl.StdSchedulerFactory instantiate INFO: Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' Feb 08, 2013 7:01:52 PM org.quartz.impl.StdSchedulerFactory instantiate INFO: Quartz scheduler version: null.null.null Feb 08, 2013 7:01:52 PM com.google.appengine.api.taskqueue.dev.LocalTaskQueue start_ INFO: Local task queue initialized with base url http://localhost:8080 Feb 08, 2013 7:01:52 PM org.quartz.core.QuartzScheduler shutdown INFO: Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutting down. Feb 08, 2013 7:01:52 PM org.quartz.core.QuartzScheduler standby INFO: Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED paused. Feb 08, 2013 7:01:52 PM org.quartz.core.QuartzScheduler shutdown INFO: Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED shutdown complete. 

EDIT:

I created the src / test / resources / logging.properties file. The file is copied to the target / test classes / before running the tests. It has the following contents:

 com.google.appengine.api.taskqueue.dev.level=SEVERE org.quartz.level=WARNING 

But I still see the same log when running tests.

+4
source share
2 answers

While the logging.properties file in src / test / resources / was well-formed, the maven-surefire plugin was not aware of its location. As described by fooobar.com/questions/255641 / ... , you must set the java.util.logging.config.file system property when configuring the plugin. After applying this simple change, everything works as expected.

 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.4.2</version> <configuration> <systemProperties> <property> <name>java.util.logging.config.file</name> <value>${project.build.directory}/test-classes/logging.properties</value> </property> </systemProperties> ... 
+3
source

Get a copy of logging.properties from your appengine-java-sdk/config/user/ folder and put it in your path to the project class, for example, in the src/test/resources folder, if you use maven, and start setting up your own settings here :

 # A default java.util.logging configuration. # (All App Engine logging is through java.util.logging by default). # # To use this configuration, copy it into your application WEB-INF # folder and add the following to your appengine-web.xml: # # <system-properties> # <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/> # </system-properties> # # Set the default logging level for all loggers to WARNING .level = WARNING 

To configure the log level for a specific package, use:

 # Set logging level for particular package com.google.appengine.api.taskqueue.dev.level = SEVERE org.quartz.level = WARNING 

For a complete setup guide, check out lib/logging.properties in the JRE installation folder.

0
source

All Articles