Example usage for java.util.logging Level ALL

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

Introduction

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

Prototype

Level ALL

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

Click Source Link

Document

ALL indicates that all messages should be logged.

Usage

From source file:at.ac.tuwien.ifs.lupu.LangDetFilterFactory.java

@Override
public TokenStream create(TokenStream input) {
    @SuppressWarnings("deprecation")
    final TokenStream filter;

    LOG.log(Level.ALL, "languages in create:{0}", languages.size());

    try {//from  ww w  .ja  v a  2  s .c  om
        filter = new LangDetFilter(input, detector, windowWidth);
        return filter;
    } catch (LangDetectException ex) {
        LOG.log(Level.SEVERE, "Exception in LangDetFilterFactory.create", ex);
    }

    return null;
}

From source file:org.jevis.sftpdatasource.sFTPDataSource.java

@Override
public List<InputStream> sendSampleRequest(JEVisObject channel) {

    List<InputStream> answerList = new ArrayList<InputStream>();
    try {//from w w  w.  ja  v a 2 s .  c  om
        String hostname = _serverURL;
        String login = _userName;
        String password = _password;

        java.util.Properties config = new java.util.Properties();
        config.put("StrictHostKeyChecking", "no");

        JSch ssh = new JSch();
        _session = ssh.getSession(login, hostname, _port);
        _session.setConfig(config);
        _session.setPassword(password);
        _session.connect();
        _channel = (ChannelSftp) _session.openChannel("sftp");
        _channel.connect();
    } catch (JSchException ex) {
        org.apache.log4j.Logger.getLogger(this.getClass().getName()).log(org.apache.log4j.Level.ERROR,
                "No connection possible");
        org.apache.log4j.Logger.getLogger(sFTPDataSource.class).setLevel(org.apache.log4j.Level.ALL);
        org.apache.log4j.Logger.getLogger(sFTPDataSource.class)
                .setLevel(JEVisCommandLine.getInstance().getDebugLevel());
        //            throw new FetchingException(_id, FetchingExceptionType.CONNECTION_ERROR);
        _channel.disconnect();
        _session.disconnect();
    }

    try {
        JEVisClass channelClass = channel.getJEVisClass();
        JEVisType pathType = channelClass.getType(DataCollectorTypes.Channel.sFTPChannel.PATH);
        String filePath = DatabaseHelper.getObjectAsString(channel, pathType);
        JEVisType readoutType = channelClass.getType(DataCollectorTypes.Channel.FTPChannel.LAST_READOUT);
        DateTime lastReadout = DatabaseHelper.getObjectAsDate(channel, readoutType,
                DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss"));

        //        ChannelSftp sftp = (ChannelSftp) _channel;
        org.apache.log4j.Logger.getLogger(this.getClass().getName()).log(org.apache.log4j.Level.ALL,
                "SendSampleRequest");
        List<String> fileNames = DataSourceHelper.getSFTPMatchedFileNames(_channel, lastReadout, filePath);
        //        String currentFilePath = Paths.get(filePath).getParent().toString();
        for (String fileName : fileNames) {
            org.apache.log4j.Logger.getLogger(this.getClass().getName()).log(org.apache.log4j.Level.ALL,
                    "FileInputName: " + fileName);

            //                ByteArrayOutputStream out = new ByteArrayOutputStream();
            //                String query = Paths.get(fileName);
            InputStream get = _channel.get(fileName);
            ByteArrayOutputStream baos = new ByteArrayOutputStream();

            byte[] buffer = new byte[1024];
            int len;
            try {
                while ((len = get.read(buffer)) > 1) {
                    baos.write(buffer, 0, len);
                }
                baos.flush();
            } catch (IOException ex) {
                java.util.logging.Logger.getLogger(sFTPDataSource.class.getName())
                        .log(java.util.logging.Level.SEVERE, null, ex);
            }

            InputStream answer = new ByteArrayInputStream(baos.toByteArray());
            //                InputHandler inputConverter = InputHandlerFactory.getInputConverter(answer);
            //                inputConverter.setFilePath(fileName);
            answerList.add(answer);

        }

        _channel.disconnect();
        _session.disconnect();
    } catch (JEVisException ex) {

    } catch (SftpException ex) {
        java.util.logging.Logger.getLogger(sFTPDataSource.class.getName()).log(Level.SEVERE, null, ex);
    }

    if (answerList.isEmpty()) {
        org.apache.log4j.Logger.getLogger(this.getClass().getName()).log(org.apache.log4j.Level.ERROR,
                "Cant get any data from the device");
    }

    return answerList;
}

From source file:org.mili.core.logging.java.JavaAdapterTest.java

@Test
public void shouldGetTraceLevelForAll() {
    log.setLevel(Level.ALL);
    assertEquals(org.mili.core.logging.Level.TRACE, logger.getLevel());
}

From source file:com.tri_voltage.md.io.YoutubeVideoParser.java

private void run(String[] args) throws Throwable {
    setupLogging(Level.WARNING, Level.WARNING);

    String videoId = "wzMrK-aGCug";
    String outdir = ".";
    int format = 18;
    String encoding = DEFAULT_ENCODING;
    String userAgent = DEFAULT_USER_AGENT;

    for (int i = 0; i < args.length; i++) {
        String arg = args[i];// ww  w  .j av  a2  s  .c om

        // Options start with either -, --
        // Do not accept Windows-style args that start with / because of abs
        // paths on linux for file names.
        if (arg.charAt(0) == '-') {

            // For easier processing, convert any double dashes to
            // single dashes
            if (arg.length() > 1 && arg.charAt(1) == '-') {
                arg = arg.substring(1);
            }

            String larg = arg.toLowerCase();

            // Process the option
            if (larg.equals("-help") || larg.equals("-?") || larg.equals("-usage") || larg.equals("-h")) {
                usage(null);
            } else if (larg.equals("-verbose")) {
                setupLogging(Level.ALL, Level.WARNING);
            } else if (larg.equals("-verboseall")) {
                setupLogging(Level.ALL, Level.ALL);
            } else if (larg.equals("-dir")) {
                outdir = args[++i];
            } else if (larg.equals("-format")) {
                format = Integer.parseInt(args[++i]);
            } else if (larg.equals("-ua")) {
                userAgent = args[++i];
            } else if (larg.equals("-enc")) {
                encoding = args[++i];
            } else {
                usage("Unknown command line option " + args[i]);
            }
        } else {
            // Non-option (i.e. does not start with -, --

            videoId = arg;

            // Break if only the first non-option should be used.
            break;
        }
    }

    if (videoId == null) {
        usage(ERROR_MISSING_VIDEO_ID);
    }

    log.fine("Starting");

    if (videoId.startsWith(YOUTUBE_WATCH_URL_PREFIX)) {
        videoId = videoId.substring(YOUTUBE_WATCH_URL_PREFIX.length());
    }
    int a = videoId.indexOf('&');
    if (a != -1) {
        videoId = videoId.substring(0, a);
    }

    File outputDir = new File(outdir);
    String extension = getExtension(format);

    play(videoId, format, encoding, userAgent, outputDir, extension);

    log.fine("Finished");
}

From source file:com.technophobia.webdriver.substeps.runner.DefaultWebDriverFactory.java

private void setLoggingPreferences(final DesiredCapabilities chromeCapabilities) {
    // TODO switch on based on properties
    final LoggingPreferences logPrefs = new LoggingPreferences();
    logPrefs.enable(LogType.BROWSER, Level.ALL);
    chromeCapabilities.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);
}

