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:io.jenkins.blueocean.blueocean_git_pipeline.GitCloneReadSaveRequest.java

GitClient cloneRepo() throws InterruptedException, IOException {
    EnvVars environment = new EnvVars();
    TaskListener taskListener = new LogTaskListener(Logger.getAnonymousLogger(), Level.ALL);
    String gitExe = gitTool.getGitExe();
    GitClient git = Git.with(taskListener, environment).in(repositoryPath).using(gitExe).getClient();

    git.addCredentials(gitSource.getRemote(), getCredential());

    try {//from   w w w.ja va2 s. co m
        git.clone(gitSource.getRemote(), "origin", true, null);

        log.fine("Repository " + gitSource.getRemote() + " cloned to: " + repositoryPath.getCanonicalPath());
    } catch (GitException e) {
        // check if this is an empty repository
        boolean isEmptyRepo = false;
        try {
            if (git.getRemoteReferences(gitSource.getRemote(), null, true, false).isEmpty()) {
                isEmptyRepo = true;
            }
        } catch (GitException ge) {
            // *sigh* @ this necessary hack; {@link org.jenkinsci.plugins.gitclient.CliGitAPIImpl#getRemoteReferences}
            if ("unexpected ls-remote output ".equals(ge.getMessage())) { // blank line, command succeeded
                isEmptyRepo = true;
            }
            // ignore other reasons
        }

        if (isEmptyRepo) {
            git.init();
            git.addRemoteUrl("origin", gitSource.getRemote());

            log.fine("Repository " + gitSource.getRemote() + " not found, created new to: "
                    + repositoryPath.getCanonicalPath());
        } else {
            throw e;
        }
    }

    return git;
}

From source file:at.bitfire.davdroid.App.java

public void reinitLogger() {
    // don't use Android default logging, we have our own handlers
    log.setUseParentHandlers(false);/*from  w w w  .ja  va2  s  . c  o m*/

    @Cleanup
    ServiceDB.OpenHelper dbHelper = new ServiceDB.OpenHelper(this);
    Settings settings = new Settings(dbHelper.getReadableDatabase());

    boolean logToFile = settings.getBoolean(LOG_TO_EXTERNAL_STORAGE, false),
            logVerbose = logToFile || Log.isLoggable(log.getName(), Log.DEBUG);

    // set logging level according to preferences
    log.setLevel(logVerbose ? Level.ALL : Level.INFO);

    // remove all handlers
    for (Handler handler : log.getHandlers())
        log.removeHandler(handler);

    // add logcat handler
    log.addHandler(LogcatHandler.INSTANCE);

    NotificationManagerCompat nm = NotificationManagerCompat.from(this);
    // log to external file according to preferences
    if (logToFile) {
        NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
        builder.setSmallIcon(R.drawable.ic_sd_storage_light).setLargeIcon(getLauncherBitmap(this))
                .setContentTitle(getString(R.string.logging_davdroid_file_logging)).setLocalOnly(true);

        File dir = getExternalFilesDir(null);
        if (dir != null)
            try {
                String fileName = new File(dir, "davdroid-" + android.os.Process.myPid() + "-"
                        + DateFormatUtils.format(System.currentTimeMillis(), "yyyyMMdd-HHmmss") + ".txt")
                                .toString();
                log.info("Logging to " + fileName);

                FileHandler fileHandler = new FileHandler(fileName);
                fileHandler.setFormatter(PlainTextFormatter.DEFAULT);
                log.addHandler(fileHandler);
                builder.setContentText(dir.getPath())
                        .setSubText(getString(R.string.logging_to_external_storage_warning))
                        .setCategory(NotificationCompat.CATEGORY_STATUS)
                        .setPriority(NotificationCompat.PRIORITY_HIGH)
                        .setStyle(new NotificationCompat.BigTextStyle()
                                .bigText(getString(R.string.logging_to_external_storage, dir.getPath())))
                        .setOngoing(true);

            } catch (IOException e) {
                log.log(Level.SEVERE, "Couldn't create external log file", e);

                builder.setContentText(getString(R.string.logging_couldnt_create_file, e.getLocalizedMessage()))
                        .setCategory(NotificationCompat.CATEGORY_ERROR);
            }
        else
            builder.setContentText(getString(R.string.logging_no_external_storage));

        nm.notify(Constants.NOTIFICATION_EXTERNAL_FILE_LOGGING, builder.build());
    } else
        nm.cancel(Constants.NOTIFICATION_EXTERNAL_FILE_LOGGING);
}

From source file:node.Mailbox.java

/**
 * set up the mailbox/*from  w  w  w  .j  av  a2  s .co  m*/
 * 
 * @param _msgsSend
 * @param _evolveMsgsRecv
 * @param _ctrlMsgsRecv
 * @param reportSend2
 */
