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.pz.platypus.ConfigFileTest.java

@Before
public void setUp() {
    Literals lits;/*  w w  w.  j a  v a 2s . c  om*/

    String args[] = { "" };
    PlatypusHomeDirectory homeDir = new PlatypusHomeDirectory(args);
    gdd = new GDD(homeDir.get());

    MockLiterals mockLits = new MockLiterals("Platypus.properties");
    mockLits.setGetLitShouldReturnValue(true);
    lits = mockLits;
    gdd.setupGdd(lits);
    gdd.log.setLevel(Level.OFF);

    // create a mock config file

    final String configFilename = "./config.mock";
    try {
        BufferedWriter out = new BufferedWriter(new FileWriter(configFilename));
        // create minimal entries for pdf and html plugin
        out.write("pi.out.pdf=pdf.mock\n");
        out.write("pi.out.html=html.mock\n");
        out.close();
    } catch (IOException e) {
    }

    ConfigFile cf = new ConfigFile(new ConfigLocator(configFilename), gdd);
    gdd.configFile = cf;

    // now create a file that can appear to be the plugin

    try {
        new File("./plugin").mkdir();
        new File("./plugin/pdf.mock").createNewFile();
        new File("./plugin/html.mock").createNewFile();
    } catch (IOException e) {
        fail("***ERROR OCCURRED IN ConfigFileTest.java***");
    }
}

From source file:org.pz.platypus.commandline.FormatSelectionTest.java

@Before
public void setUp() {
    Literals lits;//from w  w  w. ja v a2s  .  c o m

    String args[] = { "" };
    PlatypusHomeDirectory homeDir = new PlatypusHomeDirectory(args);
    gdd = new GDD(homeDir.get());

    MockLiterals mockLits = new MockLiterals("Platypus.properties");
    mockLits.setGetLitShouldReturnValue(true);
    lits = mockLits;
    gdd.setupGdd(lits);
    gdd.log.setLevel(Level.OFF);
}

From source file:com.wenzani.maven.mongodb.StopMongoDb.java

public void execute() throws MojoExecutionException {
    port = null == port ? "27017" : port;

    try {//from  ww w.  jav  a 2  s  .c  o m
        Logger.getLogger("com.mongodb").setLevel(Level.OFF);
        getLog().info("Shutting down mongodb...");
        Mongo mongo = new Mongo("127.0.0.1", Integer.valueOf(port));
        mongo.getDB("admin").command(new BasicDBObject("shutdown", 1));
        getLog().info("MongoDB shutdown. Ignore the EOFException...");
    } catch (UnknownHostException e) {
        getLog().error(ExceptionUtils.getFullStackTrace(e));
    } catch (Throwable ex) {
        //ignore
    }
}

From source file:org.owasp.proxy.http.dao.JdbcMessageDAOTest.java

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    Logger dslogger = Logger.getLogger(DriverManagerDataSource.class.getName());
    dslogger.setLevel(Level.OFF);
    dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName("org.h2.Driver");
    dataSource.setUrl("jdbc:h2:mem:webscarab3;DB_CLOSE_DELAY=-1");
    dataSource.setUsername("sa");
    dataSource.setPassword("");
    dao = new JdbcMessageDAO();
    dao.setDataSource(dataSource);/*www .j  av a  2  s .  com*/
}

From source file:org.nuxeo.ecm.platform.reporting.engine.BirtEngine.java

public static synchronized IReportEngine getBirtEngine() {
    if (birtEngine == null) {
        EngineConfig config = new EngineConfig();
        if (configProps != null) {
            String logLevel = configProps.getProperty("logLevel");
            Level level = Level.OFF;
            if ("SEVERE".equalsIgnoreCase(logLevel)) {
                level = Level.SEVERE;
            } else if ("WARNING".equalsIgnoreCase(logLevel)) {
                level = Level.WARNING;
            } else if ("INFO".equalsIgnoreCase(logLevel)) {
                level = Level.INFO;
            } else if ("CONFIG".equalsIgnoreCase(logLevel)) {
                level = Level.CONFIG;
            } else if ("FINE".equalsIgnoreCase(logLevel)) {
                level = Level.FINE;
            } else if ("FINER".equalsIgnoreCase(logLevel)) {
                level = Level.FINER;
            } else if ("FINEST".equalsIgnoreCase(logLevel)) {
                level = Level.FINEST;
            } else if ("OFF".equalsIgnoreCase(logLevel)) {
                level = Level.OFF;
            }/*from  w  w w .  j  a  v a2 s . c o m*/

            config.setLogConfig(configProps.getProperty("logDirectory"), level);
        }

        config.setEngineHome("");

        try {
            Platform.startup(config);
        } catch (BirtException e) {
            log.error("Cannot startup birt", e);
        }

        IReportEngineFactory factory = (IReportEngineFactory) Platform
                .createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
        birtEngine = factory.createReportEngine(config);

        DesignConfig dconfig = new DesignConfig();
        IDesignEngineFactory df = (IDesignEngineFactory) Platform
                .createFactoryObject(IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY);
        birtDesignEngine = df.createDesignEngine(dconfig);
    }
    return birtEngine;
}

From source file:io.github.lal872k.monotifier.MyBackPack.java