From source file:bookkeepr.BookKeepr.java

/**
 * This loads the configuration file and sets the intial settings. 
 *///from  ww  w . j av  a2s .  co m
public BookKeepr(File configFile) {

    try {
        this.configFile = configFile;
        if (!configFile.exists()) {
            config = new BookkeeprConfig();
            config.setOriginId(0);
            saveConfig();
        }
        config = (BookkeeprConfig) XMLReader.read(new FileInputStream(configFile));
        if (config.getOriginId() < 0 || config.getOriginId() > 255) {
            config.setOriginId(0);

        }
        if (config.getOriginId() == 0) {
            Logger.getLogger(BookKeepr.class.getName()).log(Level.INFO,
                    "Client mode active, creation or modification disabled");
        }

        statusMon = new BookKeeprStatusMonitor();
        Logger logger = Logger.getLogger("bookkeepr");
        logger.setLevel(Level.ALL);
        logger.setUseParentHandlers(false);
        logger.addHandler(statusMon);
    } catch (SAXException ex) {
        Logger.getLogger(BookKeepr.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(BookKeepr.class.getName()).log(Level.SEVERE, null, ex);
    }
    for (int i = 0; i < 20; i++) {
        HttpClient httpclient = new DefaultHttpClient();
        HttpClientParams.setRedirecting(httpclient.getParams(), false);
        HttpConnectionParams.setConnectionTimeout(httpclient.getParams(), 10000);
        if (config.getProxyUrl() != null) {
            final HttpHost proxy = new HttpHost(config.getProxyUrl(), config.getProxyPort(), "http");
            httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
        }
        httpClients.add(httpclient);
    }

}

From source file:com.illumina.basespace.DefaultApiClient.java

/**
 * Create a BaseSpace session//from   ww w  .jav a 2 s .  co  m
 * 
 * @param config
 *            the configuration to use to establish the session
 */
DefaultApiClient(final ClientConnectionProvider connectionProvider) {
    this.connectionProvider = connectionProvider;
    logger.setLevel(Level.ALL);
}

From source file:org.lilyproject.lilyservertestfw.launcher.LilyLauncher.java

@Override
public int run(CommandLine cmd) throws Exception {
    int result = super.run(cmd);
    if (result != 0) {
        return result;
    }/*  w  ww  .  ja va  2 s . com*/

    // Forward JDK logging to SLF4J
    LogManager.getLogManager().reset();
    LogManager.getLogManager().getLogger("").addHandler(new SLF4JBridgeHandler());
    LogManager.getLogManager().getLogger("").setLevel(Level.ALL);

    boolean prepareMode = cmd.hasOption(prepareOption.getOpt());

    //
    // Figure out what to start
    //
    enableHadoop = cmd.hasOption(enableHadoopOption.getOpt());
    enableSolr = cmd.hasOption(enableSolrOption.getOpt());
    enableLily = cmd.hasOption(enableLilyOption.getOpt());
    enableHbaseIndexer = cmd.hasOption(enableHbaseIndexerOption.getOpt());

    // When running prepare mode, or if none of the services are explicitly enabled,
    // we default to starting them all. Otherwise we only start those that are enabled.
    if (!enableHadoop && !enableSolr && !enableLily && !enableHbaseIndexer) {
        enableHadoop = true;
        enableSolr = true;
        enableLily = true;
        enableHbaseIndexer = true;
    }

    if (prepareMode) {
        // (in prepare mode: always start everything)
        System.out.println("-------------------------------------------------------------");
        System.out.println("Running in prepare mode (ignoring --hadoop, --lily, --solr).");
        System.out.println("Will start up, stop, and then snapshot the data directory.");
        System.out.println("Please be patient.");
        System.out.println("-------------------------------------------------------------");

        // If there would be an old template dir, drop it
        TemplateDir.deleteTemplateDir();
    }

    if (enableHadoop) {
        enabledServices.add(hadoopService);
    }
    if (enableSolr) {
        enabledServices.add(solrService);
    }
    if (enableLily) {
        enabledServices.add(lilyService);
    }
    if (enableHbaseIndexer) {
        enabledServices.add(hbaseIndexerLauncherService);
    }

    //
    // Determine directory below which all services will store their data
    //
    if (!prepareMode && cmd.hasOption(dataDirOption.getOpt())) {
        String dataDir = cmd.getOptionValue(dataDirOption.getOpt());
        testHome = new File(dataDir);
        if (testHome.exists() && !testHome.isDirectory()) {
            System.err.println("Specified data directory exists and is not a directory:");
            System.err.println(testHome.getAbsolutePath());
            return -1;
        } else if (testHome.exists() && testHome.isDirectory() && testHome.list().length > 0) {
            System.out.println("Specified data directory exists: will re-use data from previous run!");
        } else if (!testHome.exists()) {
            FileUtils.forceMkdir(testHome);
        }
        // If the user specified the storage directory, do not delete it
        clearData = false;
    } else {
        testHome = TestHomeUtil.createTestHome("lily-launcher-");
        if (!prepareMode) {
            TemplateDir.restoreTemplateDir(testHome);
        }
    }

    //
    // Start the services
    //

    // Informational messages to be outputted after startup has completed.
    List<String> postStartupInfo = new ArrayList<String>();

    for (LauncherService service : enabledServices) {
        if ((result = service.setup(cmd, testHome, clearData)) != 0) {
            return result;
        }
    }

    for (LauncherService service : enabledServices) {
        if ((result = service.start(postStartupInfo)) != 0) {
            return result;
        }
    }

    if (prepareMode) {
        System.out.println("----------------------------------------------------------");
        System.out.println("Prepare mode: stopping all services");
        System.out.println("----------------------------------------------------------");
        lilyService.stop();
        solrService.stop();
        hadoopService.stop();

        System.out.println("----------------------------------------------------------");
        System.out.println("Prepare mode: creating template data directory");
        TemplateDir.makeTemplateDir(testHome);
        System.out.println("----------------------------------------------------------");
        System.out.println("Done");

        System.exit(0);
    }

    // Register MBean
    ManagementFactory.getPlatformMBeanServer().registerMBean(this,
            new ObjectName("LilyLauncher:name=Launcher"));

    // Add shutdown hook
    Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownHook()));

    //
    // Finished startup, print messages
    //
    for (String msg : postStartupInfo) {
        System.out.println(msg);
    }

    // redirect all jdk logging (e.g. from Restlet) to log4j (done after startup of all services, to make sure
    // all loggers registered during startup of some services are also redirected)
    JavaLoggingToLog4jRedirector.activate();

    return 0;
}

