Package org.apache.logging.log4j

Examples of org.apache.logging.log4j.Level


    }

    private Result filter(final Level level) {
        final Object value = ThreadContext.get(key);
        if (value != null) {
            Level ctxLevel = levelMap.get(value);
            if (ctxLevel == null) {
                ctxLevel = defaultThreshold;
            }
            return level.isAtLeastAsSpecificAs(ctxLevel) ? onMatch : onMismatch;
        }
View Full Code Here


        final Result onMismatch = Result.toResult(mismatch);
        final Map<String, Level> map = new HashMap<String, Level>();
        for (final KeyValuePair pair : pairs) {
            map.put(pair.getKey(), Level.toLevel(pair.getValue()));
        }
        final Level level = Level.toLevel(levelName, Level.ERROR);
        return new DynamicThresholdFilter(key, map, level, onMatch, onMismatch);
    }
View Full Code Here

            configStream.close();
            final InputSource source = new InputSource(new ByteArrayInputStream(buffer));
            final Document document = newDocumentBuilder().parse(source);
            rootElement = document.getDocumentElement();
            final Map<String, String> attrs = processAttributes(rootNode, rootElement);
            Level status = getDefaultStatus();
            boolean verbose = false;
            PrintStream stream = System.out;

            for (final Map.Entry<String, String> entry : attrs.entrySet()) {
                if ("status".equalsIgnoreCase(entry.getKey())) {
                    final Level stat = Level.toLevel(getStrSubstitutor().replace(entry.getValue()), null);
                    if (stat != null) {
                        status = stat;
                    } else {
                        messages.add("Invalid status specified: " + entry.getValue() + ". Defaulting to " + status);
                    }
View Full Code Here

            @PluginAttribute("maxBurst") final String maxBurst,
            @PluginAttribute("onMatch") final String match,
            @PluginAttribute("onMismatch") final String mismatch) {
        final Result onMatch = Result.toResult(match, Result.NEUTRAL);
        final Result onMismatch = Result.toResult(mismatch, Result.DENY);
        final Level level = Level.toLevel(levelName, Level.WARN);
        float eventRate = rate == null ? DEFAULT_RATE : Float.parseFloat(rate);
        if (eventRate <= 0) {
            eventRate = DEFAULT_RATE;
        }
        final long max = maxBurst == null ? (long) (eventRate * DEFAULT_RATE_MULTIPLE) : Long.parseLong(maxBurst);
View Full Code Here

        public BasicConfiguration() {

            final LoggerConfig root = getRootLogger();
            final String l = System.getProperty(DEFAULT_LEVEL);
            final Level level = (l != null && Level.valueOf(l) != null) ? Level.valueOf(l) : Level.ERROR;
            root.setLevel(level);
        }
View Full Code Here

                        Arrays.toString(STYLES.keySet().toArray()));
                } else {
                    levelStyles.putAll(enumMap);
                }
            } else {
                final Level level = Level.valueOf(key);
                if (level == null) {
                    LOGGER.error("Unknown level name: " + key + ". Use one of " +
                        Arrays.toString(DEFAULT_STYLES.keySet().toArray()));
                } else {
                    levelStyles.put(level, value);
View Full Code Here

            if (OPTION_LENGTH.equalsIgnoreCase(key)) {
                length = Integer.parseInt(value);
            } else if (OPTION_LOWER.equalsIgnoreCase(key)) {
                lowerCase = Boolean.parseBoolean(value);
            } else {
                final Level level = Level.toLevel(key, null);
                if (level == null) {
                    LOGGER.error("Invalid Level {}", key);
                } else {
                    levelMap.put(level, value);
                }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public String getStyleClass(final Object e) {
        if (e instanceof LogEvent) {
            final Level level = ((LogEvent) e).getLevel();

            switch (level) {
            case TRACE:
                return "level trace";

View Full Code Here

    @PluginFactory
    public static ThresholdFilter createFilter(
            @PluginAttribute("level") final String levelName,
            @PluginAttribute("onMatch") final String match,
            @PluginAttribute("onMismatch") final String mismatch) {
        final Level level = Level.toLevel(levelName, Level.ERROR);
        final Result onMatch = Result.toResult(match, Result.NEUTRAL);
        final Result onMismatch = Result.toResult(mismatch, Result.DENY);
        return new ThresholdFilter(level, onMatch, onMismatch);
    }
View Full Code Here

            LOGGER.error("Loggers cannot be configured without a name");
            return null;
        }

        final List<AppenderRef> appenderRefs = Arrays.asList(refs);
        Level level;
        try {
            level = Level.toLevel(levelName, Level.ERROR);
        } catch (final Exception ex) {
            LOGGER.error(
                    "Invalid Log level specified: {}. Defaulting to Error",
View Full Code Here

TOP

Related Classes of org.apache.logging.log4j.Level

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.