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:org.apache.geode.management.internal.cli.shell.GfshConfig.java

private static Level getLogLevel(final String logLevelString) {
    try {/*  w  ww.ja v  a 2 s  .  c om*/
        String logLevelAsString = StringUtils.isBlank(logLevelString) ? "" : logLevelString.trim(); // trim
                                                                                                    // spaces
                                                                                                    // if
                                                                                                    // any
                                                                                                    // To support level NONE, used by GemFire
        if ("NONE".equalsIgnoreCase(logLevelAsString)) {
            logLevelAsString = Level.OFF.getName();
        }
        // To support level ERROR, used by GemFire, fall to WARNING
        if ("ERROR".equalsIgnoreCase(logLevelAsString)) {
            logLevelAsString = Level.WARNING.getName();
        }
        return Level.parse(logLevelAsString.toUpperCase());
    } catch (IllegalArgumentException e) {
        System.out.println(e.getMessage());
        return DEFAULT_LOGLEVEL;
    }
}

From source file:org.deviceconnect.android.manager.DConnectMessageService.java

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

    if (BuildConfig.DEBUG) {
        AndroidHandler handler = new AndroidHandler("dconnect.manager");
        handler.setFormatter(new SimpleFormatter());
        handler.setLevel(Level.ALL);
        mLogger.addHandler(handler);//from  w  w  w .  j  a va 2 s.  c o m
        mLogger.setLevel(Level.ALL);
    } else {
        mLogger.setLevel(Level.OFF);
    }

    // ???
    EventManager.INSTANCE.setController(new MemoryCacheController());

    // Local OAuth??
    LocalOAuth2Main.initialize(getApplicationContext());

    // DConnect
    mSettings = DConnectSettings.getInstance();
    mSettings.load(this);

    // ?
    mFileMgr = new FileManager(this);

    // ???Local OAuth
    mLocalOAuth = new DConnectLocalOAuth(this);

    // ????
    mPluginMgr = new DevicePluginManager(this, mDConnectDomain);
    mPluginMgr.setEventListener(this);

    // ?
    addProfile(new AuthorizationProfile());
    addProfile(new DConnectAvailabilityProfile());
    addProfile(new DConnectServiceDiscoveryProfile(this, mPluginMgr));
    addProfile(new DConnectFilesProfile(this));
    addProfile(new DConnectSystemProfile(this, mPluginMgr));

    // dConnect Manager????????????
    setDeliveryProfile(new DConnectDeliveryProfile(mPluginMgr, mLocalOAuth, mSettings.requireOrigin()));
}

From source file:com.krminc.phr.security.PHRRealm.java

public void init(Properties props) throws BadRealmException, NoSuchRealmException {

    super.init(props);

    /*//  w  ww .j av a2s.c om
     * Set the jaas context, otherwise server doesn't indentify the login module.
     * jaas-context is the property specified in domain.xml and
     * is the name corresponding to LoginModule
     * config/login.conf
     */
    String jaasCtx = props.getProperty(AppservRealm.JAAS_CONTEXT_PARAM);
    this.setProperty(AppservRealm.JAAS_CONTEXT_PARAM, jaasCtx);

    /*
     * Get any other interested properties from configuration file - domain.xml
     * 
     */
    String authTypeProp = props.getProperty(AUTH_TYPE_PARAM);
    this.authType = (authTypeProp != null) ? authTypeProp : AUTH_TYPE;

    String failedAttemptsProp = props.getProperty(FAILED_ATTEMPTS_PARAM);
    this.failedAttempts = Integer.valueOf((failedAttemptsProp != null) ? failedAttemptsProp : FAILED_ATTEMPTS);

    String lockedRoleProp = props.getProperty(LOCKED_ROLE_PARAM);
    this.lockedRole = (lockedRoleProp != null) ? lockedRoleProp : LOCKED_ROLE;

    String resetRoleProp = props.getProperty(RESET_ROLE_PARAM);
    this.resetRole = (resetRoleProp != null) ? resetRoleProp : RESET_ROLE;

    String jdbcResourceProp = props.getProperty(JDBC_RESOURCE_PARAM);
    this.jdbcResource = (jdbcResourceProp != null) ? jdbcResourceProp : JDBC_RESOURCE;

    String logLevelParam = props.getProperty(LOG_LEVEL_PARAM);
    logLevelParam = (logLevelParam != null) ? logLevelParam : LOG_LEVEL;
    if (logLevelParam.equalsIgnoreCase("INFO")) {
        this.logLevel = Level.INFO;
    } else if (logLevelParam.equalsIgnoreCase("SEVERE")) {
        this.logLevel = Level.SEVERE;
    } else if (logLevelParam.equalsIgnoreCase("WARNING")) {
        this.logLevel = Level.WARNING;
    } else if (logLevelParam.equalsIgnoreCase("OFF")) {
        this.logLevel = Level.OFF;
    } else if (logLevelParam.equalsIgnoreCase("FINEST")) {
        this.logLevel = Level.FINEST;
    }

    log("Initialized PHR Custom Realm");
}

From source file:org.rivalry.core.datacollector.DefaultDataCollector.java

/**
 * @return a new web driver./*from   w w  w  .  j  a v  a 2 s.c  o  m*/
 */
