Examples of StructuredDataId


Examples of org.apache.logging.log4j.message.StructuredDataId

    }

    protected void addStructuredData(final String prefix, final Map<String, String> fields,
                                     final StructuredDataMessage msg) {
        fields.put(prefix + EVENT_TYPE, msg.getType());
        final StructuredDataId id = msg.getId();
        fields.put(prefix + EVENT_ID, id.getName());
    }
View Full Code Here

Examples of org.apache.logging.log4j.message.StructuredDataId

        } else {
            buf.append("-");
        }
        buf.append(" ");
        if (isStructured || includeMDC) {
            StructuredDataId id = null;
            String text;
            if (isStructured) {
                final StructuredDataMessage data = (StructuredDataMessage) msg;
                final Map<String, String> map = data.getData();
                id = data.getId();
                formatStructuredElement(id, eventPrefix, map, buf, noopChecker);
                text = data.getFormat();
            } else {
                text = msg.getFormattedMessage();
            }
            if (includeMDC) {
                Map<String, String> map = event.getContextMap();
                if (mdcRequired != null) {
                    checkRequired(map);
                }
                final int ein = id == null || id.getEnterpriseNumber() < 0 ?
                    enterpriseNumber : id.getEnterpriseNumber();
                final StructuredDataId mdcSDID = new StructuredDataId(mdcId, ein, null, null);
                formatStructuredElement(mdcSDID, mdcPrefix, map, buf, checker);
            }
            if (text != null && text.length() > 0) {
                buf.append(" ").append(escapeNewlines(text, escapeNewLine));
            }
View Full Code Here

Examples of org.apache.logging.log4j.message.StructuredDataId

        } else {
            buf.append("-");
        }
        buf.append(" ");
        if (isStructured || includeMDC) {
            StructuredDataId id = null;
            String text;
            if (isStructured) {
                final StructuredDataMessage data = (StructuredDataMessage) msg;
                final Map<String, String> map = data.getData();
                id = data.getId();
                formatStructuredElement(id, eventPrefix, map, buf, noopChecker);
                text = data.getFormat();
            } else {
                text = msg.getFormattedMessage();
            }
            if (includeMDC) {
                Map<String, String> map = event.getContextMap();
                if (mdcRequired != null) {
                    checkRequired(map);
                }
                final int ein = id == null || id.getEnterpriseNumber() < 0 ?
                    enterpriseNumber : id.getEnterpriseNumber();
                final StructuredDataId mdcSDID = new StructuredDataId(mdcId, ein, null, null);
                formatStructuredElement(mdcSDID, mdcPrefix, map, buf, checker);
            }
            if (text != null && text.length() > 0) {
                buf.append(" ").append(escapeNewlines(text, escapeNewLine));
            }
View Full Code Here

Examples of org.apache.logging.log4j.message.StructuredDataId

    public StructuredDataId getSdId() {
        if (enterpriseId == null || sdId == null) {
            return null;
        }
        final int eId = Integer.parseInt(enterpriseId);
        return new StructuredDataId(sdId, eId, null, null);
    }
View Full Code Here

Examples of org.apache.logging.log4j.message.StructuredDataId

    }

    protected void addStructuredData(final String prefix, final Map<String, String> fields,
                                     final StructuredDataMessage msg) {
        fields.put(prefix + EVENT_TYPE, msg.getType());
        final StructuredDataId id = msg.getId();
        fields.put(prefix + EVENT_ID, id.getName());
    }
View Full Code Here

Examples of org.apache.logging.log4j.message.StructuredDataId

    public StructuredDataId getSdId() {
        if (enterpriseId == null || sdId == null) {
            return null;
        }
        final int eId = Integer.parseInt(enterpriseId);
        return new StructuredDataId(sdId, eId, null, null);
    }
View Full Code Here

Examples of org.apache.logging.log4j.message.StructuredDataId

        this.enterpriseNumber = ein;
        this.includeMDC = includeMDC;
        this.includeNewLine = includeNL;
        this.escapeNewLine = escapeNL == null ? null : Matcher.quoteReplacement(escapeNL);
        this.mdcId = mdcId;
        this.mdcSDID = new StructuredDataId(mdcId, enterpriseNumber, null, null);
        this.mdcPrefix = mdcPrefix;
        this.eventPrefix = eventPrefix;
        this.appName = appName;
        this.messageId = messageId;
        this.useTLSMessageFormat = useTLSMessageFormat;
View Full Code Here

Examples of org.apache.logging.log4j.message.StructuredDataId

            final Configuration config) {
        final Map<String, FieldFormatter> sdIdMap = new HashMap<String, FieldFormatter>();

        if (loggerFields != null) {
            for (final LoggerFields lField : loggerFields) {
                final StructuredDataId key = lField.getSdId() == null ? mdcSDID : lField.getSdId();
                final Map<String, List<PatternFormatter>> sdParams = new HashMap<String, List<PatternFormatter>>();
                final Map<String, String> fields = lField.getMap();
                if (!fields.isEmpty()) {
                    final PatternParser fieldParser = createPatternParser(config, null);

                    for (final Map.Entry<String, String> entry : fields.entrySet()) {
                        final List<PatternFormatter> formatters = fieldParser.parse(entry.getValue(), false);
                        sdParams.put(entry.getKey(), formatters);
                    }
                    final FieldFormatter fieldFormatter = new FieldFormatter(sdParams,
                            lField.getDiscardIfAllFieldsAreEmpty());
                    sdIdMap.put(key.toString(), fieldFormatter);
                }
            }
        }
        return sdIdMap.size() > 0 ? sdIdMap : null;
    }
View Full Code Here

Examples of org.apache.logging.log4j.message.StructuredDataId

        }

        if (isStructured) {
            final StructuredDataMessage data = (StructuredDataMessage) message;
            final Map<String, String> map = data.getData();
            final StructuredDataId id = data.getId();

            if (sdElements.containsKey(id.toString())) {
                final StructuredDataElement union = sdElements.get(id.toString());
                union.union(map);
                sdElements.put(id.toString(), union);
            } else {
                final StructuredDataElement formattedData = new StructuredDataElement(map, false);
                sdElements.put(id.toString(), formattedData);
            }
        }

        if (sdElements.size() == 0) {
            buffer.append("-");
View Full Code Here

Examples of org.apache.logging.log4j.message.StructuredDataId

    }

    protected void addStructuredData(final String prefix, final Map<String, String> fields,
                                     final StructuredDataMessage msg) {
        fields.put(prefix + EVENT_TYPE, msg.getType());
        final StructuredDataId id = msg.getId();
        fields.put(prefix + EVENT_ID, id.getName());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.