public class GelfMessage extends Object
GelfMessage
can be converted to toJson()
, to toTCPBuffer()
and to toUDPBuffers()
. It
also provides methods accepting ByteBuffer
to reduce GC pressure.Modifier and Type | Field and Description |
---|---|
static int |
DEFAUL_LEVEL |
static String |
DEFAULT_FACILITY |
static int |
DEFAULT_MESSAGE_SIZE |
static String |
FIELD_FACILITY |
static String |
FIELD_FULL_MESSAGE |
static String |
FIELD_HOST |
static String |
FIELD_LEVEL |
static String |
FIELD_SHORT_MESSAGE |
static String |
FIELD_TIMESTAMP |
static String |
FIELD_TYPE_DEFAULT |
static String |
FIELD_TYPE_DISCOVER
Discover the field type by trying to parse it.
|
static String |
FIELD_TYPE_DOUBLE
double field type.
|
static String |
FIELD_TYPE_DOUBLE2
Double field type.
|
static String |
FIELD_TYPE_LONG
long field type.
|
static String |
FIELD_TYPE_LONG2
Long field type.
|
static String |
FIELD_TYPE_STRING
String field type.
|
static String |
FIELD_VERSION |
static String |
GELF_VERSION |
static String |
GELF_VERSION_1_0 |
static String |
GELF_VERSION_1_1 |
static String |
ID_NAME |
Constructor and Description |
---|
GelfMessage() |
GelfMessage(String shortMessage,
String fullMessage,
long timestamp,
String level) |
public static final String FIELD_HOST
public static final String FIELD_SHORT_MESSAGE
public static final String FIELD_FULL_MESSAGE
public static final String FIELD_TIMESTAMP
public static final String FIELD_LEVEL
public static final String FIELD_FACILITY
public static final String FIELD_VERSION
public static final String ID_NAME
public static final String FIELD_TYPE_DISCOVER
public static final String FIELD_TYPE_STRING
public static final String FIELD_TYPE_LONG
public static final String FIELD_TYPE_LONG2
public static final String FIELD_TYPE_DOUBLE
public static final String FIELD_TYPE_DOUBLE2
public static final String FIELD_TYPE_DEFAULT
public static final String GELF_VERSION_1_0
public static final String GELF_VERSION_1_1
public static final String GELF_VERSION
public static final String DEFAULT_FACILITY
public static final int DEFAULT_MESSAGE_SIZE
public static final int DEFAUL_LEVEL
public String toJson()
GelfMessage
. Additional fields are prefixed with underscore _
.public String toJson(String additionalFieldPrefix)
GelfMessage
. Additional fields are prefixed with
additionalFieldPrefix
.additionalFieldPrefix
- must not be nullpublic void toJson(ByteBuffer byteBuffer, String additionalFieldPrefix)
GelfMessage
and write it to the ByteBuffer
. Additional fields are
prefixed with additionalFieldPrefix
.byteBuffer
- must not be nulladditionalFieldPrefix
- must not be nullprotected void toJson(biz.paluch.logging.gelf.intern.OutputAccessor out, String additionalFieldPrefix)
public ByteBuffer[] toUDPBuffers()
public ByteBuffer[] toUDPBuffers(ByteBuffer buffer, ByteBuffer tempBuffer)
public ByteBuffer toTCPBuffer()
public ByteBuffer toTCPBuffer(ByteBuffer buffer)
protected ByteBuffer[] sliceDatagrams(ByteBuffer source, int datagrams, ByteBuffer target)
public String getVersion()
public void setVersion(String version)
public String getHost()
public void setHost(String host)
public String getShortMessage()
public void setShortMessage(String shortMessage)
public String getFullMessage()
public void setFullMessage(String fullMessage)
public BigDecimal getTimestampAsBigDecimal()
public String getTimestamp()
public Long getJavaTimestamp()
public void setJavaTimestamp(long javaTimestamp)
public String getLevel()
public void setLevel(String level)
public String getFacility()
public void setFacility(String facility)
public void setAdditionalFieldTypes(Map<String,String> additionalFieldTypes)
public void setDynamicMdcFieldTypes(Map<Pattern,String> dynamicMdcFieldTypes)
public GelfMessage addFields(Map<String,String> fields)
fields
- map of fieldspublic GelfMessage addField(String key, String value)
key
- the keyvalue
- the valuepublic boolean isValid()
public static boolean isEmpty(String str)
public int getMaximumMessageSize()
public void setMaximumMessageSize(int maximumMessageSize)
Copyright © 2013–2023. All rights reserved.