WebDriver createWebDriver() {
    final WebDriver answer = new HtmlUnitDriver();

    final java.util.logging.Logger logger = java.util.logging.Logger.getLogger("");
    logger.setLevel(Level.OFF);

    if (answer instanceof HtmlUnitDriver) {
        ((HtmlUnitDriver) answer).setJavascriptEnabled(_isJavascriptEnabled);
    }

    return answer;
}

From source file:org.rivalry.example.illyriad.IllyriadDataCollector.java

/**
 * @return a new web driver.//from   ww  w .ja v a2  s.co  m
 */
private WebDriver createWebDriver() {
    final WebDriver answer = new HtmlUnitDriver();

    final Logger logger = Logger.getLogger("");
    logger.setLevel(Level.OFF);

    if (answer instanceof HtmlUnitDriver) {
        ((HtmlUnitDriver) answer).setJavascriptEnabled(true);
    }

    return answer;
}

From source file:net.atos.aeon.AEONSDK.java

public AEONSDK(String publishUrl) {
    this.messages = new AEONSDKMessages();

    if (publishUrl.indexOf("/publish") != -1) {

        if (publishUrl.startsWith("https"))

            this.webClient = ClientHelper.createClient();

        else/*w w  w  . j  a  va2 s .  c o  m*/
            this.webClient = Client.create();

        this.publishUrl = publishUrl;

        this.mode = "publish";
        sioLogger.setLevel(Level.OFF);

    } else
        this.mode = "error";
}

From source file:org.geoserver.wms.map.RenderedImageMapOutputFormatTest.java

@Before
public void setRasterMapProducer() throws Exception {
    Logging.getLogger("org.geotools.rendering").setLevel(Level.OFF);
    this.rasterMapProducer = getProducerInstance();

    getTestData().addDefaultRasterLayer(SystemTestData.MULTIBAND, getCatalog());
}

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

/**
 * ./*  w  w  w.  ja  v a  2s . c o  m*/
 */
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:io.github.lal872k.monotifier.MyBackPack.java

public static boolean hasValidCredentials(User user, Engine engine) throws IOException {
    System.out.println("Checking validity of " + user.getName() + "'s credentials for MyBackPack...");

    final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_45);

    LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",
            "org.apache.commons.logging.impl.NoOpLog");

    java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(Level.OFF);
    java.util.logging.Logger.getLogger("org.apache.commons.httpclient").setLevel(Level.OFF);

    //webClient.setCssEnabled(false);
    // http://stackoverflow.com/questions/3600557/turning-htmlunit-warnings-off

    webClient.setIncorrectnessListener(new IncorrectnessListener() {

        @Override/*w ww. j  av a  2  s  . c  o  m*/
        public void notify(String arg0, Object arg1) {
            // TODO Auto-generated method stub

        }
    });
    webClient.setCssErrorHandler(new ErrorHandler() {

        @Override
        public void warning(CSSParseException exception) throws CSSException {
            // TODO Auto-generated method stub

        }

        @Override
        public void fatalError(CSSParseException exception) throws CSSException {
            // TODO Auto-generated method stub

        }

        @Override
        public void error(CSSParseException exception) throws CSSException {
            // TODO Auto-generated method stub

        }
    });
    webClient.setJavaScriptErrorListener(new JavaScriptErrorListener() {

        @Override
        public void scriptException(InteractivePage ip, ScriptException se) {
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

        @Override
        public void timeoutError(InteractivePage ip, long l, long l1) {
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

        @Override
        public void malformedScriptURL(InteractivePage ip, String string, MalformedURLException murle) {
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

        @Override
        public void loadScriptError(InteractivePage ip, URL url, Exception excptn) {
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
    });
    webClient.setHTMLParserListener(new HTMLParserListener() {

        @Override
        public void error(String string, URL url, String string1, int i, int i1, String string2) {
            //
        }

        @Override
        public void warning(String string, URL url, String string1, int i, int i1, String string2) {
            //
        }
    });

    //webClient.setThrowExceptionOnFailingStatusCode(false);
    //webClient.setThrowExceptionOnScriptError(false);

    //http://stackoverflow.com/questions/19551043/process-ajax-request-in-htmlunit/26268815#26268815
    webClient.getOptions().setJavaScriptEnabled(true);
    webClient.getOptions().setThrowExceptionOnScriptError(false);
    webClient.getOptions().setCssEnabled(false);
    webClient.setAjaxController(new NicelyResynchronizingAjaxController());

    // get the page
    HtmlPage page = webClient.getPage(
            "https://peddie.seniormbp.com/SeniorApps/studentParent/attendSummary.faces?selectedMenuId=true");

    // get login form
    final HtmlForm login_form = page.getFormByName("form");

    final HtmlTextInput username = login_form.getInputByName("form:userId");
    final HtmlPasswordInput password = login_form.getInputByName("form:userPassword");

    final HtmlButtonInput login_submit = login_form.getInputByName("form:signIn");

    username.setValueAttribute(user.getMyBackPackUsername());
    password.setValueAttribute(user.getDecryptedMyBackPackPassword());

    URL oldURL = page.getUrl();

    // Now submit the form by clicking the button and get back the new page.
    page = login_submit.click();

    engine.getHistory()
            .addAction(new Action("Accessed MyBackPack",
                    "Accessed the MyBackPack of " + user.getName() + " (" + user.getID() + ")("
                            + user.getEmail() + ") to check the validity of the account credentials."));

    if (oldURL.equals(page.getUrl())) {
        return false;
    }

    return true;
}

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) {// w w  w . j  a va  2  s .c om
    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);
    }
}