Package java.util.logging

Examples of java.util.logging.Filter


    logger.setLevel(java.util.logging.Level.ALL);
    java.util.logging.Handler handler;
    handler = new ConsoleHandler();
    logger.addHandler(handler);

    handler.setFilter(new Filter() { // select what gets logged
        public boolean isLoggable(LogRecord record) {
          return true;
        }
      });
  }
View Full Code Here


    }
   
    private Filter makeFilter(final String name) {
        if (name == null) return null;
       
        Filter f = null;
        try {
            final Class<?> c = Class.forName(name);
            f = (Filter)c.newInstance();
        } catch (final Exception e) {
            if (name != null) {
View Full Code Here

    }
   
    private Filter makeFilter(final String name) {
        if (name == null) return null;
       
        Filter f = null;
        try {
            final Class<?> c = Class.forName(name);
            f = (Filter)c.newInstance();
        } catch (final Exception e) {
            System.err.println("Unable to load filter: " + name);
View Full Code Here

  public void publish(LogRecord record)
  {
    if (! isLoggable(record))
      return;

    Filter filter = getFilter();
    if (filter != null && ! filter.isLoggable(record))
      return;

    try {
      String value;
View Full Code Here

  public void publish(LogRecord record)
  {
    if (! isLoggable(record))
      return;

    Filter filter = getFilter();
    if (filter != null && ! filter.isLoggable(record))
      return;

    try {
      String value;
View Full Code Here

  public void publish(LogRecord record)
  {
    if (! isLoggable(record))
      return;

    Filter filter = getFilter();
    if (filter != null && ! filter.isLoggable(record))
      return;

    try {
      String value;
View Full Code Here

    }

    @Override
    public void init() throws ServletException {
        java.util.logging.Logger rootLogger = java.util.logging.Logger.getLogger(CLOSURE_COMPILER_PACKAGE_NAME);
        Filter logFilter = new CompilerLogFilter();
        rootLogger.setFilter(logFilter);
        rootLogger = java.util.logging.Logger.getLogger(CLOSURE_COMPILER_PACKAGE_NAME + ".PhaseOptimizer");
        rootLogger.setFilter(logFilter);

        try {
View Full Code Here

      for (int i = 0; i < handlers.length; i++)
      {
         Handler handler = handlers[i];
         if (handler instanceof ConsoleHandler)
         {
            Filter filter = new Filter()
            {
               public boolean isLoggable(LogRecord record)
               {
                  String name = record.getLoggerName();
                  for (String ns : namespaces)
View Full Code Here

        }
        internalLog(lr);
    }

    protected void internalLog(LogRecord record) {
        Filter filter = getFilter();
        if (filter != null && !filter.isLoggable(record)) {
            return;
        }
        String msg = formatMessage(record);
        internalLogFormatted(msg, record);
    }
View Full Code Here

     */
    static void enableHandler(final Handler handler, final String handlerName) {
        final Map<String, Filter> disableHandlers = ROOT.getAttachment(DISABLED_HANDLERS_KEY);
        if (disableHandlers != null && disableHandlers.containsKey(handlerName)) {
            synchronized (HANDLER_LOCK) {
                final Filter filter = disableHandlers.get(handlerName);
                handler.setFilter(filter);
                disableHandlers.remove(handlerName);
            }
        }
    }
View Full Code Here

TOP

Related Classes of java.util.logging.Filter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.