Comments (4)
Indeed, multiple markers are not yet supported. Could you give an example of logstash handles multiple markers / properties?
from logback-gelf.
When you add multiple markers with and, they get added as a reference, from
https://github.com/logstash/logstash-logback-encoder/blob/master/src/main/java/net/logstash/logback/marker/LogstashMarker.java
/**
* Adds the given marker as a reference, and returns this marker.
* <p>
* This can be used to chain markers together fluently on a log line. For example:
*
* <pre>
* {@code
* import static net.logstash.logback.marker.Markers.*
*
* logger.info(append("name1", "value1).and(append("name2", "value2")), "log message");
* }
* </pre>
*
* @param <T> subtype of LogstashMarker
* @param reference The marker to add
* @return A marker with this marker and the given marker
*/
@SuppressWarnings("unchecked")
public <T extends LogstashMarker> T and(Marker reference) {
add(reference);
return (T) this;
}
Then they can be added as a string as they are in that file
public String toString() {
String self = toStringSelf();
if (!hasReferences()) {
return self;
}
StringBuilder sb = new StringBuilder(self);
boolean appendSeparator = !self.isEmpty();
for (Marker marker : this) {
if (appendSeparator) {
sb.append(", ");
}
String referenceToString = marker.toString();
sb.append(referenceToString);
appendSeparator = !referenceToString.isEmpty();
}
return sb.toString();
}
or as json properties as in:
@Override
public void writeTo(JsonGenerator generator) throws IOException {
if (map != null) {
for (Map.Entry<?, ?> entry : map.entrySet()) {
generator.writeFieldName(String.valueOf(entry.getKey()));
generator.writeObject(entry.getValue());
}
}
}
Which is then added the same way as mdc properties.
from logback-gelf.
I've added support for multiple markers in the bugfix/multiple-markers branch. Could you please check and confirm, that this also fixes your issue? I'm not sure where your LS_APPEND_OBJECT comes from.
from logback-gelf.
Fix released in 2.2.0.
from logback-gelf.
Related Issues (20)
- All newlines in short messages are replaced with whitespaces HOT 10
- GelfHttpAppender does not set Uri HOT 1
- Markers are sent with Brackets. Like "[MARKER_NAME]" instead of "MARKER_NAME" without brackets HOT 1
- Configurable max value length for key-value pairs and MDC HOT 6
- It reports only Sl4j logs not console logs HOT 3
- Macbook GelfUdpAppender garbled HOT 2
- GZIP Compression with GelfUdpAppender HOT 1
- Update logback-classic to 1.2.8 HOT 3
- Logback-classic release 1.2.9
- tcp configuration error HOT 3
- Add ability to log thread ID in addition to thread name HOT 2
- Enable adding multiple static fields via environment variable and/or logback.properties HOT 2
- Mutual TLS fails, HOT 1
- Add another method for adding static field to GelfEncoder HOT 2
- GelfMessage should fail on host = "", shortmessage="" HOT 4
- Add ability to log formatted time HOT 1
- Add use of structured arguments HOT 1
- JSON Encoding Performance HOT 1
- Several minor improvements HOT 1
- Faster MessageIdSupplier with less object allocation, error-prone HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from logback-gelf.