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:com.coprtools.core.CopyrightToolsEngine.java

/**
 * Enables the logging capabilities. Creates a log file in the roots path.
 *
 * @param rootPath//ww  w .j  a  v  a  2 s .c o  m
 *            - the projects's root directory
 * @throws SecurityException
 * @throws IOException
 */
private void enableLogging(String rootPath) throws SecurityException, IOException {
    LOGGER.setLevel(Level.ALL);
    String logFilePath = rootPath + File.separator + InserterConstants.LOG_FILENAME;
    this.fileHandler = new FileHandler(logFilePath);
    fileHandler.setFormatter(new SimpleFormatter());
    fileHandler.setLevel(Level.ALL);
    LOGGER.addHandler(fileHandler);
}

From source file:org.deviceconnect.android.localoauth.LocalOAuth2Main.java

/**
 * .//ww w  .j a  v a2  s.com
 */
public LocalOAuth2Main(final android.content.Context context, final String dbName) {
    // 
    Logger logger = sLogger;
    if (BuildConfig.DEBUG) {
        AndroidHandler handler = new AndroidHandler(logger.getName());
        handler.setFormatter(new SimpleFormatter());
        handler.setLevel(Level.ALL);
        logger.addHandler(handler);
        logger.setLevel(Level.ALL);
    } else {
        logger.setLevel(Level.OFF);
    }

    mContext = context;

    // DB??
    mDbHelper = new LocalOAuthOpenHelper(context, dbName);
    mDb = mDbHelper.getWritableDatabase();

    // ??
    mUserManager = new SampleUserManager();
    mClientManager = new SQLiteClientManager(mDb);
    mTokenManager = new SQLiteTokenManager(mDb);

    // 
    addUserData(SampleUser.LOCALOAUTH_USER, SampleUser.LOCALOAUTH_PASS);

    register(context);
}

From source file:com.sds.acube.ndisc.mts.xserver.XNDiscServer.java

/**
 *    /*  w  w  w  .  java  2s  .  c  om*/
 * 
 * @throws Exception
 *              ?
 */
