Package org.objectweb.util.monolog.javaLog

Source Code of org.objectweb.util.monolog.javaLog.TestConfigurability

/**
* Copyright (C) 2002
*/

package org.objectweb.util.monolog.javaLog;

import org.objectweb.util.monolog.api.Logger;
import org.objectweb.util.monolog.api.BasicLevel;
import org.objectweb.util.monolog.wrapper.javaLog.LoggerFactory;

import java.util.Properties;

/**
*
* @author Sebastien Chassande-Barrioz
*/
public class TestConfigurability {
  public static void main(String args[]) {
    String configMode = args[0];
    String configParam = null;
    if (args.length>=2)
      configParam = args[1];

    Properties prop = new Properties();

    prop.put(LoggerFactory.JAVALOG_CONFIGURATION, configMode);
    if (configParam!=null) {
      if (configMode.equals(LoggerFactory.PROPERTY))
        prop.put(LoggerFactory.JAVALOG_CONFIGURATION_FILE, configParam);
      else if (configMode.equals(LoggerFactory.PROPERTY))
        prop.put(LoggerFactory.JAVALOG_CONFIGURATION_CLASS, configParam);
    }
    System.out.println("Test the configurability with in " + configMode
      + " mode");

    LoggerFactory mlf = new LoggerFactory();
    try {
      mlf.configure(prop);
    }
    catch (Exception e) {
      System.out.println("Impossible to configure in " + configMode
        + "mode");
      e.printStackTrace();
      System.exit(12);
    }

    Logger l = mlf.getLogger("org.objectweb.monolog.javalog.test.toto");
    l.log(BasicLevel.INFO, "test PASSED");
  }
}
TOP

Related Classes of org.objectweb.util.monolog.javaLog.TestConfigurability

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.