Example usage for java.util.logging Level SEVERE

List of usage examples for java.util.logging Level SEVERE

Introduction

In this page you can find the example usage for java.util.logging Level SEVERE.

Prototype

Level SEVERE

To view the source code for java.util.logging Level SEVERE.

Click Source Link

Document

SEVERE is a message level indicating a serious failure.

Usage

From source file:com.siva.filewritterprogram.Mp3FileWritterTool.java

public static void main(String[] args) {
    File directory = new File("D:\\Siva\\Entertainment\\EvergreenHits");

    FileFilter filter = new FileFilter() {
        @Override//from   w w  w  .  j  av a 2  s. c o m
        public boolean accept(File file) {
            if (file.getName().endsWith(".mp3")) {
                return true;
            } else {
                return false;
            }
        }
    };
    File[] subdirs = directory.listFiles();
    for (File subDir : subdirs) {
        try {
            System.out.println("Going to read files under : " + subDir);
            if (subDir.isDirectory()) {
                File[] files = subDir.listFiles(filter);
                if (files != null) {
                    for (File file : files) {
                        FileUtils.copyFileToDirectory(file, new File(directory.getPath() + "\\toTransfer"));
                    }
                } else {
                    System.out.println("There are no songs inside. [" + subDir.getName() + "]");
                }
            } else {
                System.out.println("Not a directory. [" + subDir.getName() + "]");
            }
        } catch (IOException ex) {
            Logger.getLogger(Mp3FileWritterTool.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

From source file:birch.util.EncryptionKeyFileUtil.java

public static void main(String[] args) {
    try {/*  w ww.j  a va  2 s .c o m*/

        String cipher = "AES";
        int keysize = 128;

        if (args.length > 0) {
            cipher = args[0];
        }
        if (args.length > 1) {
            keysize = Integer.parseInt(args[1]);
        }

        System.out.println("Cipher algorithm " + cipher + " used to create a " + keysize + "bit key:");
        System.out.println(createKey(cipher, keysize));

    } catch (Throwable ex) {
        Logger.getLogger(EncryptionKeyFileUtil.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.sourcethought.simpledaemon.EchoTask.java

public static void main(String[] args) throws Exception {
    // setup command line options
    Options options = new Options();
    options.addOption("h", "help", false, "print this help screen");

    // read command line options
    CommandLineParser parser = new PosixParser();
    try {/*  ww w  .j a  va  2  s  .com*/
        CommandLine cmdline = parser.parse(options, args);

        if (cmdline.hasOption("help") || cmdline.hasOption("h")) {
            System.out.println("SimpleDaemon Version " + Main.version);

            HelpFormatter formatter = new HelpFormatter();
            formatter.printHelp(
                    "java -cp lib/*:target/SimpleDaemon-1.0-SNAPSHOT.jar com.sourcethought.simpledaemon.Main",
                    options);
            return;
        }

        final SimpleDaemon daemon = new SimpleDaemon();
        daemon.start();

        Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
            @Override
            public void run() {
                if (daemon.isRunning()) {
                    try {
                        System.out.println("Shutting down daemon...");
                        daemon.stop();
                    } catch (Exception ex) {
                        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            }
        }));

    } catch (ParseException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:com.liferay.mobile.sdk.SDKBuilder.java

public static void main(String[] args) throws IOException {
    SDKBuilder builder = new SDKBuilder();

    Map<String, String> arguments = builder.parseArguments(args);

    String[] platforms = arguments.get("platforms").split(",");
    String url = arguments.get("url");
    String[] contexts = arguments.get("contexts").split(",");
    String packageName = arguments.get("packageName");
    String filter = arguments.get("filter");
    int portalVersion = Integer.valueOf(arguments.get("portalVersion"));
    String destination = arguments.get("destination");

    try {//from w w w . jav  a  2 s.  com
        builder.build(platforms, url, contexts, packageName, filter, portalVersion, destination);
    } catch (Exception e) {
        _log.log(Level.SEVERE, e.getMessage(), e);
    }
}

From source file:inc.cygnus.app.MainSpring.java

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                // Implementasi Konfigurasi Spring framework
                @SuppressWarnings("resource")
                ApplicationContext appContext = new ClassPathXmlApplicationContext("applicationContext.xml");

                // Initialize service
                setCustomerService((CustomerService) appContext.getBean("customerService"));
                setProductService((ProductService) appContext.getBean("productService"));
                setPurchaseService((PurchaseService) appContext.getBean("purchaseService"));

                try {
                    // After finish service initialize
                    // Show Form Menu Master
                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                } catch (ClassNotFoundException ex) {
                    Logger.getLogger(MainSpring.class.getName()).log(Level.SEVERE, null, ex);
                } catch (InstantiationException ex) {
                    Logger.getLogger(MainSpring.class.getName()).log(Level.SEVERE, null, ex);
                } catch (IllegalAccessException ex) {
                    Logger.getLogger(MainSpring.class.getName()).log(Level.SEVERE, null, ex);
                } catch (UnsupportedLookAndFeelException ex) {
                    Logger.getLogger(MainSpring.class.getName()).log(Level.SEVERE, null, ex);
                }/*www.  j  a  v  a 2  s  . c o m*/
                Menu mmv = new Menu();

                mmv.setVisible(true);

            } catch (BeansException e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:lince.LinceApp.java

/**
 * @param args the command line arguments
 *///  w  w  w  .j  a  va2s. c o  m
public static void main(final String[] args) {
    String vlcPath = StringUtils.EMPTY;
    try {
        if (RuntimeUtil.isWindows()) {
            vlcPath = WindowsRuntimeUtil.getVlcInstallDir();
            /*if (StringUtils.isEmpty(vlcPath)){
                vlcPath= "C:\\Program Files (x86)\\VideoLAN";
            }*/
            System.setProperty("jna.library.path", vlcPath);
            setI18n();
        }
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                LinceFrame.getInstance();
            }
        });
    } catch (Exception e) {
        logger.log(Level.SEVERE, "Error inicializando main. vlcPath@" + vlcPath, e);
    }
}

From source file:net.kungfoo.grizzly.proxy.impl.Activator.java

public static void main(String[] args) throws IOReactorException {
    setup();/*from   www . j  a  va2s . c  om*/
    try {
        startSelector();
        startReactor();
        selectorThread.join();
    } catch (Exception e) {
        ProxyAdapter.logger.log(Level.SEVERE, "Exception in Selector: ", e);
    } finally {
        stopSelector();
    }
}

From source file:br.com.itfox.utils.SendHtmlFormatedEmail.java

public static void main(String[] args) {
    try {/* w w  w.j  a  va 2s  .c  om*/
        //new SendHtmlFormatedEmail().sendingHtml();
        String assunto = "";
        Mensagem msg = new Mensagem();
        // localizando a mensagem
        //msg = new BusinessDelegate().getMensagem(new BigDecimal(61));
        //assunto = msg.getAssunto();
        new SendHtmlFormatedEmail().sendingHtml(" ", " 87680087", "Pablo Pereira", "belchiorpalma@gmail.com");
    } catch (Exception ex) {
        Logger.getLogger(SendHtmlFormatedEmail.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:at.tuwien.aic.Main.java

/**
 * Main entry point//from ww w  .  j  a v a2 s.com
 *
 * @param args
 */
@SuppressWarnings("empty-statement")
public static void main(String[] args) throws IOException, InterruptedException {

    try {
        System.out.println(new java.io.File(".").getCanonicalPath());
    } catch (IOException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    }

    TweetCrawler tc = null;

    try {
        tc = TweetCrawler.getInstance();
    } catch (UnknownHostException ex) {
        logger.severe("Could not connect to mongoDb");
        exitWithError(2);
        return;
    }

    int action;

    while (true) {
        action = getDecision("The following actions can be executed",
                new String[] { "Subscribe to topic", "Query topic", "Test preprocessing",
                        "Recreate the evaluation model", "Quit the application" },
                "What action do you want to execute?");

        switch (action) {
        case 1:
            tc.collectTweets(new DefaultTweetHandler() {
                @Override
                public boolean isMatch(String topic) {
                    return true;
                }
            }, getNonEmptyString(
                    "Which topic do you want to subscribe to (use spaces to specify more than one keyword)?")
                            .split(" "));

            System.out.println("Starting to collection tweets");
            System.out.println("Press enter to quit collecting");

            while (System.in.read() != 10)
                ;

            tc.stopCollecting();

            break;
        case 2:
            classifyTopic();
            break;
        case 3: {
            int subAction = getDecision("The following preprocessing steps are available",
                    new String[] { "Stop word removal", "Stemming", "Both" }, "What do you want to test?");

            switch (subAction) {
            case 1:
                stopWords();
                break;
            case 2:
                stem();
                break;
            case 3:
                stem(stopWords());
            default:
                break;
            }

            break;
        }
        case 4: {
            ClassifyTweet.saveModel("resources/traindata.arff", "resources/classifier.model");
            break;
        }
        case 5:
            exit();
        case 6: {
            ClassifyTweet.saveModel("resources/traindata.arff", "resources/classifier.model");
            Classifier c = ClassifyTweet.loadModel("resources/classifier.model");
            ClassifyTweet.classifyTweetArff(c, "resources/unlabeled.arff");
            //ClassifyTweet.evaluate(c, "resources/traindata.arff");
            break;
        }
        }
    }
}

From source file:com.curso.ejemplotareaplanificada.Principal.java

/**
 * @param args the command line arguments
 *//* w  w w. j av a  2  s.  c  om*/
public static void main(String[] args) {
    //solo estamos usando anotaciones
    //en esta clase no hay nada de los metodos planificados porque esos ya los llama spring solito
    //esta clase es para pegarnos con los servicios asincronos
    ApplicationContext ctx = new AnnotationConfigApplicationContext(Configuracion.class);
    System.out.println("Contexto cargado");
    ServicioAsincrono sa = ctx.getBean(ServicioAsincrono.class);
    System.out.println("Hilo principal " + Thread.currentThread());

    //Este metodo devuelve void asi que el hilo arranca un nuevo hilo pero continua sin esperar ni ahora ni a un futuro
    sa.metodoUno();

    //Este metodo devuelve un futuro, y cuando llamemos a get espera 5 segundos a ver si termina el nuevo hilo
    //Si sobre pasa esos 5 segundos lanza una excepcion
    Future<Double> numero = sa.factorial(100);
    try {
        System.out.println("El factorial es desde un Future:" + numero.get(5L, TimeUnit.SECONDS));
    } catch (InterruptedException | ExecutionException | TimeoutException ex) {
        Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
    }

    //Este metodo devuelve un escuchable
    ListenableFuture<Double> valor = sa.factorialLf(100);
    //Al metodo escuchable le aadimos una clase anonima de tipo llamable con dos metodos, uno que se ejecutara cuando acabe con exito
    //y otro si no acaba correctamente
    valor.addCallback(new ListenableFutureCallback<Double>() {

        @Override
        public void onSuccess(Double result) {
            System.out.println("El resultado es desde un ListenableFuture: " + result);
        }

        @Override
        public void onFailure(Throwable ex) {
            LOG.log(Level.SEVERE, "Ha ocurrido un error:", ex);
        }
    });
}