FileDocCategorySizeDatePackage
RootLogger.javaAPI DocApache log4j 1.2.152091Sat Aug 25 00:09:40 BST 2007org.apache.log4j.spi

RootLogger

public final class RootLogger extends Logger
RootLogger sits at the top of the logger hierachy. It is a regular logger except that it provides several guarantees.

First, it cannot be assigned a null level. Second, since root logger cannot have a parent, the {@link #getChainedLevel} method always returns the value of the level field without walking the hierarchy.

author
Ceki Gülcü

Fields Summary
Constructors Summary
public RootLogger(Level level)
The root logger names itself as "root". However, the root logger cannot be retrieved by name.

    super("root");
    setLevel(level);
  
Methods Summary
public final org.apache.log4j.LevelgetChainedLevel()
Return the assigned level value without walking the logger hierarchy.

    return level;
  
public final voidsetLevel(org.apache.log4j.Level level)
Setting a null value to the level of the root logger may have catastrophic results. We prevent this here.

since
0.8.3

    if (level == null) {
      LogLog.error(
        "You have tried to set a null level to root.", new Throwable());
    } else {
      this.level = level;
    }