public Mailbox(int _port, NodeList _nodeList, BlockingQueue<ControlMessage> _ctrlMsgsRecv,
        BlockingQueue<EvolveMessage> _evolveMsgsRecv, BlockingQueue<MessageWrapper<AbstractMessage>> _msgsSend,
        BlockingQueue<JSONObject> _reportSend) {
    // for now, hard-code REPORT to false
    REPORT = false;
    ctrlMsgsRecv = _ctrlMsgsRecv;
    evolveMsgsRecv = _evolveMsgsRecv;
    msgsSend = _msgsSend;
    reportSend = _reportSend;
    port = _port;
    nodeList = _nodeList;
    shutdown = false;
    try {
        log.setUseParentHandlers(false);
        Handler fh = new FileHandler("mailbox.log");
        fh.setFormatter(new TextFormatter());
        log.addHandler(fh);
        log.setLevel(Level.ALL);
    } catch (SecurityException e) {
        e.printStackTrace();
        log.severe(ExceptionUtils.getStackTrace(e));
    } catch (IOException e) {
        e.printStackTrace();
        log.severe(ExceptionUtils.getStackTrace(e));
    }
    Control.logOneTime("Mailbox started up");
}

From source file:nl.cyso.vcloud.client.vCloudClient.java

public void login(String uri, String username, String password) {
    VcloudClient.setLogLevel(Level.ALL);
    this.vcc = new VcloudClient(uri, Version.V1_5);
    try {/*from   w w w  . j a  v  a 2s  .  c  om*/
        this.vcc.registerScheme("https", 443, FakeSSLSocketFactory.getInstance());
    } catch (Exception e) {
        Formatter.printErrorLine("Unexpected error");
        Formatter.printStackTrace(e);
        System.exit(1);
    }

    HashMap<String, ReferenceType> organizationsMap = null;
    try {
        this.vcc.login(username, password);
        organizationsMap = this.vcc.getOrgRefsByName();
    } catch (VCloudException ve) {
        Formatter.printErrorLine("An error occurred while logging in:\n");
        Formatter.printErrorLine(ve.getLocalizedMessage());
        System.exit(1);
    }

    if (organizationsMap.isEmpty()) {
        Formatter.printErrorLine("Invalid login for user " + username);
        System.exit(1);
    }
}

From source file:fyp.project.uploadFile.UploadFile.java

public int upLoad2Server(String sourceFileUri) {
    String upLoadServerUri = "http://vbacdu.ddns.net:8080/WBS/newjsp.jsp";
    // String [] string = sourceFileUri;
    String fileName = sourceFileUri;
    int serverResponseCode = 0;

    HttpURLConnection conn = null;
    DataOutputStream dos = null;//from www  . ja v  a 2  s .c  o m
    DataInputStream inStream = null;
    String lineEnd = "\r\n";
    String twoHyphens = "--";
    String boundary = "*****";
    int bytesRead, bytesAvailable, bufferSize;
    byte[] buffer;
    int maxBufferSize = 1 * 1024 * 1024;
    String responseFromServer = "";

    File sourceFile = new File(sourceFileUri);
    if (!sourceFile.isFile()) {

        return 0;
    }
    try { // open a URL connection to the Servlet
        FileInputStream fileInputStream = new FileInputStream(sourceFile);
        URL url = new URL(upLoadServerUri);
        conn = (HttpURLConnection) url.openConnection(); // Open a HTTP  connection to  the URL
        conn.setDoInput(true); // Allow Inputs
        conn.setDoOutput(true); // Allow Outputs
        conn.setUseCaches(false); // Don't use a Cached Copy
        conn.setRequestMethod("POST");
        conn.setRequestProperty("Connection", "Keep-Alive");
        conn.setRequestProperty("ENCTYPE", "multipart/form-data");
        conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary);
        conn.setRequestProperty("file", fileName);
        dos = new DataOutputStream(conn.getOutputStream());

        dos.writeBytes(twoHyphens + boundary + lineEnd);
        dos.writeBytes("Content-Disposition: form-data; name=\"file\";filename=\""
                + fileName.substring(fileName.lastIndexOf("/")) + "\"" + lineEnd);

        m_log.log(Level.INFO, "Content-Disposition: form-data; name=\"file\";filename=\"{0}\"{1}",
                new Object[] { fileName.substring(fileName.lastIndexOf("/")), lineEnd });
        dos.writeBytes(lineEnd);

        bytesAvailable = fileInputStream.available(); // create a buffer of  maximum size

        bufferSize = Math.min(bytesAvailable, maxBufferSize);
        buffer = new byte[bufferSize];

        // read file and write it into form...
        bytesRead = fileInputStream.read(buffer, 0, bufferSize);

        while (bytesRead > 0) {
            dos.write(buffer, 0, bufferSize);
            bytesAvailable = fileInputStream.available();
            bufferSize = Math.min(bytesAvailable, maxBufferSize);
            bytesRead = fileInputStream.read(buffer, 0, bufferSize);
        }

        // send multipart form data necesssary after file data...
        dos.writeBytes(lineEnd);
        dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);

        // Responses from the server (code and message)
        serverResponseCode = conn.getResponseCode();
        String serverResponseMessage = conn.getResponseMessage();

        m_log.log(Level.INFO, "Upload file to server" + "HTTP Response is : {0}: {1}",
                new Object[] { serverResponseMessage, serverResponseCode });

        // close streams
        m_log.log(Level.INFO, "Upload file to server{0} File is written", fileName);
        fileInputStream.close();
        dos.flush();
        dos.close();
    } catch (MalformedURLException ex) {
        ex.printStackTrace();
        m_log.log(Level.ALL, "Upload file to server" + "error: " + ex.getMessage(), ex);
    } catch (Exception e) {
        e.printStackTrace();
    }
    //this block will give the response of upload link

    return serverResponseCode; // like 200 (Ok)

}

