FileDocCategorySizeDatePackage
BasicConfigurator.javaAPI DocApache log4j 1.2.152332Sat Aug 25 00:09:42 BST 2007org.apache.log4j

BasicConfigurator

public class BasicConfigurator extends Object
Use this class to quickly configure the package.

For file based configuration see {@link PropertyConfigurator}. For XML based configuration see {@link org.apache.log4j.xml.DOMConfigurator DOMConfigurator}.

since
0.8.1
author
Ceki Gülcü

Fields Summary
Constructors Summary
protected BasicConfigurator()

  
Methods Summary
public static voidconfigure()
Add a {@link ConsoleAppender} that uses {@link PatternLayout} using the {@link PatternLayout#TTCC_CONVERSION_PATTERN} and prints to System.out to the root category.

    Logger root = Logger.getRootLogger();
    root.addAppender(new ConsoleAppender(
           new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN)));
  
public static voidconfigure(org.apache.log4j.Appender appender)
Add appender to the root category.

param
appender The appender to add to the root category.

    Logger root = Logger.getRootLogger();
    root.addAppender(appender);
  
public static voidresetConfiguration()
Reset the default hierarchy to its defaut. It is equivalent to calling Category.getDefaultHierarchy().resetConfiguration(). See {@link Hierarchy#resetConfiguration()} for more details.

    LogManager.resetConfiguration();