List of usage examples for java.util.logging Level ALL
Level ALL
To view the source code for java.util.logging Level ALL.
Click Source Link
From source file:org.mili.core.logging.java.JavaAdapter.java
void fixNullLevel() { if (logger.getLevel() == null) { logger.setLevel(Level.ALL); } }
From source file:plugins.GerritTriggerTest.java
@Before public void setUpLogger() { LOGGER.setLevel(Level.ALL); LOGGER.setUseParentHandlers(false);/*from w w w. j a v a 2 s. c om*/ ConsoleHandler handler = new ConsoleHandler(); handler.setFormatter(new SimpleFormatter()); handler.setLevel(Level.ALL); LOGGER.addHandler(handler); }
From source file:at.ac.tuwien.ifs.lupu.LangDetFilterFactory.java
public static synchronized void loadData() throws LangDetectException { LOG.log(Level.ALL, "in loadData"); if (loaded) { return;/* w w w . j a v a2 s .co m*/ } loaded = true; List<String> profileData = new ArrayList<>(); Charset encoding = Charset.forName("UTF-8"); for (String language : profileLanguages) { LOG.log(Level.ALL, "langdetect-profiles/{0}", language); ClassLoader loader = Thread.currentThread().getContextClassLoader(); InputStream stream = loader.getResourceAsStream("langdetect-profiles/" + language); try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream, encoding))) { profileData.add(new String(IOUtils.toCharArray(reader))); } catch (IOException ex) { Logger.getLogger(LangDetFilterFactory.class.getName()).log(Level.SEVERE, null, ex); } } DetectorFactory.loadProfile(profileData); DetectorFactory.setSeed(0); }
From source file:org.mili.core.logging.java.JavaAdapter.java
boolean isAll() { return logger.getLevel() == Level.ALL; }
From source file:org.wavescale.hotload.agent.HotLoadAgent.java
/** * Parses agent options and fills up the config manager. * * @param args agent optional arguments//w w w .j av a 2 s .co m */ private static void initConfigManager(String[] args) { ConfigManager configManager = ConfigManager.getInstance(); OptionsParser parser = new AgentArgParser(args); try { CommandLine options = parser.parse(); // get the recursive monitoring option value if (options.hasOption("recursive")) { String recursive = options.getOptionValue("recursive"); if (!"true".equals(recursive.toLowerCase())) { configManager.setMonitorRecursive(false); } } // get the number of virtual methods that can be instrumented if (options.hasOption("nr-of-virtual-methods")) { String nrOfVirtualMethods = options.getOptionValue("nr-of-virtual-methods"); configManager.setNumberOfMethodsToBeAdded(Short.parseShort(nrOfVirtualMethods)); } if (options.hasOption("class-path")) { String[] directoryToMonitor = options.getOptionValue("class-path").split(File.pathSeparator); configManager.setDirsToMonitor(directoryToMonitor); } if (options.hasOption("log-level")) { String logLevel = options.getOptionValue("log-level"); switch (logLevel.toLowerCase()) { case "fine": configManager.setLogLevel(Level.FINE); break; case "info": configManager.setLogLevel(Level.INFO); break; case "warning": configManager.setLogLevel(Level.WARNING); break; case "severe": configManager.setLogLevel(Level.SEVERE); break; case "all": configManager.setLogLevel(Level.ALL); break; case "off": configManager.setLogLevel(Level.OFF); break; default: configManager.setLogLevel(Level.INFO); } } } catch (ParseException e) { LOGGER.log(Level.WARNING, "Could not parse agent arguments due to:" + e); } }
From source file:de.ailis.microblinks.blinks.compiler.Main.java
/** * Processes command-line options.//from w w w. ja va 2 s.c om * * @param args * The command-line arguments. * @throws IOException * When an IO error occured. * @return The remaining parameters */ private String[] processOptions(final String[] args) throws IOException { // Build LongOpts final LongOpt[] longOpts = new LongOpt[] { new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'), new LongOpt("version", LongOpt.NO_ARGUMENT, null, 'V'), new LongOpt("debug", LongOpt.NO_ARGUMENT, null, 'd') }; // Build ShortOpts final StringBuilder shortOptsBuilder = new StringBuilder(); for (final LongOpt longOpt : longOpts) { shortOptsBuilder.append((char) longOpt.getVal()); if (longOpt.getHasArg() == LongOpt.REQUIRED_ARGUMENT) { shortOptsBuilder.append(':'); } } final String shortOpts = shortOptsBuilder.toString(); // Parse options final Getopt opts = new Getopt(progName, args, shortOpts, longOpts); // Process options int c; while ((c = opts.getopt()) != -1) { switch (c) { case 'd': this.debug = true; Logger.getLogger("").setLevel(Level.ALL); break; case 'V': version(); break; default: help(); break; } } // Generate parameters, final String[] params = new String[args.length - opts.getOptind()]; int p = 0; for (int i = opts.getOptind(); i < args.length; i++) { params[p] = args[i]; p++; } return params; }
From source file:org.lilyproject.runtime.cli.LilyRuntimeCli.java
private void run(String[] args) throws Exception { // Forward JDK logging to SLF4J LogManager.getLogManager().reset(); LogManager.getLogManager().getLogger("").addHandler(new SLF4JBridgeHandler()); LogManager.getLogManager().getLogger("").setLevel(Level.ALL); Options cliOptions = new Options(); Option confDirsOption = OptionBuilder.withArgName("confdir").hasArg() .withDescription("The Lily runtime configuration directory. Can be multiple paths separated by " + File.pathSeparator) .withLongOpt("confdir").create('c'); cliOptions.addOption(confDirsOption); Option repositoryLocationOption = OptionBuilder.withArgName("maven-repo-path").hasArg() .withDescription(/* w w w . ja va 2 s . c o m*/ "Location of the (Maven-style) artifact repository. Use comma-separated entries to " + "specify multiple locations which will be searched in the order as specified.") .withLongOpt("repository").create('r'); cliOptions.addOption(repositoryLocationOption); Option disabledModulesOption = OptionBuilder.withArgName("mod-id1,mod-id2,...").hasArg() .withDescription("Comma-separated list of modules that should be disabled.") .withLongOpt("disable-modules").create('i'); cliOptions.addOption(disabledModulesOption); Option disableClassSharingOption = OptionBuilder .withDescription("Disable optional sharing of classes between modules") .withLongOpt("disable-class-sharing").create('d'); cliOptions.addOption(disableClassSharingOption); Option consoleLoggingOption = OptionBuilder.withArgName("loglevel").hasArg() .withDescription("Enable logging to console for the root log category with specified loglevel " + "(debug, info, warn, error)") .withLongOpt("console-logging").create('l'); cliOptions.addOption(consoleLoggingOption); Option consoleLogCatOption = OptionBuilder.withArgName("logcategory").hasArg() .withDescription("Enable console logging only for this category") .withLongOpt("console-log-category").create('m'); cliOptions.addOption(consoleLogCatOption); Option logConfigurationOption = OptionBuilder.withArgName("config").hasArg() .withDescription("Log4j configuration file (properties or .xml)").withLongOpt("log-configuration") .create("o"); cliOptions.addOption(logConfigurationOption); Option classLoadingLoggingOption = OptionBuilder .withDescription("Print information about the classloader setup (at startup).") .withLongOpt("classloader-log").create("z"); cliOptions.addOption(classLoadingLoggingOption); Option verboseOption = OptionBuilder.withDescription("Prints lots of information.").withLongOpt("verbose") .create("v"); cliOptions.addOption(verboseOption); Option quietOption = OptionBuilder.withDescription("Suppress normal output.").withLongOpt("quiet") .create("q"); cliOptions.addOption(quietOption); Option sourceLocationsOption = OptionBuilder.withArgName("sourcelocationfile").hasArg() .withDescription( "Path to property file containing alternate source location directory for artifacts.") .withLongOpt("source-locations").create("s"); cliOptions.addOption(sourceLocationsOption); Option modeOption = OptionBuilder.withArgName("modename").hasArg() .withDescription("The runtime mode: prototype, production").withLongOpt("runtime-mode").create("p"); cliOptions.addOption(modeOption); Option versionOption = OptionBuilder.withDescription( "Don't start the service, only dump the version info string for the module defined with -Dlilyruntime.info.module") .withLongOpt("version").create("V"); cliOptions.addOption(versionOption); Option helpOption = new Option("h", "help", false, "Shows help"); cliOptions.addOption(helpOption); CommandLineParser parser = new PosixParser(); CommandLine cmd = null; boolean showHelp = false; try { cmd = parser.parse(cliOptions, args); } catch (ParseException e) { showHelp = true; } if (showHelp || cmd.hasOption(helpOption.getOpt())) { printHelp(cliOptions); System.exit(1); } Logging.setupLogging(cmd.hasOption(verboseOption.getOpt()), cmd.hasOption(quietOption.getOpt()), cmd.hasOption(classLoadingLoggingOption.getOpt()), cmd.getOptionValue(logConfigurationOption.getOpt()), cmd.getOptionValue(consoleLoggingOption.getOpt()), cmd.getOptionValue(consoleLogCatOption.getOpt())); try { Logging.registerLog4jMBeans(); } catch (JMException e) { infolog.error("Unable to register log4j JMX control", e); } infolog.info("Starting the Lily Runtime."); List<File> confDirs = new ArrayList<File>(); if (!cmd.hasOption(confDirsOption.getOpt())) { File confDir = new File(DEFAULT_CONF_DIR).getAbsoluteFile(); if (!confDir.exists()) { System.out.println("Default configuration directory " + DEFAULT_CONF_DIR + " not found in current directory: " + confDir.getAbsolutePath()); System.out .println("To specify another location, use the -" + confDirsOption.getOpt() + " argument"); System.exit(1); } confDirs.add(confDir); } else { String confPathArg = cmd.getOptionValue(confDirsOption.getOpt()); String[] confPaths = confPathArg.split(File.pathSeparator); for (String confPath : confPaths) { confPath = confPath.trim(); if (confPath.length() == 0) { continue; } File confDir = new File(confPath); if (!confDir.exists()) { System.out.println( "Specified configuration directory does not exist: " + confDir.getAbsolutePath()); System.exit(1); } confDirs.add(confDir); } } ArtifactRepository artifactRepository; if (cmd.hasOption(repositoryLocationOption.getOpt())) { artifactRepository = new ChainedMaven2StyleArtifactRepository( cmd.getOptionValue(repositoryLocationOption.getOpt())); } else { File maven2Repository = findLocalMavenRepository(); infolog.info("Using local Maven repository at " + maven2Repository.getAbsolutePath()); artifactRepository = new Maven2StyleArtifactRepository(maven2Repository); } Set<String> disabledModuleIds = getDisabledModuleIds(cmd.getOptionValue(disabledModulesOption.getOpt())); SourceLocations sourceLocations; if (cmd.hasOption(sourceLocationsOption.getOpt())) { File file = new File(cmd.getOptionValue(sourceLocationsOption.getOpt())).getAbsoluteFile(); if (!file.exists()) { System.out.println( "The specified source locations property file does not exist: " + file.getAbsolutePath()); System.exit(1); } InputStream is = null; try { is = new FileInputStream(file); sourceLocations = new SourceLocations(is, file.getParent()); } catch (Throwable t) { throw new LilyRTException("Problem reading source locations property file.", t); } finally { IOUtils.closeQuietly(is); } } else { sourceLocations = new SourceLocations(); } LilyRuntimeSettings settings = new LilyRuntimeSettings(); settings.setConfManager(new ConfManagerImpl(confDirs)); settings.setDisabledModuleIds(disabledModuleIds); settings.setRepository(artifactRepository); settings.setSourceLocations(sourceLocations); settings.setEnableArtifactSharing(!cmd.hasOption(disableClassSharingOption.getOpt())); LilyRuntime runtime = new LilyRuntime(settings); if (cmd.hasOption(modeOption.getOpt())) { String optionValue = cmd.getOptionValue(modeOption.getOpt()); Mode mode = Mode.byName(optionValue); runtime.setMode(mode); } if (cmd.hasOption(versionOption.getOpt())) { System.out.println(runtime.buildModel().moduleInfo(System.getProperty("lilyruntime.info.module"))); System.exit(0); } try { runtime.start(); Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownHandler(runtime))); printStartedMessage(); } catch (Throwable e) { e.printStackTrace(); System.err.println("Startup failed. Will try to shutdown and exit."); try { runtime.stop(); } finally { System.exit(1); } } }
From source file:gov.nrel.bacnet.consumer.BACnet.java
public BACnet(Config t_config) { config = t_config;//w ww. j a va2 s . c o m tracker = new TaskTracker(); localDevice = null; logHandler = null; try { logger.info("starting. Loading logging.properties first to log to a file in logs directory"); FileInputStream configFile = new FileInputStream(config.getLoggingPropertiesFileName()); LogManager.getLogManager().readConfiguration(configFile); if (config.getVerboseLogging()) { logger.setLevel(Level.INFO); } if (config.getVeryVerboseLogging()) { logger.setLevel(Level.ALL); } logger.info("Starting now that logger properties are loaded"); LocalDevice.setExceptionListener(new MyExceptionListener()); initialize(config); } catch (Throwable e) { logger.log(Level.WARNING, "exception starting", e); } }
From source file:com.gisgraphy.domain.geoloc.service.fulltextsearch.SolrClientTest.java
@Test public void testSetSolRLogLevel() throws Exception { IsolrClient client = new SolrClient(AbstractIntegrationHttpSolrTestCase.fulltextSearchUrlBinded, new MultiThreadedHttpConnectionManager()); assertTrue(client.isServerAlive());//ww w . j av a2s. c o m client.setSolRLogLevel(Level.CONFIG); client.setSolRLogLevel(Level.FINE); client.setSolRLogLevel(Level.FINER); client.setSolRLogLevel(Level.FINEST); client.setSolRLogLevel(Level.INFO); client.setSolRLogLevel(Level.SEVERE); client.setSolRLogLevel(Level.WARNING); client.setSolRLogLevel(Level.ALL); client.setSolRLogLevel(Level.OFF); }
From source file:ffx.ui.LogHandler.java
/** * Construct the Force Field X logging handler. * * @since 1.0 */ public LogHandler() { setFormatter(new LogFormatter(false)); setLevel(Level.ALL); }