List of usage examples for java.util.logging ConsoleHandler setFilter
public synchronized void setFilter(Filter newFilter) throws SecurityException
From source file:fr.ippon.wip.util.WIPLogging.java
private WIPLogging() { try {/*from w w w .ja v a 2 s .com*/ // FileHandler launch an exception if parent path doesn't exist, so // we make sure it exists File logDirectory = new File(HOME + "/wip"); if (!logDirectory.exists() || !logDirectory.isDirectory()) logDirectory.mkdirs(); accessFileHandler = new FileHandler("%h/wip/access.log", true); accessFileHandler.setLevel(Level.INFO); accessFileHandler.setFormatter(new SimpleFormatter()); Logger.getLogger("fr.ippon.wip.http.hc.HttpClientExecutor.AccessLog").addHandler(accessFileHandler); ConsoleHandler consoleHandler = new ConsoleHandler(); consoleHandler.setFilter(new Filter() { public boolean isLoggable(LogRecord record) { return !record.getLoggerName().equals("fr.ippon.wip.http.hc.HttpClientExecutor.AccessLog"); } }); Logger.getLogger("fr.ippon.wip").addHandler(consoleHandler); // For HttpClient debugging // FileHandler fileHandler = new // FileHandler("%h/wip/httpclient.log", true); // fileHandler.setLevel(Level.ALL); // Logger.getLogger("org.apache.http.headers").addHandler(fileHandler); // Logger.getLogger("org.apache.http.headers").setLevel(Level.ALL); } catch (SecurityException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }