FileDocCategorySizeDatePackage
Logging.javaAPI DocJava SE 5 API2679Fri Aug 26 14:57:28 BST 2005java.util.logging

Logging

public class Logging extends sun.management.MXBeanSupport 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.5, 04/18/04
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()
Contructor of Logging which is the implementation class of LoggingMXBean.


                    
      
        super(LoggingMXBean.class);
    
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);