Package org.apache.logging.log4j

Examples of org.apache.logging.log4j.Level


    public void testSerializationDeserialization() throws IOException, ClassNotFoundException {
        RingBufferLogEvent evt = new RingBufferLogEvent();
        String loggerName = "logger.name";
        Marker marker = null;
        String fqcn = "f.q.c.n";
        Level level = Level.TRACE;
        Message data = new SimpleMessage("message");
        Throwable t = new InternalError("not a real error");
        Map<String, String> map = null;
        ContextStack contextStack = null;
        String threadName = "main";
View Full Code Here


    public void testCreateMementoReturnsCopy() {
        RingBufferLogEvent evt = new RingBufferLogEvent();
        String loggerName = "logger.name";
        Marker marker = MarkerManager.getMarker("marked man");
        String fqcn = "f.q.c.n";
        Level level = Level.TRACE;
        Message data = new SimpleMessage("message");
        Throwable t = new InternalError("not a real error");
        Map<String, String> map = new HashMap<String, String>();
        map.put("key", "value");
        ContextStack contextStack = new MutableThreadContextStack(Arrays.asList("a", "b"));
View Full Code Here

        addAppender(appender);
        final LoggerConfig root = getRootLogger();
        root.addAppender(appender, null, null);

        final String levelName = PropertiesUtil.getProperties().getStringProperty(DefaultConfiguration.DEFAULT_LEVEL);
        final Level level = levelName != null && Level.valueOf(levelName) != null ?
            Level.valueOf(levelName) : Level.ERROR;
        root.setLevel(level);
    }
View Full Code Here

                                           @PluginAttr("maxBurst") final String maxBurst,
                                           @PluginAttr("onmatch") final String match,
                                           @PluginAttr("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

        addAppender(appender);
        final LoggerConfig root = getRootLogger();
        root.addAppender(appender, null, null);

        final String levelName = PropertiesUtil.getProperties().getStringProperty(DEFAULT_LEVEL);
        final Level level = levelName != null && Level.valueOf(levelName) != null ?
            Level.valueOf(levelName) : Level.ERROR;
        root.setLevel(level);
    }
View Full Code Here

     */
    @PluginFactory
    public static ThresholdFilter createFilter(@PluginAttr("level") final String levelName,
                                               @PluginAttr("onMatch") final String match,
                                               @PluginAttr("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

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

            for (final Map.Entry<String, String> entry : attrs.entrySet()) {
                if ("status".equalsIgnoreCase(entry.getKey())) {
View Full Code Here

    }

    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

                        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

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.