FileDocCategorySizeDatePackage
Logging.javaAPI DocJava SE 6 API2585Tue Jun 10 00:25:58 BST 2008java.util.logging

Logging

public class Logging extends Object implements LoggingMXBean
Logging is the implementation class of LoggingMXBean. The LoggingMXBean interface provides a standard method for management access to the individual java.util.Logger objects available at runtime.
author
Ron Mann
author
Mandy Chung
version
1.9, 11/17/05
since
1.5
see
javax.management
see
java.util.Logger
see
java.util.LogManager

Fields Summary
private static LogManager
logManager
private static String
EMPTY_STRING
Constructors Summary
Logging()
Constructor of Logging which is the implementation class of LoggingMXBean.


                    
      
    
Methods Summary
public java.lang.StringgetLoggerLevel(java.lang.String loggerName)

        
        Logger l = logManager.getLogger(loggerName);
        if (l == null) {
            return null;
        }

        Level level = l.getLevel();
        if (level == null) {
            return EMPTY_STRING;
        } else {
            return level.getName();
        }
    
public java.util.ListgetLoggerNames()

        Enumeration loggers = logManager.getLoggerNames();
        ArrayList<String> array = new ArrayList<String>();

        for (; loggers.hasMoreElements();) {
            array.add((String) loggers.nextElement());
        }
        return array;
    
public java.lang.StringgetParentLoggerName(java.lang.String loggerName)

        Logger l = logManager.getLogger( loggerName );
        if (l == null) {
            return null;
        }

        Logger p = l.getParent();        
        if (p == null) {
            // root logger
            return EMPTY_STRING;
        } else {
            return p.getName();
        }
    
public voidsetLoggerLevel(java.lang.String loggerName, java.lang.String levelName)

        if (loggerName == null) {
            throw new NullPointerException("loggerName is null");
        }

        Logger logger = logManager.getLogger(loggerName);
        
        if (logger == null) {
            throw new IllegalArgumentException("Logger " + loggerName +
                "does not exist");
        }
 
        Level level = null; 
        if (levelName != null) {
            // parse will throw IAE if logLevel is invalid 
            level = Level.parse(levelName);
        }

        logger.setLevel(level);