List of usage examples for java.util.logging Level WARNING
Level WARNING
To view the source code for java.util.logging Level WARNING.
Click Source Link
From source file:com.opensearchserver.textextractor.Main.java
public static void main(String[] args) throws IOException, ParseException { Logger.getLogger("").setLevel(Level.WARNING); Options options = new Options(); options.addOption("h", "help", false, "print this message"); options.addOption("p", "port", true, "TCP port"); CommandLineParser parser = new GnuParser(); CommandLine cmd = parser.parse(options, args); if (cmd.hasOption("help")) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("java -jar target/oss-text-extractor.jar", options); return;//from ww w. ja va2s . c om } int port = cmd.hasOption("p") ? Integer.parseInt(cmd.getOptionValue("p")) : 9091; UndertowJaxrsServer server = new UndertowJaxrsServer() .start(Undertow.builder().addHttpListener(port, "localhost")); server.deploy(Main.class); }
From source file:com.opensearchserver.affinities.Main.java
public static void main(String[] args) throws IOException, ParseException { Logger.getLogger("").setLevel(Level.WARNING); Options options = new Options(); options.addOption("h", "help", false, "print this message"); options.addOption("d", "datadir", true, "Data directory"); options.addOption("p", "port", true, "TCP port"); CommandLineParser parser = new GnuParser(); CommandLine cmd = parser.parse(options, args); if (cmd.hasOption("help")) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("java -jar target/oss-affinities.jar", options); return;/*from w w w.jav a 2 s . co m*/ } int port = cmd.hasOption("p") ? Integer.parseInt(cmd.getOptionValue("p")) : 9092; File dataDir = new File(System.getProperty("user.home"), "opensearchserver_affinities"); if (cmd.hasOption("d")) dataDir = new File(cmd.getOptionValue("d")); if (!dataDir.exists()) throw new IOException("The data directory does not exists: " + dataDir); if (!dataDir.isDirectory()) throw new IOException("The data directory path is not a directory: " + dataDir); AffinityList.load(dataDir); UndertowJaxrsServer server = new UndertowJaxrsServer() .start(Undertow.builder().addHttpListener(port, "0.0.0.0")); server.deploy(Main.class); }
From source file:de.fosd.jdime.JDimeWrapper.java
public static void main(String[] args) throws IOException, InterruptedException { // setup logging Logger root = Logger.getLogger(JDimeWrapper.class.getPackage().getName()); root.setLevel(Level.WARNING); for (Handler handler : root.getHandlers()) { handler.setLevel(Level.WARNING); }//from w ww.j a va 2 s. c o m // setup JDime using the MergeContext MergeContext context = new MergeContext(); context.setPretend(true); context.setQuiet(false); // prepare the list of input files ArtifactList<FileArtifact> inputArtifacts = new ArtifactList<>(); for (String filename : args) { try { File file = new File(filename); // the revision name, this will be used as condition for ifdefs // as an example, I'll just use the filenames Revision rev = new Revision(FilenameUtils.getBaseName(file.getPath())); FileArtifact newArtifact = new FileArtifact(rev, file); inputArtifacts.add(newArtifact); } catch (FileNotFoundException e) { System.err.println("Input file not found: " + filename); } } context.setInputFiles(inputArtifacts); // setup strategies MergeStrategy<FileArtifact> structured = new StructuredStrategy(); MergeStrategy<FileArtifact> conditional = new NWayStrategy(); // run the merge first with structured strategy to see whether there are conflicts context.setMergeStrategy(structured); context.collectStatistics(true); Operation<FileArtifact> merge = new MergeOperation<>(context.getInputFiles(), context.getOutputFile(), null, null, context.isConditionalMerge()); merge.apply(context); // if there are no conflicts, run the conditional strategy if (context.getStatistics().hasConflicts()) { context = new MergeContext(context); context.collectStatistics(false); context.setMergeStrategy(conditional); // use regular merging outside of methods context.setConditionalOutsideMethods(false); // we have to recreate the operation because now we will do a conditional merge merge = new MergeOperation<>(context.getInputFiles(), context.getOutputFile(), null, null, context.isConditionalMerge()); merge.apply(context); } }
From source file:org.schemaspy.Main.java
public static void main(String[] argv) throws Exception { Logger logger = Logger.getLogger(Main.class.getName()); final AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext( "org.schemaspy.service"); applicationContext.register(SchemaAnalyzer.class); if (argv.length == 1 && "-gui".equals(argv[0])) { // warning: serious temp hack new MainFrame().setVisible(true); return;//from w ww . j a va2 s. co m } SchemaAnalyzer analyzer = applicationContext.getBean(SchemaAnalyzer.class); int rc = 1; try { rc = analyzer.analyze(new Config(argv)) == null ? 1 : 0; } catch (ConnectionFailure couldntConnect) { logger.log(Level.WARNING, "Connection Failure", couldntConnect); rc = 3; } catch (EmptySchemaException noData) { logger.log(Level.WARNING, "Empty schema", noData); rc = 2; } catch (InvalidConfigurationException badConfig) { logger.info(""); if (badConfig.getParamName() != null) logger.log(Level.WARNING, "Bad parameter specified for " + badConfig.getParamName()); logger.log(Level.WARNING, "Bad config " + badConfig.getMessage()); if (badConfig.getCause() != null && !badConfig.getMessage().endsWith(badConfig.getMessage())) logger.log(Level.WARNING, " caused by " + badConfig.getCause().getMessage()); logger.log(Level.FINE, "Command line parameters: " + Arrays.asList(argv)); logger.log(Level.FINE, "Invalid configuration detected", badConfig); } catch (ProcessExecutionException badLaunch) { logger.log(Level.WARNING, badLaunch.getMessage(), badLaunch); } catch (Exception exc) { logger.log(Level.SEVERE, exc.getMessage(), exc); } System.exit(rc); }
From source file:LogWindow.java
public static void main(String args[]) { Main demo = new Main(); demo.logMessage();/*from w w w .j av a 2 s . co m*/ WindowHandler h = WindowHandler.getInstance(); LogRecord r = new LogRecord(Level.WARNING, "The Handler publish method..."); h.publish(r); }
From source file:com.almende.eve.deploy.Boot.java
/** * The default agent booter. It takes an EVE yaml file and creates all * agents mentioned in the "agents" section. * // www. j ava 2 s. c o m * @param args * Single argument: args[0] -> Eve yaml */ public static void main(final String[] args) { if (args.length == 0) { LOG.warning("Missing argument pointing to yaml file:"); LOG.warning("Usage: java -jar <jarfile> eve.yaml"); return; } final ClassLoader cl = new ClassLoader() { @Override protected Class<?> findClass(final String name) throws ClassNotFoundException { Class<?> result = null; try { result = super.findClass(name); } catch (ClassNotFoundException cne) { } if (result == null) { FileInputStream fi = null; try { String path = name.replace('.', '/'); fi = new FileInputStream(System.getProperty("user.dir") + "/" + path + ".class"); byte[] classBytes = new byte[fi.available()]; fi.read(classBytes); fi.close(); return defineClass(name, classBytes, 0, classBytes.length); } catch (Exception e) { LOG.log(Level.WARNING, "Failed to load class:", e); } } if (result == null) { throw new ClassNotFoundException(name); } return result; } }; String configFileName = args[0]; try { InputStream is = new FileInputStream(new File(configFileName)); boot(is, cl); } catch (FileNotFoundException e) { LOG.log(Level.WARNING, "Couldn't find configfile:" + configFileName, e); return; } }
From source file:havocx42.Program.java
public static void main(String[] args) throws ParseException { try {/*from w w w . j ava 2 s . c o m*/ initRootLogger(); } catch (SecurityException | IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); return; } try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e1) { LOGGER.log(Level.WARNING, "Unable to set Look and Feel", e1); } Options options = new Options(); options.addOption("nogui", false, "run as a command line tool, must also supply -target and -source arguments"); options.addOption("source", true, "source directory where the PR weapons folder has been extracted"); options.addOption("target", true, "target file to write to"); options.addOption("version", false, "print the version information and exit"); options.addOption("help", false, "print this message"); CommandLineParser parser = new PosixParser(); CommandLine cmd = parser.parse(options, args); if (cmd.hasOption("version")) { System.out.println("PRStats " + VERSION); System.out.println("Written by havocx42"); return; } if ((cmd.hasOption("nogui") && (!cmd.hasOption("source") || !cmd.hasOption("target"))) || cmd.hasOption("help")) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("PRStats", options); return; } final String target; final String source; source = cmd.getOptionValue("source"); target = cmd.getOptionValue("target"); LOGGER.info("Source Argument: " + source); LOGGER.info("Target Argument: " + target); if (!cmd.hasOption("nogui")) { EventQueue.invokeLater(new Runnable() { @SuppressWarnings("unused") public void run() { try { Gui window = new Gui(source, target); } catch (Exception e) { e.printStackTrace(); } } }); return; } File targetFile = new File(target); File sourceFile = new File(source); Controller controller = new Controller(); controller.run(sourceFile, targetFile); }
From source file:com.googlecode.jgenhtml.JGenHtml.java
/** * Run jgenhtml.// w ww. java 2s.c o m * @param argv Arguments (viewable by running with -h switch). */ public static void main(final String[] argv) { Config config = new Config(); try { config.initializeUserPrefs(argv); if (config.isHelp()) { config.showCmdLineHelp(); } else if (config.isVersion()) { System.out.println("jgenhtml version " + VERSION); } else { String[] traceFiles = config.getTraceFiles(); if (traceFiles.length > 0) { CoverageReport.setConfig(config); CoverageReport coverageReport = new CoverageReport(traceFiles); if (coverageReport.getPageCount() > 0) { LOGGER.log(Level.INFO, "Found {0} entries.", coverageReport.getPageCount()); coverageReport.generateReports(); } } else { LOGGER.log(Level.INFO, "jgenhtml: No filename specified"); LOGGER.log(Level.INFO, "Use jgenhtml --help to get usage information"); } } } catch (IOException ex) { LOGGER.log(Level.SEVERE, null, ex); } catch (ParserConfigurationException ex) { LOGGER.log(Level.SEVERE, null, ex); } catch (ParseException ex) { LOGGER.log(Level.WARNING, ex.getLocalizedMessage()); } }
From source file:daylightchart.Main.java
/** * Main window./* w w w . j av a 2s . com*/ * * @param args * Arguments */ public static void main(final String[] args) { CommandLineUtility.setLogLevel(args); // Parse command line final CommandLineParser parser = new CommandLineParser(); parser.addOption(new BooleanOption(Option.NO_SHORT_FORM, OPTION_SLIMUI)); parser.addOption(new StringOption(Option.NO_SHORT_FORM, OPTION_PREFERENCES, null)); parser.addOption(new StringOption(Option.NO_SHORT_FORM, OPTION_LOCATION, null)); parser.parse(args); boolean slimUi = parser.getBooleanOptionValue(OPTION_SLIMUI); final String preferencesDirectory = parser.getStringOptionValue(OPTION_PREFERENCES); final String locationString = parser.getStringOptionValue(OPTION_LOCATION); Location location = null; if (locationString != null) { try { location = LocationsListParser.parseLocation(locationString); } catch (final ParserException e) { location = null; } } if (StringUtils.isNotBlank(preferencesDirectory)) { UserPreferences.initialize(Paths.get(preferencesDirectory)); } // Set UI look and feel try { PlasticLookAndFeel.setPlasticTheme(new LightGray()); UIManager.setLookAndFeel(new PlasticLookAndFeel()); } catch (final Exception e) { LOGGER.log(Level.WARNING, "Cannot set look and feel"); } final Options options = UserPreferences.optionsFile().getData(); if (!slimUi) { slimUi = options.isSlimUi(); } options.setSlimUi(slimUi); UserPreferences.optionsFile().save(options); new DaylightChartGui(location, slimUi).setVisible(true); }
From source file:Jimbo.Cheerlights.TweetListener.java
/** * @param args the command line arguments * @throws twitter4j.TwitterException/* ww w .j ava2s . c o m*/ * @throws java.io.IOException * @throws org.apache.commons.cli.ParseException In case of command line error */ public static void main(String[] args) throws TwitterException, IOException, ParseException { // Set up simpler logging to stdout Jimbo.Logging.Logging.useStdout(); LOG.log(Level.INFO, "Starting twitter listener"); Options options = new Options(); options.addOption("b", Listener.MQTT_BROKER_KEY, true, "URL of the broker") .addOption("c", Listener.MQTT_CLIENT_KEY, true, "The MQTT client name to use") .addOption("t", Listener.MQTT_TOPIC_KEY, true, "The MQTT topic to use"); CommandLineParser parser = new DefaultParser(); CommandLine command = parser.parse(options, args); MQTTClient mqtt = null; String mqtt_topic = Listener.DEFAULT_MQTT_TOPIC; if (command.hasOption(Listener.MQTT_BROKER_KEY)) { if (!command.hasOption(Listener.MQTT_CLIENT_KEY)) throw new ParseException("MQTT without client name"); if (command.hasOption(Listener.MQTT_TOPIC_KEY)) mqtt_topic = command.getOptionValue(Listener.MQTT_TOPIC_KEY); try { mqtt = new MQTTClient(command.getOptionValue(Listener.MQTT_BROKER_KEY), command.getOptionValue(Listener.MQTT_CLIENT_KEY)); mqtt.run(); } catch (MqttException e) { LOG.log(Level.WARNING, "Failed to create MQTT client: {0}", e.toString()); } } else { if (command.hasOption(Listener.MQTT_TOPIC_KEY)) LOG.warning("MQTT topic supplied but no broker"); if (command.hasOption(Listener.MQTT_CLIENT_KEY)) LOG.warning("MQTT client name but no broker"); } Twitter twitter = new TwitterFactory().getInstance(); StatusListener listener = new listener("224.1.1.1", (short) 5123, mqtt, mqtt_topic); FilterQuery fq = new FilterQuery(); String keywords[] = { "#cheerlights" }; fq.track(keywords); TwitterStream twitterStream = new TwitterStreamFactory().getInstance(); twitterStream.addListener(listener); twitterStream.filter(fq); LOG.log(Level.INFO, "Up and running...."); }