public class LogRecord extends Object
This class lets you easily generated normalised xdas format.
Constructor and Description |
---|
LogRecord(String platformId,
String tenantName,
String channelName,
String appName,
String runnerId,
String clusterName,
String clusterType) |
Modifier and Type | Method and Description |
---|---|
LogRecord |
addField(String field,
Object value)
Add a field to your log
|
LogRecord |
addFields(Map<String,Object> map)
Add all fields from an existing maps.
|
LogRecord |
forError()
Adds an inner field level to ERROR
|
LogRecord |
forError(org.apache.logging.log4j.Logger logger)
Adds an inner field level to ERROR and log the log using the provided local logger.
|
LogRecord |
forInfo()
Adds an inner field level to INFO
|
LogRecord |
forInfo(org.apache.logging.log4j.Logger logger)
Adds an inner field level to INFO and log the log using the provided local logger.
|
LogRecord |
forWarning()
Adds an inner field level to WARN
|
LogRecord |
forWarning(org.apache.logging.log4j.Logger logger)
Adds an inner field level to WARN and log the log using the provided local logger.
|
String |
toString()
Why a toString method ? because some apps will likely also log
the same content using a local log4j logger.
|
public LogRecord(String platformId, String tenantName, String channelName, String appName, String runnerId, String clusterName, String clusterType)
platformId
- the unique platform identifiertenantName
- the tenant name, possibly nullchannelName
- the channel name, possibly nullappName
- the application name, possibly nullrunnerId
- the identifier of the runner storm shiva-leader spark-worker for instance.clusterName
- the name of the runner clusterclusterType
- the type of the cluster shiva spark stormpublic String toString()
public LogRecord addField(String field, Object value)
field
- the field namevalue
- the content, must be Json compatible and not nullpublic LogRecord forInfo(org.apache.logging.log4j.Logger logger)
logger
- the caller loggerpublic LogRecord forInfo()
public LogRecord forError()
public LogRecord forWarning(org.apache.logging.log4j.Logger logger)
logger
- the caller loggerpublic LogRecord forWarning()
public LogRecord forError(org.apache.logging.log4j.Logger logger)
logger
- the caller loggerCopyright © 2014–2022. All rights reserved.