Skip to content

Adds a usage guide for StructuredJsonLayout log4j2 plugin #762

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions log4j2-extensions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
StructuredJsonLayout Plugin Usage Guide
=======================================

This guide provides instructions on how to use the `StructuredJsonLayout` plugin in a Log4j2 YAML configuration file.

## Prerequisites

Ensure you have the `log4j2-extensions` dependency included in your project. Add the following to your `pom.xml` if you are using Maven:

```xml
<dependency>
<groupId>io.confluent</groupId>
<artifactId>confluent-log4j2-extensions</artifactId>
</dependency>
```

## Configuration

Below is an example of how to configure the StructuredJsonLayout plugin in a Log4j2 YAML configuration file

```yaml
Configuration:
status: warn
appenders:
console:
name: Console
target: SYSTEM_OUT
StructuredJsonLayout:
Property:
- name: "property1"
value: "value1"
- name: "property2"
value: "value2"
loggers:
root:
level: info
appenderRefs:
- ref: Console
```

If you are using `SerializableSchemaAndValue`, then the following properties can be provided to `StructuredJsonLayout` to migrate to log4j2:

```yaml
StructuredJsonLayout:
Property:
- name: schemas.enable
value: false
```