1 25 26 package util; 27 28 import org.objectweb.util.monolog.api.BasicLevel; 29 import org.objectweb.util.monolog.api.Logger; 30 import org.objectweb.util.monolog.api.LoggerFactory; 31 import org.objectweb.util.monolog.Monolog; 32 33 34 38 public class Trace { 39 40 41 42 public static final int DB_1 = (1<<1); 43 public static final int DB_31 = (1<<31); 44 45 public static String filename = "trace.properties"; 46 public static LoggerFactory loggerFactory = null; 47 private static Logger logger = null; 48 49 private Trace() { 51 } 52 53 56 public static Logger getLogger() { 57 if (logger == null) { 58 logger = loggerFactory.getLogger("org.objectweb.jonas_tests"); 59 } 60 return logger; 61 } 62 63 66 public static void configure() { 67 loggerFactory = Monolog.init(filename); 68 } 69 70 75 public static void outln(int f, String s) { 76 getLogger().log(f == DB_1 ? BasicLevel.DEBUG : BasicLevel.WARN, s); 77 } 78 79 83 public static void outln(String s) { 84 getLogger().log(BasicLevel.WARN, s); 85 } 86 87 91 public static void out(String s) { 92 outln(s); 93 } 94 95 99 public static void errln(String s) { 100 getLogger().log(BasicLevel.ERROR, s); 101 } 102 103 } 104 105 | Popular Tags |