Add Entgra Device Notification Logger #51
Merged
inosh
merged 12 commits from pramilaniroshan/device-mgt-core:entgra-logger
into master
2 years ago
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'pramilaniroshan/device-mgt-core:entgra-logger'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Purpose
Allow users to configure logger, instead of using a default logger.
Goals
MDC in Log4j allows users to fill a map-like structure with pieces of information that are accessible to the appender when the log message is actually written.
Approach
In MDC, the context is passed into a map structure, and in logFormatter, you just call the context key to get the context value.
MDC.put("Device", "abcd");
MDC.put("userId", "1234");
For referring to the MDC context keys, we use the %X specifier that is used to print the current thread’s Mapped Diagnostic Context (MDC).
Use %X to include the full contents of the Map.
Use %X{key} to include the specified key.
layout.pattern = TID: [%d] [%tenantId] [%X{Device}] [%X{userId}] - %m%ex%n
Documentation
WIP: Add Entgra Device Notification Loggerto Add Entgra Device Notification Logger 2 years agod201e295ac
into master 2 years agod201e295ac
.