public final class UtilLog extends Object
Modifier and Type | Method and Description |
---|---|
static String |
asJsonStringWithECSInfoCompliance(PunchMeta punchMeta,
ISettingsMap labels,
String message)
USAGE example:
|
static void |
error(org.apache.logging.log4j.Logger logger,
String message,
Throwable exception)
Log a simple error message
If debug is enabled for this logger, also log the exception in debug level
|
public static void error(org.apache.logging.log4j.Logger logger, String message, Throwable exception)
logger
- log4j2 loggermessage
- message to log. It is recommended to use the pattern :
'message=\"my error message\" detail1=\"anything1\" detail2=\"anything2\" ...'exception
- the exception raised for this errorpublic static String asJsonStringWithECSInfoCompliance(PunchMeta punchMeta, ISettingsMap labels, String message)
ISettingsMap labels = new SettingsMapBuilder().addProperty(IKeys.LEVEL, IKeys.INFO).addProperty(IKeys.RUNTIME, IRuntime.SPARK).build(); UtilLog.asJsonStringWithECSInfoCompliance(punchMeta, labels, EEventType.APPLICATION_STARTED.getCmd());NOTE it is possible to set tags through environment variable.
Any environment variables that has for prefix: PUNCHPLATFORM_TAGS will be displayed within the tags key.
punchMeta
- (can be null)labels
- (can be null) Custom key/value pairs. Can be used to add meta information to events. Should not contain nested objects. All values are stored as keyword. example: {'application': 'foo-bar', 'env': 'production'}message
- (can be null)Copyright © 2014–2023. All rights reserved.