From source file:org.apache.directory.studio.connection.core.io.jndi.LdifSearchLogger.java

/**
 * Inits the search logger./*from www  . ja  v a  2s .  c  o  m*/
 */
private void initSearchLogger(Connection connection) {
    Logger logger = Logger.getAnonymousLogger();
    loggers.put(connection.getId(), logger);
    logger.setLevel(Level.ALL);

    String logfileName = ConnectionManager.getSearchLogFileName(connection);
    try {
        FileHandler fileHandler = new FileHandler(logfileName, getFileSizeInKb() * 1000, getFileCount(), true);
        fileHandlers.put(connection.getId(), fileHandler);
        fileHandler.setFormatter(new Formatter() {
            public String format(LogRecord record) {
                return record.getMessage();
            }
        });
        logger.addHandler(fileHandler);
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:de.ailis.jasdoc.Main.java

/**
 * Initializes logging./*  w  w w  . j  a va  2  s. c  o  m*/
 */
private void initLogging() {
    final Logger logger = Logger.getLogger("de.ailis.jasdoc");
    logger.setUseParentHandlers(false);
    final Handler handler = new LogHandler();
    handler.setFilter(null);
    handler.setFormatter(new LogFormatter(this.debug));
    if (this.debug)
        handler.setLevel(Level.ALL);
    else if (this.quiet)
        handler.setLevel(Level.WARNING);
    else
        handler.setLevel(Level.INFO);
    logger.setFilter(null);
    logger.addHandler(handler);
    Logger.getLogger("").setLevel(handler.getLevel());
}