1 4 5 package org.objectweb.util.monolog.javaLog; 6 7 import org.objectweb.util.monolog.api.Logger; 8 import org.objectweb.util.monolog.api.BasicLevel; 9 import org.objectweb.util.monolog.wrapper.javaLog.LoggerFactory; 10 11 import java.util.Properties ; 12 13 17 public class TestConfigurability { 18 public static void main(String args[]) { 19 String configMode = args[0]; 20 String configParam = null; 21 if (args.length>=2) 22 configParam = args[1]; 23 24 Properties prop = new Properties (); 25 26 prop.put(LoggerFactory.JAVALOG_CONFIGURATION, configMode); 27 if (configParam!=null) { 28 if (configMode.equals(LoggerFactory.PROPERTY)) 29 prop.put(LoggerFactory.JAVALOG_CONFIGURATION_FILE, configParam); 30 else if (configMode.equals(LoggerFactory.PROPERTY)) 31 prop.put(LoggerFactory.JAVALOG_CONFIGURATION_CLASS, configParam); 32 } 33 System.out.println("Test the configurability with in " + configMode 34 + " mode"); 35 36 LoggerFactory mlf = new LoggerFactory(); 37 try { 38 mlf.configure(prop); 39 } 40 catch (Exception e) { 41 System.out.println("Impossible to configure in " + configMode 42 + "mode"); 43 e.printStackTrace(); 44 System.exit(12); 45 } 46 47 Logger l = mlf.getLogger("org.objectweb.monolog.javalog.test.toto"); 48 l.log(BasicLevel.INFO, "test PASSED"); 49 } 50 } 51 | Popular Tags |