Questions tagged [log4j2]

Log4j 2 is an upgrade to Log4j, a Java-based logging utility, that provides significant improvements over its predecessor, Log4j 1.x, and provides many of the improvements available in Logback while fixing some inherent problems in Logback's architecture.

Log4j2 is a standalone upgrade to Log4j that provides significant improvements over its predecessor, Log4j 1.x, and provides many of the improvements available in Logback while fixing some inherent problems in Logback's architecture. Log4j2.x changes the API and is no longer downward compatible to log4j1.x

See Also

4386 questions
1
vote
0 answers

Programmatically use Layout / PatternLayout in Log4j2

I'm migrating a large application from Log4j1 to Log4j2 following the Migration Guide (Option 2 by Apache). The project is a large and modularized and I don't have the knowledge on how every module works. When reading the Migration Guide (Option 2…
Paul Erlenmeyer
  • 523
  • 2
  • 6
  • 29
1
vote
1 answer

log4j2 MDC data is not being printed for some loggers

After switching to log4j2 via the log4j-1.2-api bridge, I've noticed that MDC data is missing from some log lines. These lines come from a separate logger in the same class. What's puzzling is that this happens randomly – sometimes the MDC data…
pouyan021
  • 177
  • 1
  • 4
  • 19
1
vote
1 answer

log4j JsonTemplateLayout doesn't work when jar file built by shadowJar

I use shadowJar I use log4j2 and I need to log everything in json format. But once I add 'org.apache.logging.log4j:log4j-layout-template-json:2.17.1' into build.gradle file I'm getting this errors: ERROR StatusLogger Unrecognized format specifier…
Guru_1010
  • 574
  • 7
  • 22
1
vote
1 answer

create a custom log4j2 rolling file appender

I want to create a custom log4j2 rolling file appender. I need to create this custom appender because I want to wrap the file name with current thread name. We are trying to migrate log4j 1.x to recent log4j2 version and previously we had used…
1
vote
2 answers

I am going to use log4j version 2.3.2 . is it safe for me?

I want to use log4j library for my web app that is created with Java 6. Which version is safe for me ? Do you recommend log4j or log4j2 considering their vulnerabilities and security issues?
Pouria Saleh
  • 55
  • 1
  • 10
1
vote
1 answer

log4j2 replacement for RollingFileAppender that set log directory programmatically

We are upgrading our Java application from log4j 1x to 2x. In 1x we had an extension to RollingFileAppender specified in log4j.properties. As well as rolling the files, it would compute the path of the logs directory according to whether it was…
hobbes_child
  • 131
  • 2
  • 12
1
vote
2 answers

Routing console output to a log file in Springboot

I am trying to route the console logging to a file. Though, I was able to generate the log file but it's not capturing the output generated from logger.info . The output is getting printed on the console but the same is not reflecting in the log…
Praveenks
  • 1,436
  • 9
  • 40
  • 79
1
vote
1 answer

Converting log4j.properties into log4j2.xml

I never worked with this type of issue and now I'm supposed to port log4j.properties file into log4j2.xml and I'm having bunch of problems. Is there any tool that I could use for this? Or any guide because I'm really stuck here. List of some…
JustQuest
  • 249
  • 4
  • 15
1
vote
0 answers

Micronaut possibility to exclude endpoints from http logger

I enabled logging http traffic by . But I want exclude health endpoint from logging. Is there some config for it? I found some settings at access logger, but it didn't affect…
Andrew Sneck
  • 724
  • 9
  • 18
1
vote
4 answers

Log4j2 + AWS JAVA LAMBDA + CLOUD WATCH LOGS

I am using the following configurations in my code but cloudwatch logs are not getting generated. Log4j2.xml is present in main/resources. I am following the AWS documentation and some stack overflow but I am not getting the logs it says…
satyam pandey
  • 43
  • 1
  • 7
1
vote
1 answer

Updating log4j1.2 to log4j2 present in lib hadoop-mapreduce-client-core

I need to exclude log4j1.2 dependency from hadoop-mapreduce-client-core lib and explicitly include log4j2 version in my pom but there is no upgraded version available for the below and log4j2 is backward incompatible with 3.3.0…
himagarg
  • 11
  • 1
1
vote
1 answer

Wildfly not picking log4j2.xml configuration file and logging not working

I have upgraded my log4j from 1.2.7 to log4j 2.12.4. I have three WAR files for which I want all the logs (from all WAR files) in a same log file "ABC.log". I have created log4j2.xml for each WAR file and have placed it under classpath…
1
vote
1 answer

How to add variables to appender in log4j2?

is there way to add variables from code to appender? e.g.
kqlqk
  • 53
  • 6
1
vote
1 answer

Logs not printing after migrating from log4j-1.2.17 to Log4j2 2.17.1

I am trying to migrate from log4j-1.2.17 to log4j-api-2.17.1 but after all the changes, the logs are not getting printed. I am using 'Option 2' as suggested by the https://logging.apache.org/log4j/2.x/manual/migration.html . I have added…
Manish
  • 45
  • 1
  • 9
1
vote
1 answer

How to set log4j2 log levels and categories in DataWeave 2.x?

When using the log() function in DataWeave I have a few questions: How can I set a log level and log category so my logs are handled by log4j2 the same way as log messages from the Logger components in the Mule flow? How can I suppress logging the…
Ethan Port
  • 166
  • 8