Add Entgra Device Notification Logger #51

Merged
inosh merged 12 commits from pramilaniroshan/device-mgt-core:entgra-logger into master 2 years ago
Collaborator

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

N/A

## 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 > N/A
pramilaniroshan added 1 commit 2 years ago
pramilaniroshan added 2 commits 2 years ago
pramilaniroshan added 1 commit 2 years ago
pramilaniroshan added 1 commit 2 years ago
pramilaniroshan added 3 commits 2 years ago
pramilaniroshan added 2 commits 2 years ago
pramilaniroshan added 2 commits 2 years ago
pramilaniroshan changed title from WIP: Add Entgra Device Notification Logger to Add Entgra Device Notification Logger 2 years ago
inosh merged commit d201e295ac into master 2 years ago
The pull request has been merged as d201e295ac.
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: community/device-mgt-core#51
Loading…
There is no content yet.