示例#1
0
 public static synchronized LocalOnlyAcsLogger getInstance(String namespace, Level level) {
   if (instance == null) {
     LogConfig testLogConfig = new LogConfig();
     testLogConfig.setDefaultMinLogLevelLocal(AcsLogLevel.getNativeLevel(level).getAcsLevel());
     instance = new LocalOnlyAcsLogger(namespace, testLogConfig);
     instance.setUseParentHandlers(false);
     Handler logHandler = new StdOutConsoleHandler(testLogConfig, namespace, null);
     logHandler.setFormatter(
         new AcsXMLLogFormatter() {
           public String format(LogRecord lr) {
             String xml = super.format(lr);
             return xml + '\n';
           }
         });
     logHandler.setLevel(level);
     instance.addHandler(logHandler);
   }
   return instance;
 }