1 9 10 package org.mmbase.util.logging; 11 12 import java.io.PrintStream ; 13 import java.util.StringTokenizer ; 14 15 27 28 public class SimpleImpl extends AbstractSimpleImpl implements Logger { 29 30 private static SimpleImpl root = new SimpleImpl(); 31 private static PrintStream ps = System.out; 32 33 private SimpleImpl() { 34 } 36 37 public static SimpleImpl getLoggerInstance(String name) { 38 return root; 39 } 40 41 47 48 public static void configure(String c) { 49 50 if (c == null) { 51 return; } 53 54 StringTokenizer t = new StringTokenizer (c, ","); 55 while (t.hasMoreTokens()) { 56 String token = t.nextToken(); 57 if (token.equals("stderr")) { 58 ps = System.err; 59 } 60 if (token.equals("stdout")) { 61 ps = System.out; 62 } 63 if (token.equals("trace")) { 64 root.setLevel(Level.TRACE); 65 } 66 if (token.equals("debug")) { 67 root.setLevel(Level.DEBUG); 68 } 69 if (token.equals("service")) { 70 root.setLevel(Level.SERVICE); 71 } 72 if (token.equals("info")) { 73 root.setLevel(Level.INFO); 74 } 75 if (token.equals("warn")) { 76 root.setLevel(Level.WARN); 77 } 78 if (token.equals("error")) { 79 root.setLevel(Level.ERROR); 80 } 81 if (token.equals("fatal")) { 82 root.setLevel(Level.FATAL); 83 } 84 } 85 } 86 87 protected final void log (String s) { 88 ps.println(s); 89 } 90 91 } 92 | Popular Tags |