Package org.apache.log4j.test

Source Code of org.apache.log4j.test.ShippedCodeFlagTest

package org.apache.log4j.test;

import org.apache.log4j.Category;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.SimpleLayout;
import org.apache.log4j.FileAppender;
 
public class ShippedCodeFlagTest {

  static Category CAT=Category.getInstance(ShippedCodeFlagTest.class.getName());

  public static void main( String[] argv) {

    String type = null;
    if(argv.length == 1)
      type = argv[0];
    else
      Usage("Wrong number of arguments.");
    
    if(type.equals("basic")) {
       System.out.println("System property \""+
        BasicConfigurator.DISABLE_OVERRIDE_KEY +
        "\" is set to ["+
      System.getProperty(BasicConfigurator.DISABLE_OVERRIDE_KEY)
        +"].");
   
       BasicConfigurator.configure(new FileAppender(new SimpleLayout(),
             System.out));
    
    }
    else {
      PropertyConfigurator.configure(type);
    }
    BasicConfigurator.disableInfo();      
    CAT.debug("Hello world");
  }

  static
  void Usage(String msg) {
    System.err.println(msg);
    System.err.println( "Usage: java org.apache.log4j.test.ShippedCodeFlagTest " +
      "basic|configFile");
    System.exit(1);
  }

}
TOP

Related Classes of org.apache.log4j.test.ShippedCodeFlagTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.