Package org.apache.logging.log4j

Examples of org.apache.logging.log4j.Level


                @PluginElement("AppenderRef") final AppenderRef[] refs,
                @PluginElement("Properties") final Property[] properties,
                @PluginConfiguration final Configuration config,
                @PluginElement("Filters") final Filter filter) {
            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


        if (ref == null) {
            LOGGER.error("Appender references must contain a reference");
            return null;
        }
        Level level = null;

        if (levelName != null) {
            level = Level.toLevel(levelName, null);
            if (level == null) {
                LOGGER.error("Invalid level " + levelName + " on Appender reference " + ref);
View Full Code Here

        public BasicConfiguration() {
            final LoggerConfig root = getRootLogger();
            setName("BasicConfiguration");
            final String levelName = System.getProperty(DEFAULT_LEVEL);
            final Level level = (levelName != null && Level.valueOf(levelName) != null) ? Level.valueOf(levelName) : Level.DEBUG;
            root.setLevel(level);
        }
View Full Code Here

            if (root.size() == 1) {
                final Iterator<JsonNode> i = root.elements();
                root = i.next();
            }
            processAttributes(rootNode, root);
            Level status = getDefaultStatus();
            boolean verbose = false;
            PrintStream stream = System.out;
            for (final Map.Entry<String, String> entry : rootNode.getAttributes().entrySet()) {
                if ("status".equalsIgnoreCase(entry.getKey())) {
                    status = Level.toLevel(getStrSubstitutor().replace(entry.getValue()), null);
View Full Code Here

        this.marker = marker;
    }

    @Override
    public int doStartTag() throws JspException {
        Level level = TagUtils.resolveLevel(this.level);
        if (level == null) {
            throw new JspException("Level must be of type String or org.apache.logging.log4j.Level.");
        }

        return TagUtils.isEnabled(this.getLogger(), level, this.marker) ? Tag.EVAL_BODY_INCLUDE : Tag.SKIP_BODY;
View Full Code Here

    }

    @Override
    public final int doEndTag() throws JspException {
        Log4jTaglibLogger logger = this.getLogger();
        Level level = this.getLevel();
        Marker marker = this.getMarker();

        if (TagUtils.isEnabled(logger, level, marker)) {
            Object message = this.getMessage();
            Throwable exception = this.getException();
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(DefaultConfiguration.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

            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.