package de.anomic.server.logging; import java.io.File; import java.io.FilenameFilter; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.logging.Handler; import java.util.logging.LogManager; import java.util.logging.LogRecord; import de.anomic.plasma.plasmaParser; import de.anomic.server.logging.logParsers.LogParser; public class LogalizerHandler extends Handler { public static boolean enabled; public static boolean debug; private String logParserPackage; private HashMap parsers; public LogalizerHandler() { super(); configure(); } private HashMap loadParsers() { HashMap parsers = new HashMap(); try { if (enabled) System.out.println("Searching for additional content parsers in package " + logParserPackage); // getting an uri to the parser subpackage String packageURI = plasmaParser.class.getResource("/"+logParserPackage.replace('.','/')).toString(); if (enabled) System.out.println("LogParser directory is " + packageURI); File parserDir = new File(new URI(packageURI)); //System.out.println(parserDir.toString()); String [] parserDirFiles = parserDir.list(parserNameFilter); if(parserDirFiles == null && enabled) { System.out.println("Can't find any parsers in "+parserDir.getAbsolutePath()); } //System.out.println(parserDirFiles.length); for (int i=0; i