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

logstash-log4j2-encoder not providing the json layout structured logging in spring boot 3, throwing compilation error #8

Open
pSinghDelaplex opened this issue May 25, 2024 · 0 comments

Comments

@pSinghDelaplex
Copy link

pSinghDelaplex commented May 25, 2024

build.gradle

`plugins {
// org.springframework.boot is dependent on io.spring.dependency-management, org.springframework.cloud and gradle
id("org.springframework.boot") version "3.2.3"
}

extra["springCloudVersion"] = "2021.0.3"
extra["springBootAdminVersion"] = "2.4.1"

configurations {
implementation {
exclude("org.springframework.boot", "spring-boot-starter-logging")
}

dependencies {

// implementation
implementation("de.codecentric:spring-boot-admin-starter-client")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-integration")
implementation("org.springframework.boot:spring-boot-starter-log4j2")
implementation("com.fasterxml.jackson.core:jackson-core")
implementation("com.fasterxml.jackson.core:jackson-databind")
implementation("com.fasterxml.jackson.core:jackson-annotations")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")
implementation("io.micrometer:micrometer-tracing")
implementation("io.micrometer:micrometer-tracing-bridge-brave")

// https://mvnrepository.com/artifact/io.github.alexswilliams/logstash-log4j2-encoder
implementation("io.github.alexswilliams:logstash-log4j2-encoder:1.0.4")

}
`

log4j2-spring.yml

log4j2-spring.txt

application.yml

logging: config: classpath:log4j2-spring.yml file.name: example.log

Task :ExampleApplication.main()
ERROR StatusConsoleListener Error processing element Encoder: CLASS_NOT_FOUND
ERROR StatusConsoleListener Error processing element LogstashEncoder: CLASS_NOT_FOUND
ERROR StatusConsoleListener Error processing element Provider: CLASS_NOT_FOUND
ERROR StatusConsoleListener Error processing element LogstashEncoder: CLASS_NOT_FOUND
ERROR StatusConsoleListener Unable to locate plugin type for Encoder
ERROR StatusConsoleListener Timestamp contains an invalid element or attribute "TimestampPattern"
ERROR StatusConsoleListener Mdc contains an invalid element or attribute "IncludeMdcKeyNames"
ERROR StatusConsoleListener Unable to locate plugin for Provider
ERROR StatusConsoleListener Unable to locate plugin for LogstashEncoder
ERROR StatusConsoleListener Unable to locate plugin for Encoder
ERROR StatusConsoleListener Could not create plugin of type class org.apache.logging.log4j.core.appender.ConsoleAppender for element Console: java.lang.NullPointerException: Cannot invoke "org.apache.logging.log4j.core.config.plugins.util.PluginType.getElementName()" because "childType" is null
java.lang.NullPointerException: Cannot invoke "org.apache.logging.log4j.core.config.plugins.util.PluginType.getElementName()" because "childType" is null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant