Example usage for java.util.logging Level OFF

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

Introduction

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

Prototype

Level OFF

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

Click Source Link

Document

OFF is a special level that can be used to turn off logging.

Usage

From source file:net.community.chest.gitcloud.facade.ServletUtils.java

public static final Log wrapServletContext(final ServletContext context, final Level thresholdLevel) {
    if ((context == null) || (thresholdLevel == null)) {
        throw new IllegalArgumentException("Incomplete wrapper specification");
    }//from   w w w.j a  v  a 2s .c  o  m

    return new AbstractJULWrapper() {
        @Override
        public void log(Level level, Object message, Throwable t) {
            if (isEnabled(level)) {
                if (t == null) {
                    context.log(level.getName() + ": " + message);
                } else {
                    context.log(level.getName() + ": " + message, t);
                }
            }
        }

        @Override
        public boolean isEnabled(Level level) {
            if (Level.OFF.equals(thresholdLevel)) {
                return false;
            }

            if (Level.ALL.equals(thresholdLevel)) {
                return true;
            }

            if (level.intValue() >= thresholdLevel.intValue()) {
                return true;
            } else {
                return false; // debug breakpoint
            }
        }
    };
}

From source file:org.geotoolkit.util.logging.CommonsLogger.java

/**
 * Returns the level for this logger./*from w  w  w .ja  v  a2 s  .c o  m*/
 */
@Override
public Level getLevel() {
    if (logger.isTraceEnabled())
        return Level.FINEST;
    if (logger.isDebugEnabled())
        return Level.FINE;
    if (logger.isInfoEnabled())
        return Level.CONFIG;
    if (logger.isWarnEnabled())
        return Level.WARNING;
    if (logger.isErrorEnabled())
        return Level.SEVERE;
    if (logger.isFatalEnabled())
        return Level.SEVERE;
    return Level.OFF;
}

From source file:org.deviceconnect.android.deviceplugin.theta.ThetaDeviceApplication.java

@Override
public void onCreate() {
    super.onCreate();

    if (BuildConfig.DEBUG) {
        for (Logger logger : mLoggers) {
            AndroidHandler handler = new AndroidHandler(logger.getName());
            handler.setFormatter(new SimpleFormatter());
            handler.setLevel(Level.ALL);
            logger.addHandler(handler);//  w w w  .j  a  va 2 s. co  m
            logger.setLevel(Level.ALL);
        }
    } else {
        for (Logger logger : mLoggers) {
            logger.setLevel(Level.OFF);
        }
    }

    Context context = getApplicationContext();
    mDeviceMgr = new ThetaDeviceManager(context);
    mHeadTracker = new HeadTrackerWrapper(new DefaultHeadTracker(context));
    mSphericalViewApi = new SphericalViewApi(context);
}

From source file:com.adr.taskexecutor.ui.TaskExecutorRemote.java

/** Creates new form TaskExecutorRemote */
public TaskExecutorRemote() {
    initComponents();/*  w w w  .j  a  va 2  s . co m*/

    jLoggingLevel.addItem(Level.SEVERE);
    jLoggingLevel.addItem(Level.WARNING);
    jLoggingLevel.addItem(Level.INFO);
    jLoggingLevel.addItem(Level.CONFIG);
    jLoggingLevel.addItem(Level.FINE);
    jLoggingLevel.addItem(Level.FINER);
    jLoggingLevel.addItem(Level.FINEST);
    jLoggingLevel.addItem(Level.OFF);
    jLoggingLevel.addItem(Level.ALL);

    jURL.setText(Configuration.getInstance().getPreference("remote.serverurl",
            "http://localhost/taskexecutoree/executetask"));
    jLoggingLevel.setSelectedItem(Level
            .parse(Configuration.getInstance().getPreference("remote.logginglevel", Level.INFO.toString())));
    jTrace.setSelected(Boolean
            .parseBoolean(Configuration.getInstance().getPreference("remote.trace", Boolean.FALSE.toString())));
    jStats.setSelected(Boolean
            .parseBoolean(Configuration.getInstance().getPreference("remote.stats", Boolean.TRUE.toString())));
}

From source file:io.stallion.services.Log.java

public static Level getLogLevel() {

    if (logger == null) {
        return Level.OFF;
    } else if (logger.getLevel() == null) {

        return Level.INFO;
    } else {/*from   w w w.j a v  a  2s  . c om*/
        return logger.getLevel();
    }
}

From source file:neembuu.uploader.cmd.Main.java

private static void logging(Settings settings) {
    if (settings.logging()) {
        NULogger.getLogger().setLevel(Level.INFO);
        NULogger.getLogger().info("Logger turned on");
    } else {/*  w  w  w  .j a va 2s  .  c  o m*/
        NULogger.getLogger().info("Turning off logger");
        NULogger.getLogger().setLevel(Level.OFF);
    }
}

