01: /**
02: * Copyright (C) 2002
03: */package org.objectweb.util.monolog.javaLog;
04:
05: import org.objectweb.util.monolog.api.Logger;
06: import org.objectweb.util.monolog.api.BasicLevel;
07: import org.objectweb.util.monolog.wrapper.javaLog.LoggerFactory;
08:
09: import java.util.Properties;
10:
11: /**
12: *
13: * @author Sebastien Chassande-Barrioz
14: */
15: public class TestConfigurability {
16: public static void main(String args[]) {
17: String configMode = args[0];
18: String configParam = null;
19: if (args.length >= 2)
20: configParam = args[1];
21:
22: Properties prop = new Properties();
23:
24: prop.put(LoggerFactory.JAVALOG_CONFIGURATION, configMode);
25: if (configParam != null) {
26: if (configMode.equals(LoggerFactory.PROPERTY))
27: prop.put(LoggerFactory.JAVALOG_CONFIGURATION_FILE,
28: configParam);
29: else if (configMode.equals(LoggerFactory.PROPERTY))
30: prop.put(LoggerFactory.JAVALOG_CONFIGURATION_CLASS,
31: configParam);
32: }
33: System.out.println("Test the configurability with in "
34: + configMode + " mode");
35:
36: LoggerFactory mlf = new LoggerFactory();
37: try {
38: mlf.configure(prop);
39: } catch (Exception e) {
40: System.out.println("Impossible to configure in "
41: + configMode + "mode");
42: e.printStackTrace();
43: System.exit(12);
44: }
45:
46: Logger l = mlf
47: .getLogger("org.objectweb.monolog.javalog.test.toto");
48: l.log(BasicLevel.INFO, "test PASSED");
49: }
50: }
|