diff --git a/bin/bg-merger b/bin/bg-merger index ec5b2150f5..d36f421b1a 100755 --- a/bin/bg-merger +++ b/bin/bg-merger @@ -6,7 +6,7 @@ export MALLOC_ARENA_MAX=1 split_cli $@ -java -Xmx1536m -Xms1024m -XX:+UseSerialGC ${jvm_options[@]} \ +java ${JAVA_OPTS-} -Xmx1536m -Xms1024m -XX:+UseSerialGC ${jvm_options[@]} \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.analysis.eventmerger.EventMerger \ ${class_options[@]} diff --git a/bin/bos2hipo b/bin/bos2hipo index 96bc875b63..81b18b24eb 100755 --- a/bin/bos2hipo +++ b/bin/bos2hipo @@ -2,7 +2,7 @@ . `dirname $0`/../libexec/env.sh -java -Xms1024m -XX:+UseSerialGC \ +java ${JAVA_OPTS-} -Xms1024m -XX:+UseSerialGC \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.io.utils.Bos2HipoEventBank \ $* diff --git a/bin/cvt-compare b/bin/cvt-compare index c019923916..c0e42dc650 100755 --- a/bin/cvt-compare +++ b/bin/cvt-compare @@ -4,7 +4,7 @@ export MALLOC_ARENA_MAX=1 -java -Xmx1536m -Xms1024m -XX:+UseSerialGC \ +java ${JAVA_OPTS-} -Xmx1536m -Xms1024m -XX:+UseSerialGC \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.rec.cvt.Geometry \ $* diff --git a/bin/daqEventViewer b/bin/daqEventViewer index b1fcd92cfc..54ef60a58d 100755 --- a/bin/daqEventViewer +++ b/bin/daqEventViewer @@ -2,7 +2,7 @@ . `dirname $0`/../libexec/env.sh -java -Xms1024m \ +java ${JAVA_OPTS-} -Xms1024m \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.detector.examples.RawEventViewer \ $* diff --git a/bin/dclayereffs-ana b/bin/dclayereffs-ana index 0e3d2ac227..3edd3b01fd 100755 --- a/bin/dclayereffs-ana +++ b/bin/dclayereffs-ana @@ -2,7 +2,7 @@ . `dirname $0`/../libexec/env.sh -java -Dsun.java2d.pmoffscreen=false -Xmx2048m -Xms1024m \ +java ${JAVA_OPTS-} -Dsun.java2d.pmoffscreen=false -Xmx2048m -Xms1024m \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.service.dc.LayerEfficiencyAnalyzer \ $* diff --git a/bin/decoder b/bin/decoder index cc69b57641..6f48837956 100755 --- a/bin/decoder +++ b/bin/decoder @@ -6,7 +6,7 @@ split_cli $@ export MALLOC_ARENA_MAX=1 -java -Xmx1536m -Xms1024m -XX:+UseSerialGC ${jvm_options[@]} \ +java ${JAVA_OPTS-} -Xmx1536m -Xms1024m -XX:+UseSerialGC ${jvm_options[@]} \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.detector.decode.CLASDecoder4 \ ${class_options[@]} diff --git a/bin/dict-generator b/bin/dict-generator index 1710f0530b..f3c8d26274 100755 --- a/bin/dict-generator +++ b/bin/dict-generator @@ -4,7 +4,7 @@ export MALLOC_ARENA_MAX=1 -java -Xmx1536m -Xms1024m -XX:+UseSerialGC \ +java ${JAVA_OPTS-} -Xmx1536m -Xms1024m -XX:+UseSerialGC \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.analysis.roads.DictionaryGenerator \ $* diff --git a/bin/dict-maker b/bin/dict-maker index a576b82357..81f591f339 100755 --- a/bin/dict-maker +++ b/bin/dict-maker @@ -4,7 +4,7 @@ export MALLOC_ARENA_MAX=1 -java -Xmx1536m -Xms1024m -XX:+UseSerialGC \ +java ${JAVA_OPTS-} -Xmx1536m -Xms1024m -XX:+UseSerialGC \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.analysis.roads.DictionaryCreator \ $* diff --git a/bin/dict-merger b/bin/dict-merger index 3388a97f2e..7c6fe4d7fa 100755 --- a/bin/dict-merger +++ b/bin/dict-merger @@ -4,7 +4,7 @@ export MALLOC_ARENA_MAX=1 -java -Xmx1536m -Xms1024m \ +java ${JAVA_OPTS-} -Xmx1536m -Xms1024m \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.analysis.roads.DictionaryMerger \ $* diff --git a/bin/dict-validator b/bin/dict-validator index 18b1d2fc04..6439d81c6f 100755 --- a/bin/dict-validator +++ b/bin/dict-validator @@ -4,7 +4,7 @@ export MALLOC_ARENA_MAX=1 -java -Xmx1536m -Xms1024m \ +java ${JAVA_OPTS-} -Xmx1536m -Xms1024m \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.analysis.roads.DictionaryValidator \ $* diff --git a/bin/evio-viewer b/bin/evio-viewer index 215b8a7acd..61bac9c770 100755 --- a/bin/evio-viewer +++ b/bin/evio-viewer @@ -2,4 +2,4 @@ . `dirname $0`/../libexec/env.sh -java -cp ${COATJAVA_CLASSPATH:-''} org.jlab.coda.eventViewer.EventTreeFrame $* +java ${JAVA_OPTS-} -cp ${COATJAVA_CLASSPATH:-''} org.jlab.coda.eventViewer.EventTreeFrame $* diff --git a/bin/evio2hipo b/bin/evio2hipo index 62a74f8b6b..cf60f1e7c6 100755 --- a/bin/evio2hipo +++ b/bin/evio2hipo @@ -4,7 +4,7 @@ export MALLOC_ARENA_MAX=1 -java -Xmx1536m -Xms1024m -XX:+UseSerialGC \ +java ${JAVA_OPTS-} -Xmx1536m -Xms1024m -XX:+UseSerialGC \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.clas.reco.io.EvioHipoEvent4 \ $* diff --git a/bin/eviocure b/bin/eviocure index 93e1bf7cfd..daf7ae78bb 100755 --- a/bin/eviocure +++ b/bin/eviocure @@ -4,6 +4,6 @@ export MALLOC_ARENA_MAX=1 -java -Xmx1536m -Xms1024m \ +java ${JAVA_OPTS-} -Xmx1536m -Xms1024m \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.io.utils.EvioCure $* diff --git a/bin/eviodump b/bin/eviodump index 5679d8cc27..4f8e84cf91 100755 --- a/bin/eviodump +++ b/bin/eviodump @@ -2,7 +2,7 @@ . `dirname $0`/../libexec/env.sh -java -Xms1024m \ +java ${JAVA_OPTS-} -Xms1024m \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.io.utils.DataSourceDump \ $* diff --git a/bin/hipo-browser b/bin/hipo-browser index 8cf0f0ddce..1f35c05299 100755 --- a/bin/hipo-browser +++ b/bin/hipo-browser @@ -2,7 +2,7 @@ . `dirname $0`/../libexec/env.sh -java -Xms1024m \ +java ${JAVA_OPTS-} -Xms1024m \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.groot.ui.TBrowser \ $* diff --git a/bin/hipo-diff b/bin/hipo-diff index 609f780dd7..faa6efb4e4 100755 --- a/bin/hipo-diff +++ b/bin/hipo-diff @@ -4,7 +4,7 @@ export MALLOC_ARENA_MAX=1 -java -Xmx1536m -Xms1024m -XX:+UseSerialGC \ +java ${JAVA_OPTS-} -Xmx1536m -Xms1024m -XX:+UseSerialGC \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.utils.HipoDiff \ $* diff --git a/bin/hipo-json b/bin/hipo-json index df43497683..71df43de7c 100755 --- a/bin/hipo-json +++ b/bin/hipo-json @@ -2,7 +2,7 @@ . `dirname $0`/../libexec/env.sh -java -Xms1024m \ +java ${JAVA_OPTS-} -Xms1024m \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.utils.JsonUtils \ $* diff --git a/bin/hipo-merge-histograms b/bin/hipo-merge-histograms index 8f0b526d09..5ebf2fc198 100755 --- a/bin/hipo-merge-histograms +++ b/bin/hipo-merge-histograms @@ -4,7 +4,7 @@ split_cli $@ -cmd="java -Xms1024m ${jvm_options[@]} -cp ${COATJAVA_CLASSPATH:-''} org.jlab.groot.data.TDirectory" +cmd="java ${JAVA_OPTS-} -Xms1024m ${jvm_options[@]} -cp ${COATJAVA_CLASSPATH:-''} org.jlab.groot.data.TDirectory" if [ $# -eq 0 ]; then echo """ diff --git a/bin/hipo-utils b/bin/hipo-utils index 642114f828..586224fc9d 100755 --- a/bin/hipo-utils +++ b/bin/hipo-utils @@ -6,7 +6,7 @@ split_cli $@ export MALLOC_ARENA_MAX=1 -java -Xmx2048m -Xms1024m -XX:+UseSerialGC ${jvm_options[@]} \ +java ${JAVA_OPTS-} -Xmx2048m -Xms1024m -XX:+UseSerialGC ${jvm_options[@]} \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.io.hipo.HipoUtilities \ ${class_options[@]} diff --git a/bin/postprocess b/bin/postprocess index d8af2aab5a..41965b19de 100755 --- a/bin/postprocess +++ b/bin/postprocess @@ -4,7 +4,7 @@ export MALLOC_ARENA_MAX=1 -java -Xmx768m -Xms768m -XX:+UseSerialGC \ +java ${JAVA_OPTS-} -Xmx768m -Xms768m -XX:+UseSerialGC \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.analysis.postprocess.Tag1ToEvent \ $* diff --git a/bin/rebuild-scalers b/bin/rebuild-scalers index bfd0a7c24e..c5c46c6aa0 100755 --- a/bin/rebuild-scalers +++ b/bin/rebuild-scalers @@ -6,7 +6,7 @@ split_cli $@ export MALLOC_ARENA_MAX=1 -java -Xms768m -Xmx1536m -XX:+UseSerialGC ${jvm_options[@]} \ +java ${JAVA_OPTS-} -Xms768m -Xmx1536m -XX:+UseSerialGC ${jvm_options[@]} \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.analysis.postprocess.RebuildScalers \ ${class_options[@]} diff --git a/bin/recon-util b/bin/recon-util index 6446efe543..90f5a6324f 100755 --- a/bin/recon-util +++ b/bin/recon-util @@ -6,7 +6,7 @@ split_cli $@ export MALLOC_ARENA_MAX=1 -java -Xmx1536m -Xms1024m -XX:+UseSerialGC ${jvm_options[@]} \ +java ${JAVA_OPTS-} -Xmx1536m -Xms1024m -XX:+UseSerialGC ${jvm_options[@]} \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.clas.reco.EngineProcessor \ ${class_options[@]} diff --git a/bin/run-clara b/bin/run-clara index c85d672f0d..fff8e9cb28 100755 --- a/bin/run-clara +++ b/bin/run-clara @@ -15,19 +15,23 @@ Options:\n \t-n number of events (default=-1)\n \t-m merge output files (see dependencies below)\n \t-l larger JVM memory requests\n -\t-v verbose output\n +\t-L set Java log level (e.g., info, fine, etc.)\n +\t-q quiet output (overrides -L)\n +\t-v verbose output (xtrace)\n \t-h print this help and exit\n\n Merging outputs (-m) requires hipo-utils and yq (https://github.com/mikefarah/yq).' function error() { - echo -e "\n$usage\n\nERROR: $@." && exit 1 + echo -e "\n$usage\n\nERROR: $@." >&2 && exit 1 } # Interpret command line: threads=2 prefix=rec_ +java_quiet=false +java_log_level=info CLARA_USER_DATA=. -while getopts y:o:p:c:t:n:lqmvh opt +while getopts y:o:p:c:t:n:lL:qmvh opt do case $opt in y) yaml=$OPTARG ;; @@ -37,8 +41,9 @@ do t) threads=$OPTARG && echo $threads | grep -q -E '^[0-9]+$' || error "-t must be an integer, threads" ;; n) nevents="-e $OPTARG" && echo "$nevents" | grep -q -E '^-e [0-9]+$' || error "-n must be an integer, events" ;; l) large=1 ;; + L) java_log_level=$OPTARG ;; m) merge=1 ;; - q) quiet=1 ;; + q) java_quiet=true ;; v) set -o xtrace ;; h) echo -e "\n$usage" && echo -e $info && exit 0 ;; esac @@ -68,7 +73,7 @@ java_opts="-Xms${gb_init}g -Xmx${gb_max}g" yaml=$(cd $(dirname $yaml) && pwd)/$(basename $yaml) # Create the environment variables and directories required by CLARA: -[ -e $CLARA_USER_DATA ] && echo "WARNING: Using existing directory: $CLARA_USER_DATA" +[ -e $CLARA_USER_DATA ] && echo "WARNING: Using existing directory: $CLARA_USER_DATA" >&2 mkdir -p $CLARA_USER_DATA || error "Cannot create -o output directory: $CLARA_USER_DATA" mkdir -p $CLARA_USER_DATA/log $CLARA_USER_DATA/config $CLARA_USER_DATA/data/output export CLARA_USER_DATA=$(cd $CLARA_USER_DATA && pwd) @@ -90,10 +95,20 @@ done JAVA_OPTS="$java_opts $JAVA_OPTS -XX:+IgnoreUnrecognizedVMOptions" JAVA_OPTS="$JAVA_OPTS -Djava.io.tmpdir=$CLARA_USER_DATA -Dorg.sqlite.tmpdir=$CLARA_USER_DATA" -# Set verbosity: -[ -z ${quiet+x} ] && stub=fine || stub=info -JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.config.file=$CLAS12DIR/etc/logging/$stub.properties" - +# Set logger and verbosity +JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jlab.logging.SplitLogManager" +if $java_quiet; then + JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.config.file=$CLAS12DIR/etc/logging/logging.properties" +else + case ${java_log_level^^} in + SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST|ALL|OFF) + JAVA_OPTS="$JAVA_OPTS -D.level=${java_log_level^^}" + ;; + *) + error "unknown Java log level '$java_log_level'" + ;; + esac +fi export JAVA_OPTS function get_host_ip() { diff --git a/bin/run-coatjava b/bin/run-coatjava index ad2c8322d7..16c22b52fe 100755 --- a/bin/run-coatjava +++ b/bin/run-coatjava @@ -24,7 +24,7 @@ shift split_cli $@ -exec java -Xmx1536m -Xms1024m -XX:+UseSerialGC ${jvm_options[@]} \ +exec java ${JAVA_OPTS-} -Xmx1536m -Xms1024m -XX:+UseSerialGC ${jvm_options[@]} \ -cp ${COATJAVA_CLASSPATH:-''} \ $class_name \ ${class_options[@]} diff --git a/bin/trigger-filter b/bin/trigger-filter index 118fcf9a60..4f4ef590ad 100755 --- a/bin/trigger-filter +++ b/bin/trigger-filter @@ -4,7 +4,7 @@ export MALLOC_ARENA_MAX=1 -java -Xmx1536m -Xms1024m -XX:+UseSerialGC \ +java ${JAVA_OPTS-} -Xmx1536m -Xms1024m -XX:+UseSerialGC \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.analysis.eventmerger.RandomTriggerFilter \ $* diff --git a/bin/trigger-splitter b/bin/trigger-splitter index 016a84163e..26c25d8ed8 100755 --- a/bin/trigger-splitter +++ b/bin/trigger-splitter @@ -4,7 +4,7 @@ export MALLOC_ARENA_MAX=1 -java -Xmx1536m -Xms1024m -XX:+UseSerialGC \ +java ${JAVA_OPTS-} -Xmx1536m -Xms1024m -XX:+UseSerialGC \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.analysis.eventmerger.RandomTriggerSplit \ $* diff --git a/bin/trutheff b/bin/trutheff index 1eaca20514..e967cc898b 100755 --- a/bin/trutheff +++ b/bin/trutheff @@ -4,7 +4,7 @@ export MALLOC_ARENA_MAX=1 -java -Xmx1536m -Xms1024m -XX:+UseSerialGC \ +java ${JAVA_OPTS-} -Xmx1536m -Xms1024m -XX:+UseSerialGC \ -cp ${COATJAVA_CLASSPATH:-''} \ org.jlab.analysis.efficiency.Truth \ $* diff --git a/common-tools/clas-analysis/pom.xml b/common-tools/clas-analysis/pom.xml index acfa113c38..a5be54801f 100644 --- a/common-tools/clas-analysis/pom.xml +++ b/common-tools/clas-analysis/pom.xml @@ -77,12 +77,6 @@ 13.5.0-SNAPSHOT - - org.jlab.clas - clas-logging - 13.5.0-SNAPSHOT - - org.jlab.clas swim-tools diff --git a/common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/Tag1ToEvent.java b/common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/Tag1ToEvent.java index eb93cc67d6..857a9962f6 100644 --- a/common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/Tag1ToEvent.java +++ b/common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/Tag1ToEvent.java @@ -13,7 +13,6 @@ import org.jlab.detector.helicity.HelicityBit; import org.jlab.detector.helicity.HelicitySequenceDelayed; import org.jlab.jnp.hipo4.data.SchemaFactory; -import org.jlab.logging.SplitLogger; import org.jlab.utils.groups.IndexedTable; import org.jlab.utils.options.OptionParser; @@ -31,7 +30,7 @@ public class Tag1ToEvent { - static final Logger LOGGER = SplitLogger.create(Tag1ToEvent.class.getName()); + static final Logger LOGGER = Logger.getLogger(Tag1ToEvent.class.getName()); public static void main(String[] args) { diff --git a/common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/Util.java b/common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/Util.java index 9ed5b43507..7ac75bcea2 100644 --- a/common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/Util.java +++ b/common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/Util.java @@ -22,15 +22,13 @@ import org.jlab.detector.helicity.HelicitySequenceDelayed; import org.jlab.detector.helicity.HelicitySequenceManager; -import org.jlab.logging.SplitLogger; - /** * Static utility methods for postprocessing. * @author baltzell */ class Util { - static final Logger logger = SplitLogger.create(Util.class.getName()); + static final Logger logger = Logger.getLogger(Util.class.getName()); /** * Assign the delay-corrected helicity to the HEL::scaler bank's rows diff --git a/common-tools/clas-detector/src/main/java/org/jlab/detector/calib/utils/ConstantsManager.java b/common-tools/clas-detector/src/main/java/org/jlab/detector/calib/utils/ConstantsManager.java index 673c5ef84b..0283629167 100644 --- a/common-tools/clas-detector/src/main/java/org/jlab/detector/calib/utils/ConstantsManager.java +++ b/common-tools/clas-detector/src/main/java/org/jlab/detector/calib/utils/ConstantsManager.java @@ -13,7 +13,7 @@ import java.util.logging.Logger; import org.jlab.utils.groups.IndexedTable; -import org.jlab.logging.SplitLogger; +import org.jlab.logging.SplitLogManager; /** * @@ -23,7 +23,10 @@ public class ConstantsManager { public static final int DBERROR_SLEEP_SECONDS=3; - private static Logger LOGGER = SplitLogger.create(ConstantsManager.class.getName(), false); + private static Logger LOGGER = Logger.getLogger(ConstantsManager.class.getName()); + static { + SplitLogManager.configureHandlers(LOGGER, false); + } private DatabaseConstantsDescriptor defaultDescriptor = new DatabaseConstantsDescriptor(); private volatile Map runConstants = new LinkedHashMap(); @@ -182,7 +185,10 @@ public String toString() { */ public static class DatabaseConstantsDescriptor { - Logger LOGGER = SplitLogger.create(DatabaseConstantsDescriptor.class.getName(), false); + private static Logger LOGGER = Logger.getLogger(DatabaseConstantsDescriptor.class.getName()); + static { + SplitLogManager.configureHandlers(LOGGER, false); + } private String descName = "descriptor"; private int runNumber = 10; diff --git a/common-tools/clas-detector/src/main/java/org/jlab/detector/calib/utils/DatabaseConstantProvider.java b/common-tools/clas-detector/src/main/java/org/jlab/detector/calib/utils/DatabaseConstantProvider.java index 8fb2330a7a..0505a2204a 100644 --- a/common-tools/clas-detector/src/main/java/org/jlab/detector/calib/utils/DatabaseConstantProvider.java +++ b/common-tools/clas-detector/src/main/java/org/jlab/detector/calib/utils/DatabaseConstantProvider.java @@ -22,7 +22,7 @@ import org.jlab.utils.groups.IndexedTable; import org.jlab.utils.groups.IndexedTableViewer; import org.jlab.utils.system.FileSystemExecScan; -import org.jlab.logging.SplitLogger; +import org.jlab.logging.SplitLogManager; /** * @@ -30,7 +30,10 @@ */ public class DatabaseConstantProvider implements ConstantProvider { - static final Logger LOGGER = SplitLogger.create(DatabaseConstantProvider.class.getName(), false); + static final Logger LOGGER = Logger.getLogger(DatabaseConstantProvider.class.getName()); + static { + SplitLogManager.configureHandlers(LOGGER, false); + } private final HashMap constantContainer = new HashMap<>(); private final boolean PRINT_ALL = true; diff --git a/common-tools/clas-detector/src/main/java/org/jlab/detector/calib/utils/RCDBProvider.java b/common-tools/clas-detector/src/main/java/org/jlab/detector/calib/utils/RCDBProvider.java index da97bf1a01..43120e0f22 100644 --- a/common-tools/clas-detector/src/main/java/org/jlab/detector/calib/utils/RCDBProvider.java +++ b/common-tools/clas-detector/src/main/java/org/jlab/detector/calib/utils/RCDBProvider.java @@ -3,7 +3,7 @@ import java.util.HashMap; import java.util.logging.Level; import java.util.logging.Logger; -import org.jlab.logging.SplitLogger; +import org.jlab.logging.SplitLogManager; import org.rcdb.RCDB; import org.rcdb.Condition; @@ -34,7 +34,10 @@ public Double getSolenoidScale(int run) { } } - public static Logger LOGGER = SplitLogger.create(RCDBProvider.class.getName(), false); + public static Logger LOGGER = Logger.getLogger(RCDBProvider.class.getName()); + static { + SplitLogManager.configureHandlers(LOGGER, false); + } public static final String DEFAULTADDRESS = "mysql://rcdb@clasdb.jlab.org/rcdb"; diff --git a/common-tools/clas-detector/src/main/java/org/jlab/detector/helicity/HelicityGenerator.java b/common-tools/clas-detector/src/main/java/org/jlab/detector/helicity/HelicityGenerator.java index 9e1687d9bd..f8af32d471 100644 --- a/common-tools/clas-detector/src/main/java/org/jlab/detector/helicity/HelicityGenerator.java +++ b/common-tools/clas-detector/src/main/java/org/jlab/detector/helicity/HelicityGenerator.java @@ -6,7 +6,6 @@ import java.util.Comparator; import java.util.logging.Level; import java.util.logging.Logger; -import org.jlab.logging.SplitLogger; /** * Helicity Pseudo-Random Sequence. @@ -30,7 +29,7 @@ */ public final class HelicityGenerator implements Comparable, Comparator { - static final Logger LOGGER = SplitLogger.create(HelicityGenerator.class.getName()); + static final Logger LOGGER = Logger.getLogger(HelicityGenerator.class.getName()); public static final int REGISTER_SIZE=30; private final List states=new ArrayList<>(); private int offset=0; diff --git a/common-tools/clas-detector/src/main/java/org/jlab/detector/helicity/HelicitySequence.java b/common-tools/clas-detector/src/main/java/org/jlab/detector/helicity/HelicitySequence.java index 12b26ee4ef..1b18a38ebd 100644 --- a/common-tools/clas-detector/src/main/java/org/jlab/detector/helicity/HelicitySequence.java +++ b/common-tools/clas-detector/src/main/java/org/jlab/detector/helicity/HelicitySequence.java @@ -10,7 +10,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.jlab.detector.calib.utils.ConstantsManager; -import org.jlab.logging.SplitLogger; import org.jlab.jnp.hipo4.data.Bank; import org.jlab.jnp.hipo4.data.Event; @@ -53,7 +52,7 @@ */ public class HelicitySequence { - static final Logger LOGGER = SplitLogger.create(HelicitySequence.class.getName()); + static final Logger LOGGER = Logger.getLogger(HelicitySequence.class.getName()); public static final double TIMESTAMP_CLOCK=250.0e6; // Hz protected double helicityClock=29.56; // Hz protected HelicityPattern pattern=HelicityPattern.QUARTET; diff --git a/common-tools/clas-detector/src/main/java/org/jlab/detector/helicity/HelicitySequenceManager.java b/common-tools/clas-detector/src/main/java/org/jlab/detector/helicity/HelicitySequenceManager.java index d943e50965..2c4536787a 100644 --- a/common-tools/clas-detector/src/main/java/org/jlab/detector/helicity/HelicitySequenceManager.java +++ b/common-tools/clas-detector/src/main/java/org/jlab/detector/helicity/HelicitySequenceManager.java @@ -12,7 +12,6 @@ import org.jlab.jnp.hipo4.data.Event; import org.jlab.jnp.hipo4.data.SchemaFactory; import org.jlab.jnp.hipo4.io.HipoReader; -import org.jlab.logging.SplitLogger; /** * Manage helicity sequences for multiple run numbers simultaneously. @@ -22,7 +21,7 @@ */ public final class HelicitySequenceManager { - static final Logger LOGGER = SplitLogger.create(HelicitySequence.class.getName()); + static final Logger LOGGER = Logger.getLogger(HelicitySequence.class.getName()); SchemaFactory schema=null; private final int delay; private boolean flip=false; diff --git a/common-tools/clas-detector/src/main/java/org/jlab/detector/scalers/DaqScalers.java b/common-tools/clas-detector/src/main/java/org/jlab/detector/scalers/DaqScalers.java index 57262c6a27..a08b4955f8 100644 --- a/common-tools/clas-detector/src/main/java/org/jlab/detector/scalers/DaqScalers.java +++ b/common-tools/clas-detector/src/main/java/org/jlab/detector/scalers/DaqScalers.java @@ -10,7 +10,6 @@ import org.jlab.jnp.hipo4.data.SchemaFactory; import org.jlab.utils.groups.IndexedTable; import java.util.logging.Logger; -import org.jlab.logging.SplitLogger; /** * @@ -53,7 +52,7 @@ public class DaqScalers { private long timestamp=0; private int evnum=0; - private static final Logger logger = SplitLogger.create(DaqScalers.class.getName()); + private static final Logger logger = Logger.getLogger(DaqScalers.class.getName()); public DaqScalers setTimestamp(long timestamp) { this.timestamp=timestamp; diff --git a/common-tools/clas-detector/src/main/java/org/jlab/detector/scalers/DaqScalersSequence.java b/common-tools/clas-detector/src/main/java/org/jlab/detector/scalers/DaqScalersSequence.java index db41b4342a..2741112635 100644 --- a/common-tools/clas-detector/src/main/java/org/jlab/detector/scalers/DaqScalersSequence.java +++ b/common-tools/clas-detector/src/main/java/org/jlab/detector/scalers/DaqScalersSequence.java @@ -12,7 +12,6 @@ import org.jlab.jnp.hipo4.data.Bank; import org.jlab.jnp.hipo4.data.SchemaFactory; import org.jlab.detector.calib.utils.ConstantsManager; -import org.jlab.logging.SplitLogger; /** * For easy access to most recent scaler readout for any given event. @@ -31,7 +30,7 @@ public class DaqScalersSequence implements Comparator { private Bank runConfigBank=null; private Bank runScalerBank=null; - protected static final Logger logger = SplitLogger.create(DaqScalersSequence.class.getName()); + protected static final Logger logger = Logger.getLogger(DaqScalersSequence.class.getName()); protected DaqScalersSequence(){}; diff --git a/common-tools/clas-io/pom.xml b/common-tools/clas-io/pom.xml index 4840e50561..245f5265b3 100644 --- a/common-tools/clas-io/pom.xml +++ b/common-tools/clas-io/pom.xml @@ -53,13 +53,6 @@ 13.5.0-SNAPSHOT - - org.jlab.clas - clas-logging - 13.5.0-SNAPSHOT - compile - - diff --git a/common-tools/clas-io/src/main/java/org/jlab/io/hipo/HipoDataSource.java b/common-tools/clas-io/src/main/java/org/jlab/io/hipo/HipoDataSource.java index c3ebfa5926..b121642f95 100644 --- a/common-tools/clas-io/src/main/java/org/jlab/io/hipo/HipoDataSource.java +++ b/common-tools/clas-io/src/main/java/org/jlab/io/hipo/HipoDataSource.java @@ -13,7 +13,6 @@ import org.jlab.jnp.hipo4.data.Event; import org.jlab.jnp.hipo4.data.SchemaFactory; import org.jlab.jnp.hipo4.io.HipoReader; -import org.jlab.logging.SplitLogger; /** * @@ -21,7 +20,7 @@ */ public class HipoDataSource implements DataSource { - public static final Logger LOGGER = SplitLogger.create(HipoDataSource.class.getName()); + public static final Logger LOGGER = Logger.getLogger(HipoDataSource.class.getName()); HipoReader reader = null; int currentEventNumber = 0; diff --git a/common-tools/clas-io/src/main/java/org/jlab/io/utils/EvioCure.java b/common-tools/clas-io/src/main/java/org/jlab/io/utils/EvioCure.java index 5f5f902cb2..97297af86a 100644 --- a/common-tools/clas-io/src/main/java/org/jlab/io/utils/EvioCure.java +++ b/common-tools/clas-io/src/main/java/org/jlab/io/utils/EvioCure.java @@ -7,7 +7,6 @@ import org.jlab.coda.jevio.EventWriter; import org.jlab.coda.jevio.EvioException; import org.jlab.coda.jevio.EvioReader; -import org.jlab.logging.SplitLogger; /** * @@ -15,7 +14,7 @@ */ public class EvioCure { - private static final Logger LOGGER = SplitLogger.create(EvioCure.class.getName()); + private static final Logger LOGGER = Logger.getLogger(EvioCure.class.getName()); public static void main(String[] args) { diff --git a/common-tools/clas-logging/src/main/java/org/jlab/logging/SplitLogger.java b/common-tools/clas-logging/src/main/java/org/jlab/logging/SplitLogManager.java similarity index 72% rename from common-tools/clas-logging/src/main/java/org/jlab/logging/SplitLogger.java rename to common-tools/clas-logging/src/main/java/org/jlab/logging/SplitLogManager.java index 51492b29c3..fb8e7047c2 100644 --- a/common-tools/clas-logging/src/main/java/org/jlab/logging/SplitLogger.java +++ b/common-tools/clas-logging/src/main/java/org/jlab/logging/SplitLogManager.java @@ -2,33 +2,38 @@ import java.util.logging.Level; import java.util.logging.Logger; +import java.util.logging.LogManager; /** - * Helper methods to create a {@code Logger} that sends errors to {@code stderr} and everything else to {@code stdout} - * @see TestSplitLogger {@code TestSplitLogger}: for guidance on how to use this class + * {@code LogManager} that sends errors to {@code stderr} and everything else to {@code stdout} * @author dilks */ -public class SplitLogger { +public class SplitLogManager extends LogManager { /** - * create a new {@link SplitLogger} instance, with formatted messages - * @return a new {@link SplitLogger} instance + * create a new {@link Logger} instance * @param name the name of the logger + * @return a new {@link Logger} instance */ - public static Logger create(String name) { - return create(name, true); + @Override + public Logger getLogger(String name) { + Logger logger = super.getLogger(name); + if(logger != null) + configureHandlers(logger, true); + return logger; } /** - * create a new {@link SplitLogger} instance, with an optional message formatting including a prefix - * @return a new {@link SplitLogger} instance + * add a new {@link Logger} instance * @param name the name of the logger - * @param includePrefix whether or not to include a prefix in the formatting + * @return {@code true} if the argument logger was registered successfully, {@code false} if a logger of that name already exists */ - public static Logger create(String name, boolean includePrefix) { - Logger logger = Logger.getLogger(name); - configureHandlers(logger, includePrefix); - return logger; + @Override + public synchronized boolean addLogger(Logger logger) { + boolean added = super.addLogger(logger); + if(added) + configureHandlers(logger, true); + return added; } /** @@ -86,15 +91,20 @@ public synchronized void publish(java.util.logging.LogRecord record) { String userLevelProperty = System.getProperty(logger.getName() + ".level"); if(userLevelProperty != null) thisLevel = Level.parse(userLevelProperty); - // else if the `SplitLoggerConfig` default level was set, use that level - else if(SplitLoggerConfig.INSTANCE.defaultLevelWasSet()) - thisLevel = SplitLoggerConfig.INSTANCE.getDefaultLevel(); + // else if the `SplitLogManagerConfig` default level was set, use that level + else if(SplitLogManagerConfig.INSTANCE.defaultLevelWasSet()) + thisLevel = SplitLogManagerConfig.INSTANCE.getDefaultLevel(); // else fallback to the level of `logger` itself else thisLevel = logger.getLevel(); // if all else fails, try to use the parent's level if(thisLevel==null) { - thisLevel = logger.getParent().getLevel(); + try { + thisLevel = logger.getParent().getLevel(); + } + catch(NullPointerException e) { + System.err.println("WARNING: 'getParent()' of logger '" + logger.getName() + "' failed"); + } if(thisLevel==null) { // should never happen, but just in case, fall back to default and complain directly to `stderr` thisLevel = Level.INFO; System.err.println("WARNING: trouble setting level of logger '" + logger.getName() + "'; defaulting to level '" + thisLevel + "'"); diff --git a/common-tools/clas-logging/src/main/java/org/jlab/logging/SplitLoggerConfig.java b/common-tools/clas-logging/src/main/java/org/jlab/logging/SplitLogManagerConfig.java similarity index 63% rename from common-tools/clas-logging/src/main/java/org/jlab/logging/SplitLoggerConfig.java rename to common-tools/clas-logging/src/main/java/org/jlab/logging/SplitLogManagerConfig.java index 515b3a9a21..8d2a004727 100644 --- a/common-tools/clas-logging/src/main/java/org/jlab/logging/SplitLoggerConfig.java +++ b/common-tools/clas-logging/src/main/java/org/jlab/logging/SplitLogManagerConfig.java @@ -2,8 +2,8 @@ import java.util.logging.Level; -/** Configuration singleton for {@code SplitLogger} */ -public enum SplitLoggerConfig { +/** Configuration singleton for {@code SplitLogManager} */ +public enum SplitLogManagerConfig { /** singleton instance */ INSTANCE; @@ -12,8 +12,8 @@ public enum SplitLoggerConfig { private volatile boolean calledSetDefaultLevel = false; /** - * Set the default {@code logging.Level} for all new {@code SplitLogger} instances. - * Note: see {@code SplitLogger} details to check if other ways to set logging levels will take priority over this. + * Set the default {@code logging.Level} for all new {@code SplitLogManager}'s {@code Logger} instances. + * Note: see {@code SplitLogManager} details to check if other ways to set logging levels will take priority over this. * @param level the log level */ public synchronized void setDefaultLevel(Level level) { @@ -21,8 +21,8 @@ public synchronized void setDefaultLevel(Level level) { this.calledSetDefaultLevel = true; } - /** @return the default {@code logging.Level} for all new {@code SplitLogger} instances. - * Note: see {@code SplitLogger} details to check if other ways to set logging levels will take priority over this. + /** @return the default {@code logging.Level} for all new {@code SplitLogManager}'s {@code Logger} instances. + * Note: see {@code SplitLogManager} details to check if other ways to set logging levels will take priority over this. */ public Level getDefaultLevel() { return this.defaultLevel; diff --git a/common-tools/clas-logging/src/main/java/org/jlab/logging/TestSplitLogger.java b/common-tools/clas-logging/src/main/java/org/jlab/logging/TestLogManager.java similarity index 84% rename from common-tools/clas-logging/src/main/java/org/jlab/logging/TestSplitLogger.java rename to common-tools/clas-logging/src/main/java/org/jlab/logging/TestLogManager.java index 4ce7fae0c4..83514cdf23 100644 --- a/common-tools/clas-logging/src/main/java/org/jlab/logging/TestSplitLogger.java +++ b/common-tools/clas-logging/src/main/java/org/jlab/logging/TestLogManager.java @@ -4,38 +4,34 @@ import java.util.logging.Level; /** - * A simple class demonstrating how to use {@link SplitLogger}. - *

- * The {@link SplitLogger} class will send {@code SEVERE} and {@code WARNING} log messages - * to {@code stderr}, and all lower levels to {@code stdout}. + * A simple class for testing a custom {@code LogManager}, such as {@link SplitLogManager}. *

* How to set the logging level: *

* A {@code .properties} file is necessary, which has the class name and desired log level; for example, *

- * org.jlab.logging.TestSplitLogger.level = FINE
+ * org.jlab.logging.TestLogManager.level = FINE
  * 
* From high to low, the levels are: {@code SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST}. *

* There are some example {@code .properties} files you can use with this class, like so: *

  * java \
- *   -Djava.util.logging.config.file=common-tools/clas-logging/src/main/resources/org/jlab/logging/TestSplitLogger.finest.properties \
+ *   -Djava.util.logging.config.file=common-tools/clas-logging/src/main/resources/org/jlab/logging/TestLogManager.finest.properties \
  *   -cp ... \
- *   org.jlab.logging.TestSplitLogger
+ *   org.jlab.logging.TestLogManager
  * 
* You may write your own {@code .properties} file, to control the logging level of all classes which use logging. - * @see SplitLogger {@code SplitLogger}: for implementation details * @author dilks */ -public class TestSplitLogger { +public class TestLogManager { /** logger instance for this class */ - protected static final Logger LOGGER = SplitLogger.create(TestSplitLogger.class.getName()); + protected static final Logger LOGGER = Logger.getLogger(TestLogManager.class.getName()); /** constructor: prints some messages to {@code stdout}, but not using the logger yet */ - public TestSplitLogger() { - System.out.println("Created 'TestSplitLogger' instance"); + public TestLogManager() { + System.out.println("Created 'TestLogManager' instance"); System.out.println("Log level = " + LOGGER.getLevel()); } @@ -122,7 +118,7 @@ private static String nap() { * @param args unused */ public static void main(String[] args) { - var potato = new TestSplitLogger(); + var potato = new TestLogManager(); potato.test1(); potato.test2(); potato.test3(); diff --git a/common-tools/clas-logging/src/main/resources/org/jlab/logging/TestLogManager.finest.properties b/common-tools/clas-logging/src/main/resources/org/jlab/logging/TestLogManager.finest.properties new file mode 100644 index 0000000000..7ff159dcdc --- /dev/null +++ b/common-tools/clas-logging/src/main/resources/org/jlab/logging/TestLogManager.finest.properties @@ -0,0 +1,6 @@ +### the finest possible logging level +org.jlab.logging.TestLogManager.level = FINEST + +### or less fine levels +# org.jlab.logging.TestLogManager.level = FINER +# org.jlab.logging.TestLogManager.level = FINE diff --git a/common-tools/clas-logging/src/main/resources/org/jlab/logging/TestSplitLogger.info.properties b/common-tools/clas-logging/src/main/resources/org/jlab/logging/TestLogManager.info.properties similarity index 58% rename from common-tools/clas-logging/src/main/resources/org/jlab/logging/TestSplitLogger.info.properties rename to common-tools/clas-logging/src/main/resources/org/jlab/logging/TestLogManager.info.properties index f2c667748d..0be726bcd4 100644 --- a/common-tools/clas-logging/src/main/resources/org/jlab/logging/TestSplitLogger.info.properties +++ b/common-tools/clas-logging/src/main/resources/org/jlab/logging/TestLogManager.info.properties @@ -1,2 +1,2 @@ ### info level; includes warning and severe levels (for errors) -org.jlab.logging.TestSplitLogger.level = INFO +org.jlab.logging.TestLogManager.level = INFO diff --git a/common-tools/clas-logging/src/main/resources/org/jlab/logging/TestLogManager.quiet.properties b/common-tools/clas-logging/src/main/resources/org/jlab/logging/TestLogManager.quiet.properties new file mode 100644 index 0000000000..5b7e73b6ec --- /dev/null +++ b/common-tools/clas-logging/src/main/resources/org/jlab/logging/TestLogManager.quiet.properties @@ -0,0 +1,5 @@ +### warnings and severe errors only +org.jlab.logging.TestLogManager.level = WARNING + +### or you can suppress warnings too +# org.jlab.logging.TestLogManager.level = SEVERE diff --git a/common-tools/clas-logging/src/main/resources/org/jlab/logging/TestSplitLogger.finest.properties b/common-tools/clas-logging/src/main/resources/org/jlab/logging/TestSplitLogger.finest.properties deleted file mode 100644 index 089a58c389..0000000000 --- a/common-tools/clas-logging/src/main/resources/org/jlab/logging/TestSplitLogger.finest.properties +++ /dev/null @@ -1,6 +0,0 @@ -### the finest possible logging level -org.jlab.logging.TestSplitLogger.level = FINEST - -### or less fine levels -# org.jlab.logging.TestSplitLogger.level = FINER -# org.jlab.logging.TestSplitLogger.level = FINE diff --git a/common-tools/clas-logging/src/main/resources/org/jlab/logging/TestSplitLogger.quiet.properties b/common-tools/clas-logging/src/main/resources/org/jlab/logging/TestSplitLogger.quiet.properties deleted file mode 100644 index 1f914eff49..0000000000 --- a/common-tools/clas-logging/src/main/resources/org/jlab/logging/TestSplitLogger.quiet.properties +++ /dev/null @@ -1,5 +0,0 @@ -### warnings and severe errors only -org.jlab.logging.TestSplitLogger.level = WARNING - -### or you can suppress warnings too -# org.jlab.logging.TestSplitLogger.level = SEVERE diff --git a/common-tools/clas-reco/pom.xml b/common-tools/clas-reco/pom.xml index 2a3b222bfd..13da339f0f 100644 --- a/common-tools/clas-reco/pom.xml +++ b/common-tools/clas-reco/pom.xml @@ -84,12 +84,6 @@ 13.5.0-SNAPSHOT - - org.jlab.clas - clas-logging - 13.5.0-SNAPSHOT - - diff --git a/common-tools/clas-reco/src/main/java/org/jlab/clas/reco/EngineProcessor.java b/common-tools/clas-reco/src/main/java/org/jlab/clas/reco/EngineProcessor.java index 0e9d61551f..7c1c2b6f33 100644 --- a/common-tools/clas-reco/src/main/java/org/jlab/clas/reco/EngineProcessor.java +++ b/common-tools/clas-reco/src/main/java/org/jlab/clas/reco/EngineProcessor.java @@ -17,7 +17,6 @@ import java.util.Arrays; import org.jlab.jnp.hipo4.data.SchemaFactory; import org.json.JSONObject; -import org.jlab.logging.SplitLogger; import org.jlab.utils.ClaraYaml; /** @@ -30,7 +29,7 @@ public class EngineProcessor { public static final String ENGINE_CLASS_PP = "org.jlab.service.postproc.PostprocEngine"; private final Map processorEngines = new LinkedHashMap<>(); - private static final Logger LOGGER = SplitLogger.create(EngineProcessor.class.getPackage().getName()); + private static final Logger LOGGER = Logger.getLogger(EngineProcessor.class.getPackage().getName()); private boolean updateDictionary = true; private SchemaFactory banksToKeep = null; private final List schemaExempt = Arrays.asList("RUN::config","DC::tdc"); diff --git a/common-tools/clas-utils/src/main/java/org/jlab/utils/options/OptionParser.java b/common-tools/clas-utils/src/main/java/org/jlab/utils/options/OptionParser.java index 780e031317..5d8f04f81c 100644 --- a/common-tools/clas-utils/src/main/java/org/jlab/utils/options/OptionParser.java +++ b/common-tools/clas-utils/src/main/java/org/jlab/utils/options/OptionParser.java @@ -10,8 +10,8 @@ import java.util.TreeMap; import java.util.logging.Logger; import java.util.logging.Level; -import org.jlab.logging.SplitLogger; -import org.jlab.logging.SplitLoggerConfig; +import org.jlab.logging.SplitLogManager; +import org.jlab.logging.SplitLogManagerConfig; /** * @@ -192,7 +192,7 @@ else if(this.containsOptions(arguments,"-v","-version")==true){ private void setVerbosity(String level) { try { this.logLevel = Level.parse(level); - SplitLoggerConfig.INSTANCE.setDefaultLevel(this.logLevel); + SplitLogManagerConfig.INSTANCE.setDefaultLevel(this.logLevel); } catch (IllegalArgumentException e) { System.err.println("Invalid -l java.util.logging.Level: "+level); @@ -238,7 +238,7 @@ public static void overrideLogLevel(String level, String... classList) { * @param externalLogger an external {@code Logger} instance, typically one owned by the owner of this {@code OptionParser} instance */ public void syncLogLevel(Logger externalLogger) { - SplitLogger.configureLevel(externalLogger, this.logLevel); + SplitLogManager.configureLevel(externalLogger, this.logLevel); } public static void main(String[] args){ diff --git a/common-tools/clas-utils/src/main/java/org/jlab/utils/system/FileSystemExecScan.java b/common-tools/clas-utils/src/main/java/org/jlab/utils/system/FileSystemExecScan.java index 03ceeb50bd..5aeaef6d41 100644 --- a/common-tools/clas-utils/src/main/java/org/jlab/utils/system/FileSystemExecScan.java +++ b/common-tools/clas-utils/src/main/java/org/jlab/utils/system/FileSystemExecScan.java @@ -11,7 +11,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.apache.commons.text.StringSubstitutor; -import org.jlab.logging.SplitLogger; /** * Find a location for a usable temporary directory, on a filesystem mounted @@ -22,7 +21,7 @@ */ public class FileSystemExecScan { - static final Logger LOGGER = SplitLogger.create(FileSystemExecScan.class.getName()); + static final Logger LOGGER = Logger.getLogger(FileSystemExecScan.class.getName()); static final StringSubstitutor SUBSTITUTOR = new StringSubstitutor(System.getenv()); diff --git a/common-tools/coat-libs/pom.xml b/common-tools/coat-libs/pom.xml index 068690205b..f2af6c6b7f 100644 --- a/common-tools/coat-libs/pom.xml +++ b/common-tools/coat-libs/pom.xml @@ -75,6 +75,12 @@ 13.5.0-SNAPSHOT + + org.jlab.clas + clas-logging + 13.5.0-SNAPSHOT + + org.jlab.clas clas-reco diff --git a/docs/dev_notes.md b/docs/dev_notes.md index 6efb426f09..5a7067c12c 100644 --- a/docs/dev_notes.md +++ b/docs/dev_notes.md @@ -2,25 +2,38 @@ ## Controlling Log Levels -To control the log level of a class with a `Logger`, make a logging `.properties` file, and set the level of each of your classes for which you want to use a non-default level; use the property name `className.level`, for example: +To control the log level of a class with a `Logger`, use properties. For example, use `java` options: +``` +-Dorg.jlab.detector.helicity.HelicityGenerator.level=FINEST # sets HelicityGenerator level to FINEST +-D.level=FINE # sets the level of all loggers to FINE +``` + +Alternatively, make a logging `.properties` file, and set the level of each of your classes for which you want to use a non-default level; use the property name `className.level`, for example: ``` # my_levels.properties org.jlab.detector.helicity.HelicityGenerator.level = FINEST org.jlab.detector.calib.utils.RCDBProvider.level = FINER ``` -Then run as -```bash -java -Djava.util.logging.config.file=my_levels.properties ... +or use `.level` for the global level: +``` +# my_levels.properties +.level = FINE +``` +To use this `.properties` file, run with the `java` option +``` +-Djava.util.logging.config.file=my_levels.properties ``` -or using `run-coatjava`, +Then, here are some examples for using it with `recon-util`: ```bash -run-coatjava [CLASS_NAME] [CLASS_ARGS] -- -Djava.util.logging.config.file=my_levels.properties +recon-util [ARGS] -- -Djava.util.logging.config.file=my_levels.properties # use your .properties file +recon-util [ARGS] -- -D.level=ALL # set the global level to ALL (very verbose!) +recon-util [ARGS] -- -D.level=OFF # silence the loggers ``` From high to low, the levels are `SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST` (see `java.util.logging.Level` documentation). You may also use levels `ALL` or `OFF`, for everything or nothing, respectively. > [!NOTE] -> These properties may compete with the log level set by `OptionParser`'s option `-l`, potentially overriding that level. +> These properties may compete with the log level set by `OptionParser`'s option `-l`, potentially overriding that level. For example, `postprocess` and `decoder` use `OptionParser`. ## Bumping Version Number and Deploying diff --git a/libexec/env.sh b/libexec/env.sh index 305933f019..8497746346 100644 --- a/libexec/env.sh +++ b/libexec/env.sh @@ -32,6 +32,9 @@ if [ "${1-}" != '--no-classpath' ]; then export COATJAVA_CLASSPATH fi +# set log manager +export JAVA_OPTS="-Djava.util.logging.manager=org.jlab.logging.SplitLogManager ${JAVA_OPTS-}" + # additional environment variables for groovy or interactive use # - call as `source $0 groovy` or `source $0 jshell` if [ $# -ge 1 ]; then diff --git a/reconstruction/cvt/pom.xml b/reconstruction/cvt/pom.xml index 0e79949788..7eb757ad54 100644 --- a/reconstruction/cvt/pom.xml +++ b/reconstruction/cvt/pom.xml @@ -44,11 +44,6 @@ clas-tracking 13.5.0-SNAPSHOT - - org.jlab.clas - clas-logging - 13.5.0-SNAPSHOT - org.jlab.clas clas-reco diff --git a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/Geometry.java b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/Geometry.java index f925f3974e..22cd4d2aee 100644 --- a/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/Geometry.java +++ b/reconstruction/cvt/src/main/java/org/jlab/rec/cvt/Geometry.java @@ -30,7 +30,6 @@ import org.jlab.groot.data.GraphErrors; import org.jlab.groot.graphics.EmbeddedCanvasTabbed; import org.jlab.groot.group.DataGroup; -import org.jlab.logging.SplitLogger; import org.jlab.rec.cvt.bmt.BMTGeometry; import org.jlab.rec.cvt.bmt.BMTType; import org.jlab.rec.cvt.bmt.CCDBConstantsLoader; @@ -94,7 +93,7 @@ public class Geometry { private static boolean LOADED; - private final static Logger LOGGER = SplitLogger.create(Geometry.class.getName()); + private final static Logger LOGGER = Logger.getLogger(Geometry.class.getName()); // private constructor for a singleton diff --git a/reconstruction/dc/pom.xml b/reconstruction/dc/pom.xml index b5a7f18aa3..e1568e6585 100644 --- a/reconstruction/dc/pom.xml +++ b/reconstruction/dc/pom.xml @@ -62,11 +62,6 @@ clas-math 13.5.0-SNAPSHOT - - org.jlab.clas - clas-logging - 13.5.0-SNAPSHOT - org.jlab.clas clas-utils diff --git a/reconstruction/dc/src/main/java/org/jlab/service/dc/DCEngine.java b/reconstruction/dc/src/main/java/org/jlab/service/dc/DCEngine.java index 2f0add9508..5bfba7b14e 100644 --- a/reconstruction/dc/src/main/java/org/jlab/service/dc/DCEngine.java +++ b/reconstruction/dc/src/main/java/org/jlab/service/dc/DCEngine.java @@ -4,7 +4,6 @@ import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; -import org.jlab.logging.SplitLogger; import org.jlab.clas.reco.ReconstructionEngine; import org.jlab.detector.banks.RawBank.OrderType; import org.jlab.io.base.DataBank; @@ -40,7 +39,7 @@ public class DCEngine extends ReconstructionEngine { private String dafChi2Cut = null; private String dafAnnealingFactorsTB = null; - public static final Logger LOGGER = SplitLogger.create(ReconstructionEngine.class.getName()); + public static final Logger LOGGER = Logger.getLogger(ReconstructionEngine.class.getName()); public DCEngine(String name) { diff --git a/validation/advanced-tests/run-advanced-tests.sh b/validation/advanced-tests/run-advanced-tests.sh index 240822351e..c96599669a 100755 --- a/validation/advanced-tests/run-advanced-tests.sh +++ b/validation/advanced-tests/run-advanced-tests.sh @@ -4,7 +4,6 @@ # and input data files at ./data # set up environment -JAVA_OPTS="-Djava.util.logging.config.file=$PWD/../../etc/logging/debug.properties" CLARA_HOME=$PWD/../../clara/ ; export CLARA_HOME COAT=$CLARA_HOME/plugins/clas12/