From source file:org.ocsoft.olivia.logger.LogStation.java

/**
 * ????./*from  w  w  w . j  ava 2s.  co m*/
 */
private LogStation() {

    //??????????
    try {
        setUpLogFile();
    } catch (IOException e) {
        e.printStackTrace();
    }

    //??
    for (Handler h : logger.getHandlers()) {
        if (h instanceof ConsoleHandler)
            logger.removeHandler(h);
    }
    //???????
    logger.setUseParentHandlers(false);
    //??
    this.ch = createConsoleLogHandler();
    logger.addHandler(ch);
    //?
    this.fh = createLogFileHandler();
    logger.addHandler(fh);
    //????????
    uch = new UncaughtExceptionHandler() {
        public void uncaughtException(Thread th, Throwable ex) {
            OliviaLogger.fatal("UNCAUGHT_EXCEPTION", "uncaught exception occured", new LogData() {
                {
                    exception(ex);
                    put("thread", th.getName());
                }
            });
        }
    };
    Thread.currentThread().setUncaughtExceptionHandler(uch);
    //?
    logger.setLevel(Level.ALL);
}

From source file:de.aeb.sqlscriptformater.SqlScriptFormater.java

/**
 * Constructor for parametric use.// www .j  a va  2  s.c o  m
 *
 * @param args String array containing the parameters in the right order.
 * @param verbose turns logging on or off.
 */
public SqlScriptFormater(String[] args, boolean verbose) {
    // for debugging
    if (verbose) {
        log.setLevel(Level.ALL);
    } else {
        log.setLevel(Level.OFF);
    }
    _parametersSet = extractArgs(args);
}

From source file:com.ebixio.virtmus.stats.StatsLogger.java

private StatsLogger() {
    try {//from w  ww .j  av  a2s . com

        statsLog.setUseParentHandlers(false);
        statsLog.setLevel(Level.ALL);

        Logger uiLogger = Logger.getLogger("org.netbeans.ui");
        // org.netbeans.ui.focus = maybe too much info

        uiLogger.setUseParentHandlers(false);
        uiLogger.setLevel(Level.ALL);

        logSet = pref.get(Options.OptLogSet, "A");
        if (!changeHandler(makeLogHandler(logSet))) {
            Log.log("Stats logging init failed.");
            statsLog.setLevel(Level.OFF);
            uiLogger.setLevel(Level.OFF);
        }

    } catch (SecurityException ex) {
        Log.log(ex);
    }
}

From source file:name.richardson.james.bukkit.utilities.persistence.database.AbstractDatabaseLoader.java

@Override
public final void load() {
    logger.log(Level.FINE, "Loading database.");
    final Level level = java.util.logging.Logger.getLogger("").getLevel();
    java.util.logging.Logger.getLogger("").setLevel(Level.OFF);
    ClassLoader currentClassLoader = null;
    try {/*  w  w w. j a  va  2s  . c  o  m*/
        this.serverConfig.setClasses(this.classes);
        if (logger.isLoggable(Level.ALL)) {
            this.serverConfig.setLoggingToJavaLogger(true);
            this.serverConfig.setLoggingLevel(LogLevel.SQL);
        }
        // suppress normal ebean warnings and notifications
        currentClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(this.classLoader);
        this.ebeanserver = EbeanServerFactory.create(this.serverConfig);
    } finally {
        // re-enable logging
        java.util.logging.Logger.getLogger("").setLevel(level);
        if (currentClassLoader != null) {
            Thread.currentThread().setContextClassLoader(currentClassLoader);
        }
    }
}

From source file:com.speed.ob.Obfuscator.java

private static Level parseLevel(String lvl) {
    if (lvl.equalsIgnoreCase("info")) {
        return Level.INFO;
    } else if (lvl.equalsIgnoreCase("warning")) {
        return Level.WARNING;
    } else if (lvl.equalsIgnoreCase("fine")) {
        return Level.FINE;
    } else if (lvl.equalsIgnoreCase("finer")) {
        return Level.FINER;
    } else if (lvl.equalsIgnoreCase("finest")) {
        return Level.FINEST;
    } else if (lvl.equalsIgnoreCase("all")) {
        return Level.ALL;
    } else if (lvl.equalsIgnoreCase("severe")) {
        return Level.SEVERE;
    } else if (lvl.equalsIgnoreCase("config")) {
        return Level.CONFIG;
    }/*from   w w  w .j av  a 2s .  c  om*/
    return Level.INFO;
}