private void init() throws Exception {

    /* xsocket  - FINE ???     ?  ? ?  ? */
    if (XSOCKET_DEBUG) {
        xsocket_log.setLevel(Level.ALL);
    } else {
        xsocket_log.setLevel(Level.INFO);
    }
    ConsoleHandler console = new ConsoleHandler();
    if (XSOCKET_DEBUG) {
        console.setLevel(Level.ALL);
    } else {
        console.setLevel(Level.INFO);
    }
    xsocket_log.addHandler(console);
    /* xsocket  - FINE ???     ?  ? ?  ? */

    initLogger();

    initFilter();

    initStorage();

    InetAddress ia = InetAddress.getByName(HOST);
    if (ia == null) {
        ia = InetAddress.getLocalHost();
    }

    /*  ?   ( ) - Receive Buffer Size  ? */
    Map<String, Object> options = new HashMap<String, Object>();

    // - 2014.04.29 - ?   - START - Multiplexing?   .
    // options.put(IConnection.SO_REUSEADDR, true);
    // options.put(IConnection.SO_LINGER, "5"); // ?  ??     (? ? ?  )
    // options.put(IConnection.SO_KEEPALIVE, true);
    // options.put(IConnection.TCP_NODELAY, true);
    // options.put(IConnection.SO_RCVBUF, XNDiscConfig.INIT_BUFFER_SIZE);
    // options.put(IConnection.SO_SNDBUF, XNDiscConfig.INIT_BUFFER_SIZE);
    // - 2014.04.29 - ?   - END - Multiplexing?   .

    /* SERVER? ?  ?  */

    /*  workerpool (?? ?  ? )?    ?. */
    /* ? ? workerpool? ? ?    workerpool ? ?. ? 100. */
    System.setProperty(XNDiscUtils.XSOCKET_WORKER_POOL_MIN_SIZE, SIZE_WORKER_POOL);
    /*  workerpool?    ?. ? 4 */
    System.setProperty(XNDiscUtils.XSOCKET_WORKER_POOL_MIN_SIZE, MIN_SIZE_WORKER_POOL);
    /* ? ? (NIO Selectors)? . ? 2 ?  ?. */
    System.setProperty(XNDiscUtils.XSOKET_DISPATCHER_INIT_COUNT, DISPATCHER_INIT_COUNT);
    /*  ?? ? ??   */
    /*  , ??  ?? ?. ? ??  . */
    System.setProperty(XNDiscUtils.XSOCKET_DISPATCHER_MAX_HANDLE, DISPATCHER_MAX_HANDLES);
    /* ?  ? ?    ?? ?? ? . ? false. */
    System.setProperty(XNDiscUtils.XSOCKET_SERVER_READ_BUFFER_USEDIRECT, READ_BUFFER_USEDIRECT);

    // - 2014.04.25 - ByteBuffer Direct   - START
    System.setProperty(XNDiscUtils.XSOCKET_CLIENT_READ_BUFFER_USEDIRECT, READ_BUFFER_USEDIRECT);
    System.setProperty(XNDiscUtils.XSOCKET_WRITE_BUFFER_USEDIRECT, READ_BUFFER_USEDIRECT);
    // - 2014.04.25 - ByteBuffer Direct   - END

    // - 2014.04.29 -    - START
    System.setProperty(XNDiscUtils.XSOCKET_SUPPRESS_SYNC_FLUSH_WARNING, "true");
    System.setProperty(XNDiscUtils.XSOCKET_SUPPRESS_REUSE_BUFFER_WARNING, "true"); // or FlushMode.SYNC (GET ? )
    System.setProperty(XNDiscUtils.XSOCKET_SUPPRESS_SYNC_FLUSH_COMPLETION_HANDLER_WARNING, "true");
    System.setProperty(XNDiscUtils.XSOCKET_DISPATCHER_BYPASSING_WRITE_ALLOWED, "true");
    // - 2014.04.29 -    - END

    /* (NIO SelectionKey)?  ? true ? ?? detach?. ?? ???  .  false. */
    System.setProperty(XNDiscUtils.XSOCKET_DISPATCHER_DETACH_HANDLE_ON_NO_OPS, DETACH_HANDLE_NO_OPERATION);
    /* ? ??  ? ??   ? ?   (1024 * 16) */
    Integer mapped_bytebuffer_maxsize = 1024
            * XNDiscConfig.getInt(XNDiscConfig.TRANSFER_MAPPED_BYTE_BUFFER_MAXSIZE, 16);
    System.setProperty(XNDiscUtils.XSOCKET_TRANFER_MAPPED_BYTEBUFFER_MAX_SIZE,
            mapped_bytebuffer_maxsize.toString());

    /* ? Sever  - SSL ?   ?    Connection? ?  ?! */
    if (USE_SSL) {
        this.server = new Server(ia, PORT, options,
                new MultiplexedProtocolAdapter(new XNDiscHandler(storage, logger)),
                XNDiscSSLContextFactory.getSSLContext(), true);
        // this.server = new Server(ia, PORT, options, new XNDiscHandler(storage, logger), XNDiscSSLContextFactory.getSSLContext(), true);
    } else {
        this.server = new Server(ia, PORT, options,
                new MultiplexedProtocolAdapter(new XNDiscHandler(storage, logger)), null, false);
        // this.server = new Server(ia, PORT, options, new XNDiscHandler(storage, logger), null, false);
    }

    /*  ThreadPool? ? , Cached ?   ? ??? ?  ? ?  ?. */
    /* SERVER? ?  ? (? Fixed) */
    /*   ?  :  ? ?  ?? Runtime.availableProcessors() ? ? ?? ???   */
    /* newFixedThreadPool ?  ?  ? corePoolSize, maximumPoolSize  .  ?  */
    /* newCachedThreadPool ?  corePoolSize = 0, maximumPoolSize  Integer.MAX_VALUE  .  ? 1 */

    if (WORKER_POOL_TYPE.equals("C")) {
        this.server.setWorkerpool(Executors.newCachedThreadPool(new XNDiscThreadFactory(true)));
    } else {
        if (XNDiscConfig.getBoolean(XNDiscConfig.MULTIPLICATION_THREAD_AVAILABLE_PROCESSORS)) {
            WORKER_THREAD_POOL = Runtime.getRuntime().availableProcessors() * WORKER_THREAD_POOL;
        }
        this.server
                .setWorkerpool(Executors.newFixedThreadPool(WORKER_THREAD_POOL, new XNDiscThreadFactory(true)));
    }
    this.server.setFlushmode(FlushMode.ASYNC);
}

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

