Package java.util.logging

Examples of java.util.logging.Level$LevelAll


 
  @Override
  public boolean isEnabled(String context, int msgLevel) {
    Logger logger = Logger.getLogger(context);
     
      Level javaLevel = convertLevel(msgLevel);
      return logger.isLoggable(javaLevel);
  }
View Full Code Here


  }

    public void log(int level, String context, Object msg) {
      Logger logger = Logger.getLogger(context);
     
      Level javaLevel = convertLevel(level);
    logger.log(javaLevel, msg.toString());
    }
View Full Code Here

    }
   
    public void log(int level, String context, Throwable t, Object msg) {
      Logger logger = Logger.getLogger(context);
     
      Level javaLevel = convertLevel(level);
    logger.log(javaLevel, msg != null ? msg.toString() : null, t);
    }
View Full Code Here

     *
     * @param level  the string to return a level for
     * @return    the corresponding level or the default
     */
    public static Level stringToLevel(String level) {
      Level  result;
     
      if (level.equalsIgnoreCase("ALL"))
        result = ALL;
      else if (level.equalsIgnoreCase("CONFIG"))
        result = CONFIG;
View Full Code Here

    }
  }

  public void log(Marker marker, String callerFQCN, int level, String message,
      Object[] argArray, Throwable t) {
    Level julLevel;
    switch (level) {
    case LocationAwareLogger.TRACE_INT:
      julLevel = Level.FINEST;
      break;
    case LocationAwareLogger.DEBUG_INT:
View Full Code Here

            if (!logIsInitialized) {
               Map map = this.property.getPropertiesForContextNode(this.contextNode, ContextNode.LOGGING_MARKER_TAG, "__default");
               String defVal = (String)map.get("__default");
               if (defVal != null) {
                  try {
                     Level defaultLevel = Level.parse(defVal);
                     Logger defLogger = logManager.getLogger("");
                     if (defLogger != null) {
                        defLogger.setLevel(defaultLevel);
                        log.info("Setting default log level to '" + defaultLevel.getName() + "'");
                     }
                     else
                        log.warning("Setting default log level to '" + defaultLevel.getName() + "' failed since default log level is null");
                  }
                  catch (Throwable ex) {
                     log.warning("An exception occured when parsing '" + defVal + "' as a log level");
                  }
               }
               Iterator iter = map.entrySet().iterator();

               Logger defLogger = logManager.getLogger("");
               // Handler[] tmpHandlers = defLogger.getHandlers();
               // Handler[] refHandlers = new Handler[tmpHandlers.length];
               Handler[] refHandlers = defLogger.getHandlers();
               for (int i=0; i < refHandlers.length; i++) {
                  refHandlers[i].setLevel(Level.FINEST);
                  Formatter formatter = refHandlers[i].getFormatter();
                  if (formatter instanceof XbFormatter) {
                     XbFormatter xb = (XbFormatter)formatter;
                     xb.setGlobal(this);
                  }
               }

               while (iter.hasNext()) {
                  Map.Entry entry = (Map.Entry)iter.next();
                  String key = (String)entry.getKey();
                  String val = (String)entry.getValue();
                  try {
                     Level level = Level.parse(val);
                     Logger tmpLogger = Logger.getLogger(key);
                     if (tmpLogger != null) {
                        tmpLogger.setLevel(level);
                        tmpLogger.setUseParentHandlers(false);
                        for (int i=0; i < refHandlers.length; i++) {
                           // handlers[i].setLevel(level);
                           tmpLogger.addHandler(refHandlers[i]);
                        }
                        log.info("Setting log level for '" + key + "' to '" + level.getName() + "'");
                     }
                     else
                        log.info("Setting log level for '" + key + "' to '" + level.getName() + "' failed since logger was null");
                  }
                  catch (Throwable ex) {
                     log.warning("An exception occured when parsing '" + val + "' as a log level for '" + key + "'");
                  }
               }
View Full Code Here

    }

    public void testJdk14LoggerTraceEnabled()
        throws Exception
    {
        final Level level = Level.ALL;
        final Level type = Level.FINEST;
        final String message = "Meep!";
        final Throwable throwable = null;
        final boolean output = true;

        final Jdk14Logger logger = createLogger( level );
View Full Code Here

    }

    public void testJdk14LoggerTraceDisabled()
        throws Exception
    {
        final Level level = Level.OFF;
        final String message = "Meep!";

        final Jdk14Logger logger = createLogger( level );
        logger.trace( message );
        checkLogger( false, null, null, null );
View Full Code Here

    }

    public void testJdk14LoggerTraceWithExceptionEnabled()
        throws Exception
    {
        final Level level = Level.ALL;
        final Level type = Level.FINEST;
        final String message = "Meep!";
        final Throwable throwable = new Throwable();
        final boolean output = true;

        final Jdk14Logger logger = createLogger( level );
View Full Code Here

    }

    public void testJdk14LoggerTraceWithExceptionDisabled()
        throws Exception
    {
        final Level level = Level.OFF;
        final String message = "Meep!";
        final Throwable throwable = new Throwable();

        final Jdk14Logger logger = createLogger( level );
View Full Code Here

TOP

Related Classes of java.util.logging.Level$LevelAll

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.