Exemple #1
0
 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()]);
 }
Exemple #2
0
 /**
  * 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);
   }
 }
Exemple #3
0
 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 {
     //
   }
 }
Exemple #4
0
 protected static void getFilesThreadLocal(Handler[] handlers, List<File> files) {
   for (Handler handler : handlers) {
     getFilesThreadLocal(handler, files);
   }
 }