public static MO[] loadMOs(User user, Engine engine) throws IOException {
    System.out.println("Retrieving MO's for user " + user.getID() + " (" + user.getName() + ").");
    // make web client
    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//from  ww w.  ja  v 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();

    if (oldURL.equals(page.getUrl())) {
        System.err
                .println("Password or username was invalid for " + user.getName() + "(" + user.getID() + ").");
        return new MO[0];
    }

    // click on details

    final HtmlForm switchView_form = page.getFormByName("j_id_jsp_1447653194_2");

    final HtmlSubmitInput switchView_submit = switchView_form
            .getInputByName("j_id_jsp_1447653194_2:j_id_jsp_1447653194_12");

    page = switchView_submit.click();

    // now on right page

    ArrayList<MO> mos = new ArrayList();

    // find all rows
    List<DomElement> odds = (List<DomElement>) page
            .getByXPath("//tr[@class='dataCellOdd' or @class='dataCellEven']");

    String date = "";
    String section = "";
    boolean passedSection = false;

    for (DomElement el : odds) {
        for (DomElement ele : el.getChildElements()) {
            // date is only on with rowspan
            if (ele.hasAttribute("rowspan")) {
                date = ele.getTextContent();
            }
            // section and type contain that attr
            if (ele.getAttribute("class").equals("attendTypeColumnData2")) {
                // section comes first
                if (!passedSection) {
                    section = ele.getTextContent();
                    passedSection = true;
                } else {
                    mos.add(new MO(section, date, ele.getTextContent()));
                    passedSection = false;
                }
            }
        }
    }

    engine.getHistory().addAction(new Action("Accessed MyBackPack", "Accessed the MyBackPack of "
            + user.getName() + " (" + user.getID() + ")(" + user.getEmail() + ") to update the mo count."));

    return mos.toArray(new MO[0]);

}

From source file:RouterControl.Switch.java

private void startPage(String ip, String U, String P) throws IOException {
    String username = en.decrypt(U);
    String password = en.decrypt(P);
    System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
    java.util.logging.Logger.getLogger("com.gargoylesoftware").setLevel(Level.OFF);
    page = webClient.getPage("http://" + ip + "/Advanced_DSL_Content.asp");
    JavaScriptEngine engine = new JavaScriptEngine(webClient);
    webClient.setJavaScriptEngine(engine);

    textField1 = page.getHtmlElementById("login_username");
    textField1.setValueAttribute(username);
    textField = page.getElementByName("login_passwd");
    textField.setValueAttribute(password);

    JSCode = "login()";
    result = page.executeJavaScript(JSCode);
    Object jsResult = result.getJavaScriptResult();
    page = (HtmlPage) result.getNewPage();
    page = webClient.getPage("http://" + ip + "/Advanced_DSL_Content.asp"); //Redirect, as the program as been authed                 
    /*//from  w w w  .  j av  a  2 s . c  o  m
    If error is given about illegal JS injection, please recheck the link above. needs to match http://"+ ip +"/Advanced_DSL_Content.asp
    */
    result = page.executeJavaScript(JSPVC); //Always switch to PVC first, all it will be deleted on the change
    result.getNewPage();
    result.getJavaScriptResult();
}

From source file:javancss.ParseDebugTest.java

@Override
protected Javancss measureTestFile(int testFileId) {
    Logger logger = Logger.getLogger("javancss");
    logger.setLevel(Level.FINEST);

    PrintStream stdout = System.out;
    PrintStream stderr = System.err;

    try {//w ww  .  ja  va2s.c om
        System.setOut(new PrintStream(new NullOutputStream()));
        System.setErr(new PrintStream(new NullOutputStream()));

        return super.measureTestFile(testFileId);
    } finally {
        logger.setLevel(Level.OFF);
        System.setOut(stdout);
        System.setErr(stderr);
    }
}

From source file:com.andrew.apollo.ApolloApplication.java

/**
 * {@inheritDoc}//from w  w w .  j a v a  2  s  . co m
 */
@Override
public void onCreate() {
    // Enable strict mode logging
    enableStrictMode();
    // Turn off logging for jaudiotagger.
    Logger.getLogger("org.jaudiotagger").setLevel(Level.OFF);

    //ad by qy
    MobclickAgent.setDebugMode(true);
    MobclickAgent.updateOnlineConfig(this);
    MobclickAgent.setOnlineConfigureListener(new UmengOnlineConfigureListener() {
        @Override
        public void onDataReceived(JSONObject data) {
            String be_open = MobclickAgent.getConfigParams(getApplicationContext(), "be_open");
            if (be_open.equalsIgnoreCase("true")) {
                // open be

            }
        }
    });
}

From source file:com.srotya.tau.api.dao.alertreceiver.DatabaseResource.java

@Override
protected void before() throws Throwable {
    java.util.logging.Logger.getLogger("org.hibernate").setLevel(Level.OFF);
    Properties config = new Properties(System.getProperties());
    File db = new File(TARGET_RULES_DB);
    if (db.exists()) {
        FileUtils.deleteDirectory(db);//from w  w  w.j a va  2 s  . com
    }
    config.setProperty("javax.persistence.jdbc.url", CONNECTION_STRING);
    try {
        emf = Persistence.createEntityManagerFactory("tau", config);
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    }

    EntityManager em = emf.createEntityManager();

    RuleGroup ruleGroup = new RuleGroup();
    ruleGroup.setRuleGroupId("all");
    ruleGroup.setRuleGroupName("all");
    RuleGroupManager.getInstance().createRuleGroup(em, ruleGroup);
}