public class JsonLoggerImpl extends Object implements IApimanDelegateLogger
jsonify(String, LogLevel, Throwable). Aims to provide
Jackson's pojo2json functionality is used on Throwables to create an easily parseable exception structure.
Example:
{
"@timestamp": 1430386948306,
"message": "log message here",
"throwable": {
"message": "a terrible thing happened",
"cause": {
"cause": {
"cause": null,
"stackTrace": [
{
"methodName": "main",
"fileName": "Main.java",
"lineNumber": 208,
"className": "com.company.Main",
"nativeMethod": false
},
{
"methodName": "invoke0",
"fileName": "NativeMethodAccessorImpl.java",
"lineNumber": -2,
"className": "sun.reflect.NativeMethodAccessorImpl",
"nativeMethod": true
},
{
"methodName": "invoke",
"fileName": "NativeMethodAccessorImpl.java",
"lineNumber": 57,
"className": "sun.reflect.NativeMethodAccessorImpl",
"nativeMethod": false
},
... SNIP
],
"message": null,
"localizedMessage": null,
"suppressed": []
},
"stackTrace": [
{
"methodName": "main",
"fileName": "Main.java",
"lineNumber": 208,
"className": "com.company.Main",
"nativeMethod": false
},
{
"methodName": "invoke0",
"fileName": "NativeMethodAccessorImpl.java",
"lineNumber": -2,
"className": "sun.reflect.NativeMethodAccessorImpl",
"nativeMethod": true
},
{
"methodName": "invoke",
"fileName": "NativeMethodAccessorImpl.java",
"lineNumber": 57,
"className": "sun.reflect.NativeMethodAccessorImpl",
"nativeMethod": false
},
... SNIP
],
"message": "a terrible thing happened",
"localizedMessage": "algo terrible ha ocurrido!",
"suppressed": []
}
}
}
| Constructor and Description |
|---|
JsonLoggerImpl() |
| Modifier and Type | Method and Description |
|---|---|
IApimanLogger |
createLogger(Class<?> klazz)
Instantiate a JsonLogger
|
IApimanLogger |
createLogger(String name)
Instantiate a JsonLogger
|
void |
debug(String message)
Log a debug level message
|
void |
error(String message,
Throwable error)
Log an error level message.
|
void |
error(Throwable error)
Log an error level message.
|
void |
info(String message)
Log an info level message
|
static void |
setTimeImpl(Time timeImpl)
Set the time implementation.
|
void |
trace(String message)
Log a trace level message
|
void |
warn(String message)
Log a warning
|
public IApimanLogger createLogger(Class<?> klazz)
createLogger in interface IDelegateFactoryklazz - the class instantiating loggerpublic IApimanLogger createLogger(String name)
createLogger in interface IDelegateFactoryname - the logger namepublic static void setTimeImpl(Time timeImpl)
timeImpl - the time implementation.public void info(String message)
IApimanLoggerinfo in interface IApimanLoggermessage - the messagepublic void warn(String message)
IApimanLoggerwarn in interface IApimanLoggermessage - the messagepublic void debug(String message)
IApimanLoggerdebug in interface IApimanLoggermessage - the messagepublic void trace(String message)
IApimanLoggertrace in interface IApimanLoggermessage - the messagepublic void error(String message, Throwable error)
IApimanLoggererror in interface IApimanLoggerpublic void error(Throwable error)
IApimanLoggererror in interface IApimanLoggerCopyright © 2015 JBoss, a division of Red Hat. All rights reserved.