/**
 * Logs the given text to the search logger of the given connection.
 * //from   w w w . ja v a2 s  .c  o m
 * @param text the text to log
 * @param type the type, either SEARCH REQUEST or SEARCH RESULT
 * @param ex the naming exception if an error occurred, null otherwise
 * @param connection the connection
 */
private void log(String text, String type, NamingException ex, Connection connection) {
    String id = connection.getId();
    if (!loggers.containsKey(id)) {
        if (connection.getName() != null) {
            initSearchLogger(connection);
        }
    }

    if (loggers.containsKey(id)) {
        Logger logger = loggers.get(id);
        DateFormat df = new SimpleDateFormat(ConnectionCoreConstants.DATEFORMAT);
        df.setTimeZone(ConnectionCoreConstants.UTC_TIME_ZONE);

        if (ex != null) {
            logger.log(Level.ALL, LdifCommentLine.create("#!" + type + " ERROR") //$NON-NLS-1$//$NON-NLS-2$
                    .toFormattedString(LdifFormatParameters.DEFAULT));
        } else {
            logger.log(Level.ALL, LdifCommentLine.create("#!" + type + " OK") //$NON-NLS-1$//$NON-NLS-2$
                    .toFormattedString(LdifFormatParameters.DEFAULT));
        }

        logger.log(Level.ALL,
                LdifCommentLine
                        .create("#!CONNECTION ldap://" + connection.getHost() + ":" + connection.getPort()) //$NON-NLS-1$//$NON-NLS-2$
                        .toFormattedString(LdifFormatParameters.DEFAULT));
        logger.log(Level.ALL, LdifCommentLine.create("#!DATE " + df.format(new Date())) //$NON-NLS-1$
                .toFormattedString(LdifFormatParameters.DEFAULT));

        if (ex != null) {
            String errorComment = "#!ERROR " + ex.getMessage(); //$NON-NLS-1$
            errorComment = errorComment.replaceAll("\r", " "); //$NON-NLS-1$ //$NON-NLS-2$
            errorComment = errorComment.replaceAll("\n", " "); //$NON-NLS-1$ //$NON-NLS-2$
            LdifCommentLine errorCommentLine = LdifCommentLine.create(errorComment);
            logger.log(Level.ALL, errorCommentLine.toFormattedString(LdifFormatParameters.DEFAULT));
        }

        logger.log(Level.ALL, text);
    }
}

From source file:gtu.youtube.JavaYoutubeDownloader.java

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

    String videoId = null;/*from ww w. jav a  2 s. com*/
    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];

        // 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:ryerson.daspub.Main.java

/**
 * Execute commands.//www.ja  v  a2 s  .  c o  m
 */
