Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Enable server log in json format #5389

Closed
puchengy opened this issue Oct 31, 2024 · 0 comments · Fixed by #5388
Closed

[FEATURE] Enable server log in json format #5389

puchengy opened this issue Oct 31, 2024 · 0 comments · Fixed by #5388
Assignees
Labels
0.7.0 Release v0.7.0 feature New feature or request

Comments

@puchengy
Copy link
Contributor

Describe the feature

Enable server log in json format.

Motivation

There are use cases required server logs to be viewed from logsearch tools such as Kibana. These use cases recommends log format to be json.

Based on https://logging.apache.org/log4j/2.x/manual/json-template-layout.html, log4j-layout-template-json is needed to enable json layout for log4j.

Describe the solution

Add org.apache.logging.log4j:log4j-layout-template-json to the project so that users can enable json output format.

Additional context

No response

@puchengy puchengy added the feature New feature or request label Oct 31, 2024
jerryshao pushed a commit to jerryshao/gravitino that referenced this issue Nov 1, 2024
…t-template-json to support server log in json format (apache#5388)

### What changes were proposed in this pull request?

Add org.apache.logging.log4j:log4j-layout-template-json to support
server log in json format.

### Why are the changes needed?

There are use cases required server logs to be viewed from logsearch
tools such as Kibana. These use cases recommends log format to be json.

Based on
https://logging.apache.org/log4j/2.x/manual/json-template-layout.html,
`log4j-layout-template-json` is needed to enable json layout for log4j.

Fix: apache#5389

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Tested locally with modified lo4j property file.
```
appender.rolling.layout.type = JsonTemplateLayout
appender.rolling.layout.eventTemplate = {"instant":{"$resolver":"timestamp","pattern":{"format":"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'","timeZone":"UTC"}},"level":{"$resolver":"level","field":"name"},"thread":{"$resolver":"thread","field":"name"},"message":{"$resolver":"message","stringified":true},"exception":{"$resolver":"exception","field":"stackTrace","stackTrace":{"stringified":true}}}
```

For better usability, json can be passed in via a individual file using
[eventTemplateUri](https://logging.apache.org/log4j/2.x/manual/json-template-layout.html#plugin-attr-eventTemplateUri)
instead.
@jerryshao jerryshao added the 0.7.0 Release v0.7.0 label Nov 1, 2024
yuqi1129 pushed a commit that referenced this issue Nov 1, 2024
…late-json to support server log in json format (#5407)

### What changes were proposed in this pull request?

Add org.apache.logging.log4j:log4j-layout-template-json to support
server log in json format.

### Why are the changes needed?

There are use cases required server logs to be viewed from logsearch
tools such as Kibana. These use cases recommends log format to be json.

Based on
https://logging.apache.org/log4j/2.x/manual/json-template-layout.html,
`log4j-layout-template-json` is needed to enable json layout for log4j.

Fix: #5389

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Tested locally with modified lo4j property file.
```
appender.rolling.layout.type = JsonTemplateLayout
appender.rolling.layout.eventTemplate = {"instant":{"$resolver":"timestamp","pattern":{"format":"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'","timeZone":"UTC"}},"level":{"$resolver":"level","field":"name"},"thread":{"$resolver":"thread","field":"name"},"message":{"$resolver":"message","stringified":true},"exception":{"$resolver":"exception","field":"stackTrace","stackTrace":{"stringified":true}}}
```

For better usability, json can be passed in via a individual file using
[eventTemplateUri](https://logging.apache.org/log4j/2.x/manual/json-template-layout.html#plugin-attr-eventTemplateUri)
instead.

Co-authored-by: Pucheng Yang <[email protected]>
danhuawang pushed a commit to danhuawang/gravitino that referenced this issue Nov 4, 2024
…t-template-json to support server log in json format (apache#5407)

### What changes were proposed in this pull request?

Add org.apache.logging.log4j:log4j-layout-template-json to support
server log in json format.

### Why are the changes needed?

There are use cases required server logs to be viewed from logsearch
tools such as Kibana. These use cases recommends log format to be json.

Based on
https://logging.apache.org/log4j/2.x/manual/json-template-layout.html,
`log4j-layout-template-json` is needed to enable json layout for log4j.

Fix: apache#5389

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Tested locally with modified lo4j property file.
```
appender.rolling.layout.type = JsonTemplateLayout
appender.rolling.layout.eventTemplate = {"instant":{"$resolver":"timestamp","pattern":{"format":"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'","timeZone":"UTC"}},"level":{"$resolver":"level","field":"name"},"thread":{"$resolver":"thread","field":"name"},"message":{"$resolver":"message","stringified":true},"exception":{"$resolver":"exception","field":"stackTrace","stackTrace":{"stringified":true}}}
```

For better usability, json can be passed in via a individual file using
[eventTemplateUri](https://logging.apache.org/log4j/2.x/manual/json-template-layout.html#plugin-attr-eventTemplateUri)
instead.

Co-authored-by: Pucheng Yang <[email protected]>
mplmoknijb pushed a commit to mplmoknijb/gravitino that referenced this issue Nov 6, 2024
…t-template-json to support server log in json format (apache#5388)

### What changes were proposed in this pull request?

Add org.apache.logging.log4j:log4j-layout-template-json to support
server log in json format.

### Why are the changes needed?

There are use cases required server logs to be viewed from logsearch
tools such as Kibana. These use cases recommends log format to be json.

Based on
https://logging.apache.org/log4j/2.x/manual/json-template-layout.html,
`log4j-layout-template-json` is needed to enable json layout for log4j.

Fix: apache#5389

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Tested locally with modified lo4j property file.
```
appender.rolling.layout.type = JsonTemplateLayout
appender.rolling.layout.eventTemplate = {"instant":{"$resolver":"timestamp","pattern":{"format":"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'","timeZone":"UTC"}},"level":{"$resolver":"level","field":"name"},"thread":{"$resolver":"thread","field":"name"},"message":{"$resolver":"message","stringified":true},"exception":{"$resolver":"exception","field":"stackTrace","stackTrace":{"stringified":true}}}
```

For better usability, json can be passed in via a individual file using
[eventTemplateUri](https://logging.apache.org/log4j/2.x/manual/json-template-layout.html#plugin-attr-eventTemplateUri)
instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.7.0 Release v0.7.0 feature New feature or request
Projects
None yet
2 participants