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:Main.java
public static void main(String args[]) throws Exception { Logger logger = Logger.getLogger("your.logging"); ConsoleHandler handler = new ConsoleHandler(); MemoryHandler mHandler = new MemoryHandler(handler, 10, Level.ALL); logger.addHandler(mHandler);/*from w w w. jav a 2 s .com*/ logger.setUseParentHandlers(false); LogRecord record1 = new LogRecord(Level.SEVERE, "This is SEVERE level message"); LogRecord record2 = new LogRecord(Level.WARNING, "This is WARNING level message"); logger.log(record1); logger.log(record2); }
From source file:MyHtmlFormatter.java
public static void main(String[] argv) throws Exception { Logger logger = Logger.getLogger("com.mycompany"); FileHandler fh = new FileHandler("mylog.html"); fh.setFormatter(new MyHtmlFormatter()); logger.addHandler(fh);//from ww w .j av a 2s . com logger.setLevel(Level.ALL); logger.severe("my severe message"); logger.info("my info message"); logger.entering("Main class", "myMethod", new Object[] { "para1", "para2" }); }
From source file:HTMLFormatter.java
public static void main(String args[]) throws Exception { LogManager lm = LogManager.getLogManager(); Logger parentLogger, childLogger; FileHandler xml_handler = new FileHandler("log_output.xml"); FileHandler html_handler = new FileHandler("log_output.html"); parentLogger = Logger.getLogger("ParentLogger"); childLogger = Logger.getLogger("ParentLogger.ChildLogger"); lm.addLogger(parentLogger);/* w w w.ja v a 2s . c om*/ lm.addLogger(childLogger); parentLogger.setLevel(Level.WARNING); childLogger.setLevel(Level.ALL); xml_handler.setFormatter(new XMLFormatter()); html_handler.setFormatter(new HTMLFormatter()); parentLogger.addHandler(xml_handler); childLogger.addHandler(html_handler); childLogger.log(Level.FINE, "This is a fine log message"); childLogger.log(Level.SEVERE, "This is a severe log message"); xml_handler.close(); html_handler.close(); }
From source file:net.oneandone.shared.artifactory.App.java
public static void main(String[] args) throws ParseException, IOException, NotFoundException { initLogging();/*from www.j a v a 2 s . c om*/ LOG.info("CLI: {}", Arrays.toString(args)); final Options options = new Options() .addOption("l", "uri", true, "Base-URI in the form of " + DEFAULT_ARTIFACTORY_URI) .addOption("u", "user", true, "Username").addOption("p", "password", true, "Password") .addOption("d", "debug", false, "Turn on debugging"); final CommandLine commandline = new BasicParser().parse(options, args); if (commandline.hasOption("d")) { LOG.info("Setting debug"); java.util.logging.Logger.getLogger("net.oneandone.shared.artifactory").setLevel(Level.ALL); } final List<String> argList = commandline.getArgList(); LOG.info("ARGS: {}", argList); Injector injector = Guice.createInjector(new ArtifactoryModule()); App instance = injector.getInstance(App.class); instance.preemptiveRequestInterceptor.addCredentialsForHost("web.de", "foo", "bar"); List<ArtifactoryStorage> search = instance.searchByGav.search("repo1-cache", Gav.valueOf(argList.get(0))); LOG.info("Got {} search results", search.size()); }
From source file:net.zdechov.sharpmz.jmzemu.JMzEmu.java
/** * Main method launching the application. * * @param args arguments/* w w w . j a va 2s .c o m*/ */ public static void main(String[] args) { try { preferences = Preferences.userNodeForPackage(JMzEmu.class); } catch (SecurityException ex) { preferences = null; } try { bundle = LanguageUtils.getResourceBundleByClass(JMzEmu.class); // Parameters processing Options opt = new Options(); opt.addOption("h", "help", false, bundle.getString("cl_option_help")); opt.addOption("v", false, bundle.getString("cl_option_verbose")); opt.addOption("dev", false, bundle.getString("cl_option_dev")); BasicParser parser = new BasicParser(); CommandLine cl = parser.parse(opt, args); if (cl.hasOption('h')) { HelpFormatter f = new HelpFormatter(); f.printHelp(bundle.getString("cl_syntax"), opt); } else { verboseMode = cl.hasOption("v"); devMode = cl.hasOption("dev"); Logger logger = Logger.getLogger(""); try { logger.setLevel(Level.ALL); logger.addHandler(new XBHead.XBLogHandler(verboseMode)); } catch (java.security.AccessControlException ex) { // Ignore it in java webstart } XBBaseApplication app = new XBBaseApplication(); app.setAppPreferences(new PreferencesWrapper(preferences)); app.setAppBundle(bundle, LanguageUtils.getResourceBaseNameBundleByClass(JMzEmu.class)); XBApplicationModuleRepository moduleRepository = app.getModuleRepository(); moduleRepository.addClassPathModules(); moduleRepository.addModulesFromManifest(JMzEmu.class); moduleRepository.loadModulesFromPath(new File("plugins").toURI()); moduleRepository.initModules(); app.init(); GuiFrameModuleApi frameModule = moduleRepository.getModuleByInterface(GuiFrameModuleApi.class); GuiEditorModuleApi editorModule = moduleRepository.getModuleByInterface(GuiEditorModuleApi.class); GuiMenuModuleApi menuModule = moduleRepository.getModuleByInterface(GuiMenuModuleApi.class); GuiAboutModuleApi aboutModule = moduleRepository.getModuleByInterface(GuiAboutModuleApi.class); GuiFileModuleApi fileModule = moduleRepository.getModuleByInterface(GuiFileModuleApi.class); GuiOptionsModuleApi optionsModule = moduleRepository .getModuleByInterface(GuiOptionsModuleApi.class); GuiUpdateModuleApi updateModule = moduleRepository.getModuleByInterface(GuiUpdateModuleApi.class); frameModule.createMainMenu(); // try { // updateModule.setUpdateUrl(new URL(bundle.getString("update_url"))); // updateModule.setUpdateDownloadUrl(new URL(bundle.getString("update_download_url"))); // } catch (MalformedURLException ex) { // Logger.getLogger(JMzEmu.class.getName()).log(Level.SEVERE, null, ex); // } updateModule.registerDefaultMenuItem(); aboutModule.registerDefaultMenuItem(); AboutDialogSidePanel sidePanel = new AboutDialogSidePanel(); aboutModule.setAboutDialogSideComponent(sidePanel); frameModule.registerExitAction(); frameModule.registerBarsVisibilityActions(); // Register clipboard editing actions fileModule.registerMenuFileHandlingActions(); fileModule.registerToolBarFileHandlingActions(); fileModule.registerLastOpenedMenuActions(); fileModule.registerCloseListener(); // undoModule.registerMainMenu(); // undoModule.registerMainToolBar(); // undoModule.registerUndoManagerInMainMenu(); // Register clipboard editing actions menuModule.getClipboardActions(); // menuModule.registerMenuClipboardActions(); // menuModule.registerToolBarClipboardActions(); optionsModule.registerMenuAction(); // HexPanel hexPanel = (HexPanel) deltaHexModule.getEditorProvider(); // editorModule.registerEditor("hex", hexPanel); // editorModule.registerUndoHandler(); // undoModule.setUndoHandler(hexPanel.getHexUndoHandler()); // deltaHexModule.registerStatusBar(); // deltaHexModule.registerOptionsPanels(); // deltaHexModule.getTextStatusPanel(); updateModule.registerOptionsPanels(); // deltaHexModule.loadFromPreferences(preferences); ApplicationFrameHandler frameHandler = frameModule.getFrameHandler(); GraphicsModule graphicsModule = new GraphicsModule(); frameHandler.setMainPanel(graphicsModule.getGraphicsComponent()); frameHandler.setDefaultSize(new Dimension(600, 400)); frameHandler.show(); updateModule.checkOnStart(frameHandler.getFrame()); List fileArgs = cl.getArgList(); if (fileArgs.size() > 0) { fileModule.loadFromFile((String) fileArgs.get(0)); } } } catch (ParseException | RuntimeException ex) { Logger.getLogger(JMzEmu.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:org.exbin.deltahex.editor.DeltaHexEditor.java
/** * Main method launching the application. * * @param args arguments/*from ww w .j a va2s. c o m*/ */ public static void main(String[] args) { try { preferences = Preferences.userNodeForPackage(DeltaHexEditor.class); } catch (SecurityException ex) { preferences = null; } try { bundle = LanguageUtils.getResourceBundleByClass(DeltaHexEditor.class); // Parameters processing Options opt = new Options(); opt.addOption("h", "help", false, bundle.getString("cl_option_help")); opt.addOption("v", false, bundle.getString("cl_option_verbose")); opt.addOption("dev", false, bundle.getString("cl_option_dev")); BasicParser parser = new BasicParser(); CommandLine cl = parser.parse(opt, args); if (cl.hasOption('h')) { HelpFormatter f = new HelpFormatter(); f.printHelp(bundle.getString("cl_syntax"), opt); } else { verboseMode = cl.hasOption("v"); devMode = cl.hasOption("dev"); Logger logger = Logger.getLogger(""); try { logger.setLevel(Level.ALL); logger.addHandler(new XBHead.XBLogHandler(verboseMode)); } catch (java.security.AccessControlException ex) { // Ignore it in java webstart } XBBaseApplication app = new XBBaseApplication(); app.setAppPreferences(preferences); app.setAppBundle(bundle, LanguageUtils.getResourceBaseNameBundleByClass(DeltaHexEditor.class)); XBApplicationModuleRepository moduleRepository = app.getModuleRepository(); moduleRepository.addClassPathModules(); moduleRepository.addModulesFromManifest(DeltaHexEditor.class); moduleRepository.loadModulesFromPath(new File("plugins").toURI()); moduleRepository.initModules(); app.init(); GuiFrameModuleApi frameModule = moduleRepository.getModuleByInterface(GuiFrameModuleApi.class); GuiEditorModuleApi editorModule = moduleRepository.getModuleByInterface(GuiEditorModuleApi.class); GuiMenuModuleApi menuModule = moduleRepository.getModuleByInterface(GuiMenuModuleApi.class); GuiAboutModuleApi aboutModule = moduleRepository.getModuleByInterface(GuiAboutModuleApi.class); GuiUndoModuleApi undoModule = moduleRepository.getModuleByInterface(GuiUndoModuleApi.class); GuiFileModuleApi fileModule = moduleRepository.getModuleByInterface(GuiFileModuleApi.class); GuiOptionsModuleApi optionsModule = moduleRepository .getModuleByInterface(GuiOptionsModuleApi.class); GuiDockingModuleApi dockingModule = moduleRepository .getModuleByInterface(GuiDockingModuleApi.class); GuiUpdateModuleApi updateModule = moduleRepository.getModuleByInterface(GuiUpdateModuleApi.class); DeltaHexModule deltaHexModule = moduleRepository.getModuleByInterface(DeltaHexModule.class); frameModule.createMainMenu(); try { updateModule.setUpdateUrl(new URL(bundle.getString("update_url"))); updateModule.setUpdateDownloadUrl(new URL(bundle.getString("update_download_url"))); } catch (MalformedURLException ex) { Logger.getLogger(DeltaHexEditor.class.getName()).log(Level.SEVERE, null, ex); } updateModule.registerDefaultMenuItem(); aboutModule.registerDefaultMenuItem(); frameModule.registerExitAction(); frameModule.registerBarsVisibilityActions(); // Component dockingPanel = dockingModule.getDockingPanel(); // Register clipboard editing actions fileModule.registerMenuFileHandlingActions(); fileModule.registerToolBarFileHandlingActions(); fileModule.registerLastOpenedMenuActions(); fileModule.registerCloseListener(); undoModule.registerMainMenu(); undoModule.registerMainToolBar(); undoModule.registerUndoManagerInMainMenu(); // Register clipboard editing actions menuModule.registerMenuClipboardActions(); menuModule.registerToolBarClipboardActions(); optionsModule.registerMenuAction(); // HexEditorProvider editorProvider = deltaHexModule.getMultiEditorProvider(); HexEditorProvider editorProvider = deltaHexModule.getEditorProvider(); deltaHexModule.registerEditFindMenuActions(); deltaHexModule.registerEditFindToolBarActions(); deltaHexModule.registerViewNonprintablesMenuActions(); deltaHexModule.registerToolsOptionsMenuActions(); deltaHexModule.registerClipboardCodeActions(); deltaHexModule.registerOptionsMenuPanels(); deltaHexModule.registerGoToLine(); deltaHexModule.registerPropertiesMenu(); deltaHexModule.registerPrintMenu(); deltaHexModule.registerViewModeMenu(); deltaHexModule.registerCodeTypeMenu(); deltaHexModule.registerPositionCodeTypeMenu(); deltaHexModule.registerHexCharactersCaseHandlerMenu(); deltaHexModule.registerWordWrapping(); ApplicationFrameHandler frameHandler = frameModule.getFrameHandler(); editorModule.registerEditor("hex", editorProvider); // editorModule.registerMultiEditor("hex", (MultiEditorProvider) editorProvider); editorModule.registerUndoHandler(); undoModule.setUndoHandler(editorProvider.getHexUndoHandler()); deltaHexModule.registerStatusBar(); deltaHexModule.registerOptionsPanels(); deltaHexModule.getTextStatusPanel(); updateModule.registerOptionsPanels(); deltaHexModule.loadFromPreferences(preferences); // frameHandler.setMainPanel(dockingPanel); // Single editor only frameHandler.setMainPanel(editorModule.getEditorPanel()); frameHandler.setDefaultSize(new Dimension(600, 400)); frameHandler.show(); updateModule.checkOnStart(frameHandler.getFrame()); List fileArgs = cl.getArgList(); if (fileArgs.size() > 0) { fileModule.loadFromFile((String) fileArgs.get(0)); } } } catch (ParseException | RuntimeException ex) { Logger.getLogger(DeltaHexEditor.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:org.ow2.mind.doc.Launcher.java
public static void main(final String[] args) { initLogger();//from ww w . j a v a 2 s . com if (System.getenv(MINDOC_HOME) == null) { logger.severe( "MINDOC_HOME variable is not defined. MINDOC_HOME must point to the location where mindoc is installed."); System.exit(1); } final Option destinationPathOption = new Option(DESTINATION_PATH_OPTION, true, "The path where the documentation is generated."); //destinationPathOption.setRequired(true); final Option verboseOption = new Option(VERBOSE_OPTION, false, "Verbose output."); final Option helpDirectoryOption = new Option(HELP_OPTION_SHORT, HELP_OPTION, false, "Print this message and exit."); final Option overviewOption = new Option(OVERVIEW_OPTION, true, "Specifies the file that contains the overview documentation."); final Option docTitleOption = new Option(DOCTITLE_OPTION, true, "Specifies the title that will be used in the the overview page."); options.addOption(destinationPathOption); options.addOption(verboseOption); options.addOption(helpDirectoryOption); options.addOption(overviewOption); options.addOption(docTitleOption); File sourceDirectories[] = null; File targetDirectory = new File(DEFAULT_DESTINATION); File overviewFile = null; String docTitle = null; final CommandLineParser parser = new PosixParser(); try { final CommandLine cmd = parser.parse(options, args); if (cmd.hasOption(HELP_OPTION)) { printHelp(); System.exit(0); } if (cmd.hasOption(VERBOSE_OPTION)) logger.setLevel(Level.ALL); if (cmd.getArgs().length >= 1) { final String sourceList[] = cmd.getArgs(); sourceDirectories = new File[sourceList.length]; for (int i = 0; i < sourceList.length; i++) { final File sourceDirectory = new File(sourceList[i]); if (!sourceDirectory.isDirectory() || !sourceDirectory.canRead()) { logger.severe(String.format("Cannot read source path '%s'.", sourceDirectory.getPath())); System.exit(2); } sourceDirectories[i] = sourceDirectory; } } else { logger.severe("You must specify a source path."); printHelp(); System.exit(1); } if (cmd.hasOption(DESTINATION_PATH_OPTION)) { targetDirectory = new File(cmd.getOptionValue(DESTINATION_PATH_OPTION)); } else { logger.info( "Destination directory not specified. Documentation will be generated in default location (" + DEFAULT_DESTINATION + ")."); } if (cmd.hasOption(OVERVIEW_OPTION)) { overviewFile = new File(cmd.getOptionValue(OVERVIEW_OPTION)); } if (cmd.hasOption(DOCTITLE_OPTION)) { docTitle = cmd.getOptionValue(DOCTITLE_OPTION); } } catch (final ParseException e) { logger.severe("Command line parse error. Reason: " + e.getMessage()); System.exit(1); } //check destination directory if (targetDirectory.exists()) { if (!targetDirectory.isDirectory()) { logger.severe("Destination path must be a directory."); System.exit(1); } if (!targetDirectory.canWrite()) { logger.severe("Cannot write in destination directory."); System.exit(1); } } else { if (!targetDirectory.mkdirs()) { logger.severe("Cannot create destination directory."); System.exit(1); } } runGenarators(sourceDirectories, targetDirectory, new File(getMindocHome(), RESOURCE_DIR_NAME), docTitle, overviewFile); ResourceCopier.copyResources(sourceDirectories, targetDirectory); logger.info("Documentation generated in " + targetDirectory.getPath()); }
From source file:sdmx.net.service.opensdmx.OpenSDMXRESTQueryable.java
public static void main(String args[]) { OpenSDMXRESTQueryable registry = new OpenSDMXRESTQueryable("FAO", "http://data.fao.org/sdmx"); //SdmxIO.setSaveXml(true); SdmxIO.setLogLevel(7);// w w w .j av a2 s. com Logger.getLogger("sdmx").setLevel(Level.ALL); DataStructureReference ref = DataStructureReference.create(new NestedNCNameID("FAO"), new IDType("CAPTURE_DATASTRUCTURE"), new Version("0.1")); System.out.println("DataStructure=" + registry.find(ref)); }
From source file:asl.seedscan.DQAWeb.java
public static void main(String args[]) { db = new MetricDatabase("", "", ""); findConsoleHandler();//from www. j a v a 2 s .c om consoleHandler.setLevel(Level.ALL); Logger.getLogger("").setLevel(Level.CONFIG); // Default locations of config and schema files File configFile = new File("dqaweb-config.xml"); File schemaFile = new File("schemas/DQAWebConfig.xsd"); boolean parseConfig = true; boolean testMode = false; ArrayList<File> schemaFiles = new ArrayList<File>(); schemaFiles.add(schemaFile); // ==== Command Line Parsing ==== Options options = new Options(); Option opConfigFile = new Option("c", "config-file", true, "The config file to use for seedscan. XML format according to SeedScanConfig.xsd."); Option opSchemaFile = new Option("s", "schema-file", true, "The schame file which should be used to verify the config file format. "); Option opTest = new Option("t", "test", false, "Run in test console mode rather than as a servlet."); OptionGroup ogConfig = new OptionGroup(); ogConfig.addOption(opConfigFile); OptionGroup ogSchema = new OptionGroup(); ogConfig.addOption(opSchemaFile); OptionGroup ogTest = new OptionGroup(); ogTest.addOption(opTest); options.addOptionGroup(ogConfig); options.addOptionGroup(ogSchema); options.addOptionGroup(ogTest); PosixParser optParser = new PosixParser(); CommandLine cmdLine = null; try { cmdLine = optParser.parse(options, args, true); } catch (org.apache.commons.cli.ParseException e) { logger.severe("Error while parsing command-line arguments."); System.exit(1); } Option opt; Iterator iter = cmdLine.iterator(); while (iter.hasNext()) { opt = (Option) iter.next(); if (opt.getOpt().equals("c")) { configFile = new File(opt.getValue()); } else if (opt.getOpt().equals("s")) { schemaFile = new File(opt.getValue()); } else if (opt.getOpt().equals("t")) { testMode = true; } } String query = ""; System.out.println("Entering Test Mode"); System.out.println("Enter a query string to view results or type \"help\" for example query strings"); InputStreamReader input = new InputStreamReader(System.in); BufferedReader reader = new BufferedReader(input); String result = ""; while (testMode == true) { try { System.out.printf("Query: "); query = reader.readLine(); if (query.equals("exit")) { testMode = false; } else if (query.equals("help")) { System.out.println("Need to add some help for people"); //TODO } else { result = processCommand(query); } System.out.println(result); } catch (IOException err) { System.err.println("Error reading line, in DQAWeb.java"); } } System.err.printf("DONE.\n"); }
From source file:Logi.GSeries.Service.LogiGSKService.java
/** * @param args the command line arguments *///from w w w . jav a2 s. c o m public static void main(String[] args) { SystemTray.DEBUG = false; Settings settings; if (IOOperations.currentSettingsExist()) { settings = IOOperations.loadCurrentSettingsObjectFromFile(); } else { settings = new Settings(); } LogiGSKService l = new LogiGSKService(); if (settings.getShowSystemTray()) { l.showSystemTray(); } else { l.hideSystemTray(); } l.begin(); try { String dataFolderPath = IOOperations.getLocalDataDirectoryPath(); File dataFolder = new File(dataFolderPath); if (!dataFolder.exists()) { dataFolder.mkdir(); } String logFolderPath = IOOperations.getLogDirectoryPath(); File logFolder = new File(logFolderPath); if (!logFolder.exists()) { logFolder.mkdir(); } FileHandler fileHandler = new FileHandler(logFolderPath + "LogiGSK.log", FILE_SIZE, 3); fileHandler.setLevel(Level.ALL); logger.setLevel(Level.ALL); logger.addHandler(fileHandler); } catch (IOException | SecurityException ex) { Logger.getLogger(LogiGSKService.class.getName()).log(Level.SEVERE, null, ex); } int clientNumber = 0; ServerSocket listener = null; PropertyConfigurator.configure(LogiGSKService.class.getResource("/Logi/GSeries/Service/log4j.properties")); reloading = true; boolean firstTime = true; while (reloading) { listener = null; if (reloading && !firstTime) { if (IOOperations.currentSettingsExist()) { settings = IOOperations.loadCurrentSettingsObjectFromFile(); } else { settings = new Settings(); } } firstTime = false; reloading = false; running = true; try { listener = new ServerSocket(settings.getPort(), 0, InetAddress.getByName(null)); while (running) { new Manager(listener.accept(), clientNumber++, logger).start(); } } catch (IOException ex) { Logger.getLogger(LogiGSKService.class.getName()).log(Level.SEVERE, null, ex); } finally { if (listener != null) { try { listener.close(); } catch (IOException ex) { Logger.getLogger(LogiGSKService.class.getName()).log(Level.SEVERE, null, ex); } } } } }