@Override
public void run() {
    // show help message
    if (cmd.hasOption(CMD_HELP)) {
        showHelpMessage();
        System.exit(SUCCESS);
    }
    // load configuration
    if (cmd.hasOption(CMD_CONFIG)) {
        try {
            String path = cmd.getOptionValue(CMD_CONFIG);
            configFile = new File(path);
            config = Config.load(configFile);
        } catch (Exception ex) {
            String stack = ExceptionUtils.getStackTrace(ex);
            logger.log(Level.SEVERE, "Could not parse configuration file\n\n{0}", stack);
            System.exit(FAIL);
        }
    }
    // show gui or process command line options
    if (cmd.hasOption(CMD_GUI)) {
        ApplicationJFrame frame = ApplicationJFrame.getInstance();
        // send logging output to jtextarea
        JTextArea textArea = frame.getLogOutputTextArea();
        JTextAreaOutputHandler handler = new JTextAreaOutputHandler(textArea);
        handler.setFormatter(new JTextAreaOutputFormatter());
        handler.setLevel(Level.ALL);
        Logger rootlogger = LogManager.getLogManager().getLogger("");
        rootlogger.addHandler(handler);
        // load project if specified at command line
        if (configFile != null) {
            try {
                frame.openProject(configFile);
            } catch (Exception ex) {
                String stack = ExceptionUtils.getStackTrace(ex);
                logger.log(Level.SEVERE, "Could not load configuration file {0}\n\n{1}",
                        new Object[] { configFile.getAbsolutePath(), stack });
            }
        }
        // display the application frame
        frame.setVisible(true);
        logger.log(Level.INFO, "Ready");
    } else if (cmd.hasOption(CMD_INIT)) {
        executeInit();
    } else if (cmd.hasOption(CMD_PUBLISH)) {
        executePublish();
    }
}

From source file:org.jretty.log.Jdk14Logger.java

@Override
public void log(String callerFQCN, org.jretty.log.Level level, Throwable t, Object message,
        Object... msgParams) {/*from   w ww.  j  a  v  a  2  s.com*/
    Level julLevel;
    if (level == null) {
        julLevel = getLevel();
    } else if (level.equals(org.jretty.log.Level.FATAL) || level.equals(org.jretty.log.Level.ERROR)) {
        julLevel = Level.SEVERE;
    } else if (level.equals(org.jretty.log.Level.WARN)) {
        julLevel = Level.WARNING;
    } else if (level.equals(org.jretty.log.Level.INFO)) {
        julLevel = Level.INFO;
    } else if (level.equals(org.jretty.log.Level.DEBUG)) {
        julLevel = Level.FINE;
    } else if (level.equals(org.jretty.log.Level.TRACE)) {
        julLevel = Level.FINEST;
    } else if (level.equals(org.jretty.log.Level.ALL)) {
        julLevel = Level.ALL;
    } else if (level.equals(org.jretty.log.Level.OFF)) {
        julLevel = Level.OFF;
    } else {
        throw new IllegalStateException("Level " + level + " is not recognized.");
    }
    if (log.isLoggable(julLevel)) {
        log(callerFQCN, julLevel, LogUtils.replace(message.toString(), msgParams), t);
    }
}

From source file:ca.sfu.federation.viewer.propertysheet.ParametricModelPropertySheetPanel.java

private void jtfDescriptionActionListener(java.awt.event.ActionEvent evt) {
    String command = evt.getActionCommand();
    logger.log(Level.ALL, "ComponentSheet jtfDescriptionActionListener fired {0}", command);
    try {//from ww  w  .java 2  s.c om
        BeanProxy proxy = new BeanProxy(this.target);
        proxy.set("description", evt.getActionCommand());
    } catch (Exception ex) {
        String stack = ExceptionUtils.getFullStackTrace(ex);
        logger.log(Level.WARNING, "{0}", stack);
    }

}

From source file:edu.harvard.iq.dvn.core.index.IndexServiceBean.java

