Skip to content

Issues with Log4j MDC injections #3074

Answered by jkwatson
pwfarwell asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @pwfarwell .

The issue here is that spring boot, by default, is using logback as the logging implementation, not log4j2. If you want to have the logging implementation be log4j2, you'll need to tweak your pom a bit:

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
			<exclusions>
				<exclusion>
					<groupId>org.springframework.boot</groupId>
					<artifactId>spring-boot-starter-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-log4j2</artifactId>
		</dependency>

I tried this locally, and it worked fine.

A…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@pwfarwell
Comment options

@pwfarwell
Comment options

@jkwatson
Comment options

@jkwatson
Comment options

@pwfarwell
Comment options

Answer selected by pwfarwell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants