List of usage examples for java.util.logging Logger addHandler
public void addHandler(Handler handler) throws SecurityException
From source file:net.nharyes.drivecopy.Main.java
public static void main(String[] args) { // set logger handler Logger logger = Logger.getLogger(Main.class.getPackage().getName()); logger.setUseParentHandlers(false);/*from ww w . j av a 2 s. c om*/ logger.addHandler(new SystemOutHandler()); logger.setLevel(Level.FINE); new Main(args); }
From source file:org.azrul.langmera.DecisionService.java
public static void main(String[] args) throws IOException { ConfigurationProvider config = null; ConfigFilesProvider configFilesProvider = () -> Arrays.asList(Paths.get("config.properties")); if (args.length <= 0) { ConfigurationSource source = new ClasspathConfigurationSource(configFilesProvider); config = new ConfigurationProviderBuilder().withConfigurationSource(source).build(); } else {/*from w w w . j a v a2 s.co m*/ ConfigurationSource source = new FilesConfigurationSource(configFilesProvider); Environment environment = new ImmutableEnvironment(args[0]); config = new ConfigurationProviderBuilder().withConfigurationSource(source).withEnvironment(environment) .build(); } Logger logger = null; if (config.getProperty("log.file", String.class).isEmpty() == false) { FileHandler logHandler = new FileHandler(config.getProperty("log.file", String.class), config.getProperty("log.sizePerFile", Integer.class) * 1024 * 1024, config.getProperty("log.maxFileCount", Integer.class), true); logHandler.setFormatter(new SimpleFormatter()); logHandler.setLevel(Level.INFO); Logger rootLogger = Logger.getLogger(""); rootLogger.removeHandler(rootLogger.getHandlers()[0]); logHandler.setLevel(Level.parse(config.getProperty("log.level", String.class))); rootLogger.setLevel(Level.parse(config.getProperty("log.level", String.class))); rootLogger.addHandler(logHandler); logger = rootLogger; } else { logger = Logger.getGlobal(); } VertxOptions options = new VertxOptions(); options.setMaxEventLoopExecuteTime(Long.MAX_VALUE); options.setWorkerPoolSize(config.getProperty("workerPoolSize", Integer.class)); options.setEventLoopPoolSize(40); Vertx vertx = Vertx.vertx(options); vertx.deployVerticle(new DecisionService(logger, config)); vertx.deployVerticle(new SaveToDB(logger, config)); }
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);/*from ww w . j a v a2s.com*/ 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:de.burlov.amazon.s3.dirsync.CLI.java
/** * @param args//from w w w. j av a 2s. com */ @SuppressWarnings("static-access") public static void main(String[] args) { Logger.getLogger("").setLevel(Level.OFF); Logger deLogger = Logger.getLogger("de"); deLogger.setLevel(Level.INFO); Handler handler = new ConsoleHandler(); handler.setFormatter(new VerySimpleFormatter()); deLogger.addHandler(handler); deLogger.setUseParentHandlers(false); // if (true) // { // LogFactory.getLog(CLI.class).error("test msg", new Exception("test extception")); // return; // } Options opts = new Options(); OptionGroup gr = new OptionGroup(); /* * Befehlsgruppe initialisieren */ gr = new OptionGroup(); gr.setRequired(true); gr.addOption(OptionBuilder.withArgName("up|down").hasArg() .withDescription("Upload/Download changed or new files").create(CMD_UPDATE)); gr.addOption(OptionBuilder.withArgName("up|down").hasArg() .withDescription("Upload/Download directory snapshot").create(CMD_SNAPSHOT)); gr.addOption(OptionBuilder.withDescription("Delete remote folder").create(CMD_DELETE_DIR)); gr.addOption(OptionBuilder.withDescription("Delete a bucket").create(CMD_DELETE_BUCKET)); gr.addOption(OptionBuilder.create(CMD_HELP)); gr.addOption(OptionBuilder.create(CMD_VERSION)); gr.addOption(OptionBuilder.withDescription("Prints summary for stored data").create(CMD_SUMMARY)); gr.addOption(OptionBuilder.withDescription("Clean up orphaned objekts").create(CMD_CLEANUP)); gr.addOption(OptionBuilder.withDescription("Changes encryption password").withArgName("new password") .hasArg().create(CMD_CHANGE_PASSWORD)); gr.addOption(OptionBuilder.withDescription("Lists all buckets").create(CMD_LIST_BUCKETS)); gr.addOption(OptionBuilder.withDescription("Lists raw objects in a bucket").create(CMD_LIST_BUCKET)); gr.addOption(OptionBuilder.withDescription("Lists files in remote folder").create(CMD_LIST_DIR)); opts.addOptionGroup(gr); /* * Parametergruppe initialisieren */ opts.addOption(OptionBuilder.withArgName("key").isRequired(false).hasArg().withDescription("S3 access key") .create(OPT_S3S_KEY)); opts.addOption(OptionBuilder.withArgName("secret").isRequired(false).hasArg() .withDescription("Secret key for S3 account").create(OPT_S3S_SECRET)); opts.addOption(OptionBuilder.withArgName("bucket").isRequired(false).hasArg().withDescription( "Optional bucket name for storage. If not specified then an unique bucket name will be generated") .create(OPT_BUCKET)); // opts.addOption(OptionBuilder.withArgName("US|EU").hasArg(). // withDescription( // "Where the new bucket should be created. Default US").create( // OPT_LOCATION)); opts.addOption(OptionBuilder.withArgName("path").isRequired(false).hasArg() .withDescription("Local directory path").create(OPT_LOCAL_DIR)); opts.addOption(OptionBuilder.withArgName("name").isRequired(false).hasArg() .withDescription("Remote directory name").create(OPT_REMOTE_DIR)); opts.addOption(OptionBuilder.withArgName("password").isRequired(false).hasArg() .withDescription("Encryption password").create(OPT_ENC_PASSWORD)); opts.addOption(OptionBuilder.withArgName("patterns").hasArgs() .withDescription("Comma separated exclude file patterns like '*.tmp,*/dir/*.tmp'") .create(OPT_EXCLUDE_PATTERNS)); opts.addOption(OptionBuilder.withArgName("patterns").hasArgs().withDescription( "Comma separated include patterns like '*.java'. If not specified, then all files in specified local directory will be included") .create(OPT_INCLUDE_PATTERNS)); if (args.length == 0) { printUsage(opts); return; } CommandLine cmd = null; try { cmd = new GnuParser().parse(opts, args); if (cmd.hasOption(CMD_HELP)) { printUsage(opts); return; } if (cmd.hasOption(CMD_VERSION)) { System.out.println("s3dirsync version " + Version.CURRENT_VERSION); return; } String awsKey = cmd.getOptionValue(OPT_S3S_KEY); String awsSecret = cmd.getOptionValue(OPT_S3S_SECRET); String bucket = cmd.getOptionValue(OPT_BUCKET); String bucketLocation = cmd.getOptionValue(OPT_LOCATION); String localDir = cmd.getOptionValue(OPT_LOCAL_DIR); String remoteDir = cmd.getOptionValue(OPT_REMOTE_DIR); String password = cmd.getOptionValue(OPT_ENC_PASSWORD); String exclude = cmd.getOptionValue(OPT_EXCLUDE_PATTERNS); String include = cmd.getOptionValue(OPT_INCLUDE_PATTERNS); if (StringUtils.isBlank(awsKey) || StringUtils.isBlank(awsSecret)) { System.out.println("S3 account data required"); return; } if (StringUtils.isBlank(bucket)) { bucket = awsKey + ".dirsync"; } if (cmd.hasOption(CMD_DELETE_BUCKET)) { if (StringUtils.isBlank(bucket)) { System.out.println("Bucket name required"); return; } int deleted = S3Utils.deleteBucket(awsKey, awsSecret, bucket); System.out.println("Deleted objects: " + deleted); return; } if (cmd.hasOption(CMD_LIST_BUCKETS)) { for (String str : S3Utils.listBuckets(awsKey, awsSecret)) { System.out.println(str); } return; } if (cmd.hasOption(CMD_LIST_BUCKET)) { if (StringUtils.isBlank(bucket)) { System.out.println("Bucket name required"); return; } for (String str : S3Utils.listObjects(awsKey, awsSecret, bucket)) { System.out.println(str); } return; } if (StringUtils.isBlank(password)) { System.out.println("Encryption password required"); return; } char[] psw = password.toCharArray(); DirSync ds = new DirSync(awsKey, awsSecret, bucket, bucketLocation, psw); ds.setExcludePatterns(parseSubargumenths(exclude)); ds.setIncludePatterns(parseSubargumenths(include)); if (cmd.hasOption(CMD_SUMMARY)) { ds.printStorageSummary(); return; } if (StringUtils.isBlank(remoteDir)) { System.out.println("Remote directory name required"); return; } if (cmd.hasOption(CMD_DELETE_DIR)) { ds.deleteFolder(remoteDir); return; } if (cmd.hasOption(CMD_LIST_DIR)) { Folder folder = ds.getFolder(remoteDir); if (folder == null) { System.out.println("No such folder found: " + remoteDir); return; } for (Map.Entry<String, FileInfo> entry : folder.getIndexData().entrySet()) { System.out.println(entry.getKey() + " (" + FileUtils.byteCountToDisplaySize(entry.getValue().getLength()) + ")"); } return; } if (cmd.hasOption(CMD_CLEANUP)) { ds.cleanUp(); return; } if (cmd.hasOption(CMD_CHANGE_PASSWORD)) { String newPassword = cmd.getOptionValue(CMD_CHANGE_PASSWORD); if (StringUtils.isBlank(newPassword)) { System.out.println("new password required"); return; } char[] chars = newPassword.toCharArray(); ds.changePassword(chars); newPassword = null; Arrays.fill(chars, ' '); return; } if (StringUtils.isBlank(localDir)) { System.out.println(OPT_LOCAL_DIR + " argument required"); return; } String direction = ""; boolean up = false; boolean snapshot = false; if (StringUtils.isNotBlank(cmd.getOptionValue(CMD_UPDATE))) { direction = cmd.getOptionValue(CMD_UPDATE); } else if (StringUtils.isNotBlank(cmd.getOptionValue(CMD_SNAPSHOT))) { direction = cmd.getOptionValue(CMD_SNAPSHOT); snapshot = true; } if (StringUtils.isBlank(direction)) { System.out.println("Operation direction required"); return; } up = StringUtils.equalsIgnoreCase(OPT_UP, direction); File baseDir = new File(localDir); if (!baseDir.exists() && !baseDir.mkdirs()) { System.out.println("Invalid local directory: " + baseDir.getAbsolutePath()); return; } ds.syncFolder(baseDir, remoteDir, up, snapshot); } catch (DirSyncException e) { System.out.println(e.getMessage()); e.printStackTrace(); } catch (ParseException e) { System.out.println(e.getMessage()); printUsage(opts); } catch (Exception e) { e.printStackTrace(System.err); } }
From source file:de.pniehus.odal.App.java
public static void main(String[] args) throws IOException { List<Filter> filters = new ArrayList<Filter>(); filters.add(new RegexFilter()); filters.add(new FileTypeFilter()); filters.add(new KeywordFilter()); filters.add(new BlacklistFilter()); Profile p = parseArgs(args, filters); String fileName = "log-" + new Date().toString().replace(":", "-") + ".txt"; fileName = fileName.replace(" ", "-"); File logPath = new File(p.getLogDirectory() + fileName); if (!logPath.getParentFile().isDirectory() && !logPath.getParentFile().mkdirs()) { logPath = new File(fileName); }/*from w w w . j a v a 2 s . c o m*/ if (logPath.getParentFile().canWrite() || logPath.getParentFile().setWritable(true)) { SimpleLoggingSetup.configureRootLogger(logPath.getAbsolutePath(), p.getLogLevel(), !p.isSilent()); } else { Logger root = Logger.getLogger(""); for (Handler h : root.getHandlers()) { // Removing default console handlers if (h instanceof ConsoleHandler) { root.removeHandler(h); } } ConsolePrintLogHandler cplh = new ConsolePrintLogHandler(); cplh.setFormatter(new ScribblerLogFormat(SimpleLoggingSetup.DEFAULT_DATE_FORMAT)); root.addHandler(cplh); System.out.println("Unable to create log: insufficient permissions!"); } Logger.getLogger("").setLevel(p.getLogLevel()); mainLogger = Logger.getLogger(App.class.getCanonicalName()); untrustedSSLSetup(); mainLogger.info("Successfully intitialized ODAL"); if (!p.isLogging()) mainLogger.setLevel(Level.OFF); if (p.isWindowsConsoleMode() && !p.isLogging()) { Logger root = Logger.getLogger(""); for (Handler h : root.getHandlers()) { if (h instanceof FileHandler) { root.removeHandler(h); // Removes FileHandler to allow console output through logging } } } OdalGui ogui = new OdalGui(p, filters); }
From source file:com.flagleader.builder.FlagLeader.java
public static void main(String[] paramArrayOfString) { Shell localShell = new Shell(16777216); localShell.setLocation(new Point(300, 200)); localShell.setLayout(new FillLayout()); Composite localComposite = new Composite(localShell, 0); localComposite.setLayout(new FillLayout()); Label localLabel = new Label(localComposite, 0); Image localImage = ImageDescriptor .createFromURL(localShell.getClass().getClassLoader().getResource("icons/start.jpg")).createImage(); localLabel.setImage(localImage);//ww w . j a v a 2 s . c o m localShell.setSize(400, 300); localShell.setText("Visual Rules Solution"); localShell.open(); Init.a(); String str = null; if (BuilderConfig.getInstance().isLoadDefault()) str = RuleRepository.DEFAULTEXT; if (paramArrayOfString.length > 0) str = ""; for (int i = 0; i < paramArrayOfString.length; i++) str = str + paramArrayOfString[i] + " "; Logger localLogger = Logger.getLogger("ruleengine"); Object localObject; try { new File(SystemUtils.USER_HOME + File.separator + ".visualrules" + File.separator + "logs").mkdirs(); FileHandler localFileHandler = new FileHandler(SystemUtils.USER_HOME + File.separator + ".visualrules" + File.separator + "logs" + File.separator + "logfile%u.%g.txt", 0, 10); localFileHandler.setFormatter(new com.flagleader.server.c()); localFileHandler.setLevel(Level.ALL); Logger.getLogger("flagleader").addHandler(localFileHandler); localLogger.addHandler(localFileHandler); } catch (Exception localException1) { if (!b) { localObject = new ConsoleHandler(); ((ConsoleHandler) localObject).setFormatter(new com.flagleader.server.c()); ((ConsoleHandler) localObject).setLevel(Level.ALL); Logger.getLogger("flagleader").addHandler((Handler) localObject); localLogger.addHandler((Handler) localObject); } } if (!BuilderManager.checkLicense()) { localImage.dispose(); localShell.dispose(); return; } Property.getInstance().setEngineImplement("com.flagleader.engine.impl.SingleRuleEngineFactory"); FlagLeader localFlagLeader = new FlagLeader(); Property.getInstance().setUpdateInternateTime(0L); localFlagLeader.setBlockOnOpen(true); localFlagLeader.builderManager = new BuilderManager(localFlagLeader); if ((com.flagleader.manager.d.c.a("needLogin", false)) || (BuilderConfig.getInstance().isFirstLogin())) try { localObject = localFlagLeader.builderManager.getUserServer(); if ((localObject == null) || (((String) localObject).length() == 0) || (localFlagLeader.builderManager.getUserType() == 0) || (localFlagLeader.builderManager.getUserid() == 0)) { localImage.dispose(); localShell.dispose(); return; } } catch (Exception localException2) { MessageDialog.openError(null, "", ResourceTools.getMessage("loginserver.error") + localException2.getLocalizedMessage()); localImage.dispose(); localShell.dispose(); return; } if ((str != null) && (new File(str).exists())) localFlagLeader.builderManager.getRulesManager().a(new File(str)); localFlagLeader.initWindow(); if (new File(SystemUtils.JAVA_IO_TMPDIR, "engine.jar").exists()) new File(SystemUtils.JAVA_IO_TMPDIR, "engine.jar").delete(); if (new File(SystemUtils.JAVA_IO_TMPDIR, "export.jar").exists()) new File(SystemUtils.JAVA_IO_TMPDIR, "export.jar").delete(); if (BuilderConfig.getInstance().isAutosave()) new com.flagleader.builder.d.c(localFlagLeader.builderManager).b(); if (BuilderConfig.getInstance().isAutoCheckVersion()) new a(localFlagLeader.builderManager).b(); new e().b(); localImage.dispose(); localShell.dispose(); localFlagLeader.open(); BuilderManager localBuilderManager = localFlagLeader.builderManager; localFlagLeader.getShell().addShellListener(new d(localBuilderManager)); }
From source file:br.bireme.tb.URLS.java
public static void main(final String[] args) throws IOException { if (args.length != 1) { usage();//from w w w .j av a2 s . com } final String out = args[0].trim(); final String outDir = (out.endsWith("/")) ? out : out + "/"; final String LOG_DIR = "log"; final File logDir = new File(LOG_DIR); if (!logDir.exists()) { if (!logDir.mkdir()) { throw new IOException("log directory [" + LOG_DIR + "] creation error"); } } final Logger logger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); final FileHandler fh = new FileHandler(getLogFileName(LOG_DIR), false); logger.addHandler(fh); final String URL = URLS.ROOT_URL; final TimeString time = new TimeString(); time.start(); generateFileStructure(URL, outDir + "celulasIDB"); System.out.println("Total time: " + time.getTime()); }
From source file:primarydatamanager.PrimaryDataManager.java
public static void main(String[] args) { // setup logging try {/*ww w.j av a2 s.c o m*/ // Get the default Logger Logger mainLogger = Logger.getLogger(""); mainLogger.setLevel(Level.FINEST); Handler consoleHandler = mainLogger.getHandlers()[0]; consoleHandler.setLevel(Level.FINEST); consoleHandler.setFormatter(new VerySimpleFormatter()); // Add a file handler new File("log").mkdir(); Handler fileHandler = new FileHandler("log/datamanager.log", 50000, 2, true); fileHandler.setLevel(Level.INFO); mainLogger.addHandler(fileHandler); } catch (IOException exc) { System.out.println("Can't create log file"); exc.printStackTrace(); } // Start the update if (args.length == 0) { System.out.println("USAGE: PrimaryDataManager [-forceCompleteUpdate [channel{;channel}]] groups..."); System.exit(1); } else { try { PrimaryDataManager manager = new PrimaryDataManager(new File(".")); ArrayList<String> groupNames = new ArrayList<String>(); for (int i = 0; i < args.length; i++) { if (args[i].equalsIgnoreCase("-forceCompleteUpdate")) { if ((i + 1) >= args.length) { System.out.println("You have to specify a colon separated " + "list of channels after -forceCompleteUpdate"); System.exit(1); } else { i++; StringTokenizer tokenizer = new StringTokenizer(args[i], ":"); while (tokenizer.hasMoreTokens()) { manager.forceCompleteUpdateFor(tokenizer.nextToken()); } } } else { final String[] groups = args[i].split(","); groupNames.addAll(Arrays.asList(groups)); } } if (groupNames.size() == 0) { System.out.println("Please specify at least one channel group"); System.exit(-1); } if (!manager.doesPreparedExist()) { System.out.println( "The prepared directory is missing, this directory is very important and shouldn't " + "be deleted, because this leeds to massiv problems."); System.exit(-1); } if (!manager.createLockFile()) { System.out.println("The PrimaryDataManager is already running."); System.exit(-1); } String[] groupNamesArr = new String[groupNames.size()]; groupNames.toArray(groupNamesArr); manager.setGroupNames(groupNamesArr); manager.updateRawDataDir(); manager.deleteLockFile(); // Exit with error code 2 if some day programs were put into quarantine if (manager.mRawDataProcessor.getQuarantineCount() != 0) { System.exit(2); } } catch (PreparationException exc) { exc.printStackTrace(); System.exit(1); } } }
From source file:pl.otros.logview.gui.LogViewMainFrame.java
/** * @param args porgram CLI arguments/*from w w w . ja v a 2 s . c om*/ * @throws InitializationException * @throws InvocationTargetException * @throws InterruptedException */ public static void main(final String[] args) throws InitializationException, InterruptedException, InvocationTargetException { if (args.length > 0 && "-batch".equals(args[0])) { try { String[] batchArgs = new String[args.length - 1]; System.arraycopy(args, 1, batchArgs, 0, batchArgs.length); BatchProcessor.main(batchArgs); } catch (IOException e) { System.err.println("Error during batch processing: " + e.getMessage()); e.printStackTrace(); } catch (ConfigurationException e) { System.err.println("Error during batch processing: " + e.getMessage()); e.printStackTrace(); } return; } SingleInstanceRequestResponseDelegate singleInstanceRequestResponseDelegate = SingleInstanceRequestResponseDelegate .getInstance(); singleInstance = SingleInstance.request("OtrosLogViewer", singleInstanceRequestResponseDelegate, singleInstanceRequestResponseDelegate, args); if (singleInstance == null) { LOGGER.info("OtrosLogViewer is already running, params send using requestAction"); System.exit(0); } GuiJulHandler handler = new GuiJulHandler(); handler.setLevel(Level.ALL); Logger olvLogger = Logger.getLogger("pl.otros.logview"); olvLogger.setLevel(Level.ALL); olvLogger.addHandler(handler); LOGGER.info("Starting application"); OtrosSplash.setMessage("Starting application"); OtrosSplash.setMessage("Loading configuration"); final XMLConfiguration c = getConfiguration("config.xml"); if (!c.containsKey(ConfKeys.UUID)) { c.setProperty(ConfKeys.UUID, UUID.randomUUID().toString()); } IconsLoader.loadIcons(); OtrosSplash.setMessage("Loading icons"); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { try { OtrosSplash.setMessage("Loading L&F"); String lookAndFeel = c.getString("lookAndFeel", "com.jgoodies.looks.plastic.PlasticXPLookAndFeel"); LOGGER.config("Initializing look and feelL: " + lookAndFeel); PlasticLookAndFeel.setTabStyle(Plastic3DLookAndFeel.TAB_STYLE_METAL_VALUE); UIManager.setLookAndFeel(lookAndFeel); } catch (Throwable e1) { LOGGER.warning("Cannot initialize LookAndFeel: " + e1.getMessage()); } try { final DataConfiguration c1 = new OtrosConfiguration(c); final LogViewMainFrame mf = new LogViewMainFrame(c1); // mf.exitAction was instantiated in the constructor (previous line) // Not sure retrieving this from most appropriate Apache config // object. mf.exitAction.setConfirm(c.getBoolean("generalBehavior.confirmExit", true)); /* TODO: Implement User Preferences screen or checkbox on exit widget * that will update the same config object something like: * c.setProperty("generalBehavior.confirmExit", newValue); */ mf.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { c.setProperty("gui.state", mf.getExtendedState()); if (mf.getExtendedState() == Frame.NORMAL) { c.setProperty("gui.width", mf.getWidth()); c.setProperty("gui.height", mf.getHeight()); } } @Override public void componentMoved(ComponentEvent e) { c.setProperty("gui.location.x", mf.getLocation().x); c.setProperty("gui.location.y", mf.getLocation().y); } }); mf.addWindowListener(mf.exitAction); SingleInstanceRequestResponseDelegate.openFilesFromStartArgs(mf.otrosApplication, Arrays.asList(args), mf.otrosApplication.getAppProperties().getCurrentDir()); } catch (InitializationException e) { LOGGER.log(Level.SEVERE, "Cannot initialize main frame", e); } } }); }
From source file:NewApplication.java
/** * @param args the command line arguments *//*w w w. j a v a2 s .c o m*/ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(NewApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(NewApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(NewApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(NewApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> Logger log = Logger.getLogger("NewApplication"); try { FileInputStream fis = new FileInputStream("p.properties"); LogManager.getLogManager().readConfiguration(fis); log.setLevel(Level.FINE); log.addHandler(new java.util.logging.ConsoleHandler()); log.setUseParentHandlers(false); log.info("starting NewApplication"); fis.close(); } catch (Exception e) { } ; /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new NewApplication().setVisible(true); } }); }