@Timeout
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void handleTimeout(javax.ejb.Timer timer) {
    System.out.println("in handleTimeout, timer = " + timer.getInfo());

    try {/* www . j ava  2  s. com*/
        // read-only mode check:
        boolean readOnly = vdcNetworkService.defaultTransactionReadOnly();

        if (timer.getInfo().equals(INDEX_TIMER)) {
            if (readOnly) {
                logger.log(Level.ALL, "Network is in read-only mode; skipping scheduled index job.");
            } else {
                logger.log(Level.INFO, "Index update");
                indexBatch();
            }
        } else if (timer.getInfo().equals(INDEX_NOTIFICATION_TIMER)) {
            if (readOnly) {
                logger.log(Level.ALL, "Network is in read-only mode; skipping scheduled index notification.");
            } else {
                logger.log(Level.INFO, "Index notify");
                indexProblemNotify();
            }
        } else if (timer.getInfo().equals(COLLECTION_INDEX_TIMER)) {
            if (readOnly) {
                logger.log(Level.ALL,
                        "Network is in read-only mode; skipping scheduled collection reindexing.");
            } else {
                logger.log(Level.INFO, "Collection ReIndex");
                updateStudiesInCollections();
            }
        }
    } catch (Throwable e) {
        mailService.sendIndexUpdateErrorNotification(vdcNetworkService.find().getSystemEmail(),
                vdcNetworkService.find().getName());
        e.printStackTrace();
    }
}

From source file:com.esri.geoevent.datastore.GeoEventDataStoreProxy.java

public GeoEventDataStoreProxy() {
    try (InputStream is = GeoEventDataStoreProxy.class.getResourceAsStream("/arcgisservers.properties")) {
        Properties props = new Properties();
        props.load(is);//from   w w w  .  j ava 2 s  .  c  o  m
        StringReader csvServers = new StringReader(props.getProperty("servers", ""));
        Iterable<CSVRecord> records = CSVFormat.DEFAULT.parse(csvServers);
        ServerInfo currInfo;
        String currServerName = "<not initialized>";
        String username, password;
        int port;
        Iterator<CSVRecord> iterator = records.iterator();
        if (iterator.hasNext()) {
            CSVRecord record = iterator.next();
            int size = record.size();
            for (int i = 0; i < size; i++) {
                try {
                    currInfo = new ServerInfo();
                    currServerName = record.get(i);
                    currInfo.url = new URL(props.getProperty(currServerName + ".url", ""));
                    port = (currInfo.url.getPort() == -1) ? getDefaultPortForScheme(currInfo.url.getProtocol())
                            : currInfo.url.getPort();
                    currInfo.authscope = new AuthScope(currInfo.url.getHost(), port);
                    username = props.getProperty(currServerName + ".username", "");
                    password = props.getProperty(currServerName + ".password", "");
                    if (!StringUtils.isEmpty(username)) {
                        username = username.replace('\\', '/');
                        String encryptedPassword = Crypto.doEncrypt(password);
                        currInfo.credentials = new UsernameEncryptedPasswordCredentials(username,
                                encryptedPassword);
                        currInfo.ntCredentials = new NTCredentialsEncryptedPassword(
                                username + ":" + encryptedPassword);
                    }
                    currInfo.httpContext = createContextForServer(currInfo);
                    String tokenUrlKey = currServerName + ".tokenUrl";
                    String tokenUrl = props.getProperty(tokenUrlKey);
                    if (tokenUrl != null) {
                        currInfo.tokenUrl = new URL(tokenUrl);
                    }

                    username = props.getProperty(currServerName + ".gisTierUsername", "");
                    if (!StringUtils.isEmpty(username)) {
                        password = props.getProperty(currServerName + ".gisTierPassword", "");
                        currInfo.gisTierUsername = username;
                        currInfo.gisTierEncryptedPassword = Crypto.doEncrypt(password);
                    }
                    currInfo.name = currServerName;
                    serverInfos.put(currServerName, currInfo);
                } catch (Throwable t) {
                    LOG.log(Level.ALL, "Failed to parse properties for server " + currServerName, t);
                }
            }
        }
    } catch (Throwable t) {
        LOG.log(Level.SEVERE, "Unable to initialize.  Will not be able to proxy any requests.", t);
    }

}