From source file:org.shaman.database.Benchmark.java

@Test
public void benchmark() throws IOException, ClassNotFoundException {
    //disable logger
    Logger logger = Logger.getLogger("org.shaman.database");
    Level oldLevel = logger.getLevel();
    logger.setLevel(Level.OFF);

    System.out.println("Benchmark");
    long seed = System.currentTimeMillis();
    Random rand = new Random(seed);
    //to reproduce the same results, set seed to another value
    System.out.println("seed: " + seed);

    //description
    System.out.println("This benchmark generates 9 different test record graphs,\n"
            + "3 with few but huge entities, 2 with many empty entites and 4 with a complex scene");
    System.out.println("It tests these cases:");
    System.out.println("1. The file size when saved with the databse, the default java serialization,\n"
            + "   the java serialization gzip-compressed and java-beans xml output");
    System.out.println("2. The time to save and load the scene using the database, the java serialization,\n"
            + "   the java serialization gzip-compressed and java-beans xml output");
    System.out.println(/*from w w  w.  j ava  2  s . c  om*/
            "in the last case, the output streams are buffered using BufferedInputStream / BufferedOutputStream\n"
                    + "and the database uses the default io as used when not excplizit specified");
    System.out.println();

    //generate scenes
    Record[] scenes = new Record[] { generateScene1(rand), generateScene1(rand), generateScene1(rand),
            generateScene2(rand), generateScene2(rand), generateScene3(rand), generateScene3(rand),
            generateScene3(rand), generateScene3(rand) };

    try {
        //file size
        System.out.println("file size:");
        printFileSizes(scenes);

        //save/load times
        printSaveLoadTimes(scenes);
    } finally {
        logger.setLevel(oldLevel);
    }
}

From source file:com.yfiton.notifiers.slack.SlackNotifier.java

public SlackNotifier() {
    super("13619498982.13619874391", "8c1846b68f3ca8cd67926c2d85f0f879", PromptReceiver.class,
            YfitonWebEngineListener.class);

    if (!log.isDebugEnabled() && !log.isTraceEnabled()) {
        Logger.getLogger(RestUtils.class.getName()).setLevel(Level.OFF);
    }/*w  ww. j  av  a 2  s  . com*/
}

From source file:com.testautomationguru.utility.PDFUtil.java

public PDFUtil() {
    this.bTrimWhiteSpace = true;
    this.bHighlightPdfDifference = false;
    this.imgColor = Color.MAGENTA;
    this.bCompareAllPages = false;
    this.compareMode = CompareMode.TEXT_MODE;
    logger.setLevel(Level.OFF);
    System.setProperty("sun.java2d.cmm", "sun.java2d.cmm.kcms.KcmsServiceProvider");
}

From source file:org.memento.client.Main.java

public void go(String[] args) throws ParseException, ClassCastException {
    boolean exit;
    CommandLine cmd;/* w w w.j a va  2 s .com*/
    CommandLineParser parser;

    parser = new PosixParser();

    cmd = parser.parse(this.opts, args);
    exit = false;

    if (cmd.hasOption("h") || cmd.hasOption("help")) {
        this.printHelp(0);
    }

    if (cmd.hasOption("debug")) {
        Handler console = new ConsoleHandler();
        console.setLevel(Level.FINEST);

        Main.LOGGER.addHandler(console);
        Main.LOGGER.setLevel(Level.FINEST);
    } else {
        Main.LOGGER.setLevel(Level.OFF);
    }

    if (!cmd.hasOption("p")) {
        System.out.println("No port defined!");
        this.printHelp(2);
    }

    Main.LOGGER.fine("Main - Listen port " + cmd.getOptionValue("p"));
    try (Serve serve = new Serve(Integer.parseInt(cmd.getOptionValue("p")));) {
        if (cmd.hasOption("l")) {
            Main.LOGGER.fine("Listen address " + cmd.getOptionValue("l"));
            serve.setAddress(cmd.getOptionValue("l"));
        }

        if (cmd.hasOption("S")) {
            Main.LOGGER.fine("Main - SSL enabled");
            Section section = this.getOptions("ssl", cmd.getOptionValue("S"));
            serve.setSSL(true);

            serve.setSSLkey(section.get("key"));
            if (section.containsKey("password")) {
                Main.LOGGER.fine("Main - SSL key password exists");
                serve.setSSLpass(section.get("password"));
            }
        }

        serve.open();

        while (!exit) {
            try {
                exit = serve.listen();
            } catch (SocketException ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, ex.getMessage());
            }
        }

    } catch (BindException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, ex.getMessage());
    } catch (IllegalArgumentException | SocketException | UnknownHostException | NullPointerException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    }
}