Author: [log in to unmask] Date: Thu Oct 8 22:10:50 2015 New Revision: 3820 Log: Add logging config which suppresses output for tests. Added: java/trunk/logging/src/main/java/org/hps/logging/config/TestLoggingConfig.java java/trunk/logging/src/main/resources/org/hps/logging/config/test_logging.properties Modified: java/trunk/parent/pom.xml Added: java/trunk/logging/src/main/java/org/hps/logging/config/TestLoggingConfig.java ============================================================================= --- java/trunk/logging/src/main/java/org/hps/logging/config/TestLoggingConfig.java (added) +++ java/trunk/logging/src/main/java/org/hps/logging/config/TestLoggingConfig.java Thu Oct 8 22:10:50 2015 @@ -0,0 +1,27 @@ +package org.hps.logging.config; + +import java.io.IOException; +import java.io.InputStream; +import java.util.logging.LogManager; + +/** + * Read the test logging configuration and load it into the global log manager. + * <p> + * This configuration will cause only warnings and errors to print. + * + * @author Jeremy McCormick, SLAC + */ +public class TestLoggingConfig { + + /** + * Class constructor which reads in a logging properties file from a classpath resource. + */ + public TestLoggingConfig() { + InputStream inputStream = TestLoggingConfig.class.getResourceAsStream("test_logging.properties"); + try { + LogManager.getLogManager().readConfiguration(inputStream); + } catch (SecurityException | IOException e) { + throw new RuntimeException("Initialization of test logging configuration failed.", e); + } + } +} Added: java/trunk/logging/src/main/resources/org/hps/logging/config/test_logging.properties ============================================================================= --- java/trunk/logging/src/main/resources/org/hps/logging/config/test_logging.properties (added) +++ java/trunk/logging/src/main/resources/org/hps/logging/config/test_logging.properties Thu Oct 8 22:10:50 2015 @@ -0,0 +1,73 @@ +# +# Global logging configuration for HPS Java packages. +# +# Jeremy McCormick, SLAC +# + +# default global level +.level = WARNING + +# default handler which prints to console +handlers = java.util.logging.ConsoleHandler + +# prints timestamp (1$), level (4$), source ($2), message (5$), and (optionally) an exception (6$). +java.util.logging.SimpleFormatter.format = %1$tc [%4$s] %2$s :: %5$s%6$s%n + +# configure the console handler +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +f +# lcsim job +org.lcsim.job.level = WARNING +org.lcsim.job.EventMarkerDriver.level = OFF + +# conditions +org.hps.conditions.api.level = WARNING +org.hps.conditions.database.level = WARNING +org.hps.conditions.cli.level = WARNING +org.hps.conditions.ecal.level = WARNING +org.hps.conditions.svt.level = WARNING + +# monitoring-drivers +org.hps.monitoring.drivers.svt.level = WARNING +org.hps.monitoring.plotting.level = WARNING + +# evio +org.hps.evio.level = WARNING + +# analysis +org.hps.analysis.trigger.level = WARNING +org.hps.analysis.dataquality.level = WARNING + +# crawler +org.hps.crawler.level = WARNING + +# ecal-recon +org.hps.recon.ecal.level = WARNING +org.hps.recon.ecal.cluster.level = WARNING + +# recon +org.hps.recon.filtering.level = WARNING + +# record-util +org.hps.record.epics.level = WARNING +org.hps.record.evio.level = WARNING +org.hps.record.scalers.level = WARNING +org.hps.record.triggerbank.level = WARNING +org.hps.record.svt.level = WARNING + +# tracking +org.hps.recon.tracking.level = WARNING +org.hps.recon.tracking.gbl.level = WARNING + +# run-database +org.hps.run.database.level = WARNING + +# monitoring-application +org.hps.monitoring.application.model.level = WARNING +org.hps.monitoring.application.level = WARNING + +# detector-model +org.lcsim.detector.converter.compact.level = WARNING +org.lcsim.geometry.compact.converter.level = WARNING +org.hps.detector.svt.level = WARNING Modified: java/trunk/parent/pom.xml ============================================================================= --- java/trunk/parent/pom.xml (original) +++ java/trunk/parent/pom.xml Thu Oct 8 22:10:50 2015 @@ -442,7 +442,7 @@ <forkMode>pertest</forkMode> <systemPropertyVariables> <org.lcsim.cacheDir>${org.lcsim.cacheDir}</org.lcsim.cacheDir> - <java.util.logging.config.class>org.hps.logging.config.DefaultLoggingConfig</java.util.logging.config.class> + <java.util.logging.config.class>org.hps.logging.config.TestLoggingConfig</java.util.logging.config.class> </systemPropertyVariables> </configuration> </plugin>