示例#1
0
文件: LogTools.java 项目: visik7/jpod
 public static File[] getFilesThreadLocal() {
   List<File> files = new ArrayList<File>();
   Logger logger = Logger.getLogger("");
   Handler[] handlers = logger.getHandlers();
   getFilesThreadLocal(handlers, files);
   return files.toArray(new File[files.size()]);
 }
示例#2
0
文件: LogTools.java 项目: visik7/jpod
 /**
  * This method tries to create a dump of all active log files. For this to work you need a {@link
  * FileDumpHandler} attached to the root logger.
  */
 public static void dumpLogFiles() {
   File[] files = LogTools.getFilesThreadLocal();
   for (File file : files) {
     if (!file.exists()) {
       continue;
     }
     Logger.getLogger("").log(Level.WARNING, "dump " + file.getAbsolutePath(), file);
   }
 }
示例#3
0
文件: LogTools.java 项目: visik7/jpod
 protected static void getFilesThreadLocal(Handler handler, List<File> files) {
   if (handler == null) {
     return;
   }
   Filter filter = handler.getFilter();
   if (filter instanceof ThreadFilter) {
     if (!((ThreadFilter) filter).isActive()) {
       return;
     }
   }
   if (handler instanceof FileHandler) {
     files.addAll(Arrays.asList(getFiles(handler)));
   } else if (handler instanceof CompositeHandler) {
     getFilesThreadLocal(((CompositeHandler) handler).getHandlers(), files);
   } else if (handler instanceof DelegatingHandler) {
     getFilesThreadLocal(((DelegatingHandler) handler).getBaseHandler(), files);
   } else {
     //
   }
 }
示例#4
0
文件: LogTools.java 项目: visik7/jpod
 protected static void getFilesThreadLocal(Handler[] handlers, List<File> files) {
   for (Handler handler : handlers) {
     getFilesThreadLocal(handler, files);
   }
 }