Java 8 LoggingMXBean - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 LoggingMXBean class.

This code example shows how to use the following methods:getLoggerLevel, setLoggerLevel
     * 
     * @param loggerName the name of the logger 
     * @param levelName the level to set 
     */ 
    public static void setLoggerLevel(String loggerName, String levelName) {
        loggingMXBean.setLoggerLevel(loggerName, levelName);
        String checkValue = loggingMXBean.getLoggerLevel(loggerName);
        if (!checkValue.equals(levelName)) {
            log.error("Could not set logger level for logger '" +
                      loggerName + "' to '" + levelName +
                      "', got '" + checkValue + "' instead");
        } 
    } 
 
    /** 
     * Set verbose garbage collection logging 
     * 
     * @param verbose whether to enable verbose gc logging 
     */ 
    public static void setVerboseGarbageCollection(boolean verbose) {
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getParentLoggerName
     * Test method for 
     * {@link java.util.logging.LoggingMXBean#getParentLoggerName(java.lang.String)}. 
     */ 
    public void testNonExistentGetParentLoggerName() { 
        // Ensure we get a null back if the named Logger is fictional... 
        assertNull(mb.getParentLoggerName("made up name"));
    } 
 
    /** 
     * Test method for 
     * {@link java.util.logging.LoggingMXBean#setLoggerLevel(java.lang.String, java.lang.String)}. 
     */ 
    public void testSetLoggerLevel() { 
        String loggerName = null;
        while (loggerNames.hasMoreElements()) {
            loggerName = (String) loggerNames.nextElement();
 
            // Store the logger's current log level. 
            Logger logger = LogManager.getLogManager().getLogger(loggerName);
            Level originalLevel = logger.getLevel();
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getLoggerLevel, setLoggerLevel
     * 
     * @param loggerName the name of the logger 
     * @param levelName the level to set 
     */ 
    public static void setLoggerLevel(String loggerName, String levelName) {
        loggingMXBean.setLoggerLevel(loggerName, levelName);
        String checkValue = loggingMXBean.getLoggerLevel(loggerName);
        if (!checkValue.equals(levelName)) {
            log.error("Could not set logger level for logger '" +
                      loggerName + "' to '" + levelName +
                      "', got '" + checkValue + "' instead");
        } 
    } 
 
    /** 
     * Set verbose garbage collection logging 
     * 
     * @param verbose whether to enable verbose gc logging 
     */ 
    public static void setVerboseGarbageCollection(boolean verbose) {
4
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 LoggingMXBean Methods: