Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
37 views

Springboot with logback working, with log4j2 working, but not working when using both

I am observing an issue when sending logs to both log4j2 and logback using kafka. Here is the code of my very simple Springboot app: @SpringBootApplication public class QuestionApplication { ...
PatPanda's user avatar
  • 4,802
1 vote
0 answers
17 views

Log4j2 RollingFile configuration is not working with efs ( elastic file system ) for SizeBasedTriggeringPolicy policy

I'm trying to implement the RollingFile policy, but rolling is not executed even though the log file size is more than 50MB. The log files are on efs. The current version of Log4j is 2.17.1. <...
VijayD's user avatar
  • 820
0 votes
0 answers
21 views

Log4j2 - Log Custom Object With Nested Objects as JSON

I need to log a custom object as plain JSON string, without any extra log event details. I tried to use org.apache.logging.log4j.message.MapMessage (solution is described here https://stackoverflow....
user07's user avatar
  • 415
2 votes
1 answer
45 views

Library using sfl4j not following log42.xml configurations

I'm using the kafka-clients library in my Java application, and the logs are just not getting appended to the Kafka log I specified in my log4j2.xml. However, the org.springframework.kafka logs are ...
IceTea's user avatar
  • 650
0 votes
1 answer
60 views

Filter console exceptions in Log4j from executed jar

I am running a minecraft server and some addons keep spamming the console (and hence making it useless) with the following: com.mojang.brigadier.exceptions.CommandSyntaxException I want to get rid of ...
OnlyTheBest's user avatar
0 votes
1 answer
37 views

Limit Max Message Size in log4j has no effect

I have read this question Limit max message size in log4j2 pattern. I am using %.-1000mto limit number of characters in my message event. For some reason this has no effect. <?xml version="1....
Rob's user avatar
  • 27
1 vote
1 answer
41 views

Json formatted messages using Log4j

I'm trying to get log4j to log messages with specific fields in json format. There is a spec the logging has to follow. log_fmt.json { "name": { "$resolver": "map", ...
gph's user avatar
  • 1,311
1 vote
1 answer
55 views

Updating Log4J2 Appender's file path at Runtime

For a project, I have a programm that is started multiple times, and I want to log every run of it into a different File. I already have everything in place I need for this, e.g. a variable holding ...
Sebastian Felix's user avatar
0 votes
1 answer
62 views

Cannot resolve log4j configuration in Android

I am trying to implement log4j in android, using v2.24.1 dependencies in gradle: implementation 'org.apache.logging.log4j:log4j-api:2.24.1' implementation 'org.apache.logging.log4j:log4j-core:2.24.1' ...
nick_j_white's user avatar
0 votes
0 answers
76 views

How can I manage logger instances (per class) in my own libraries to allow fine-grained configuration?

I’m using Log4j for logging in a Scala project, where each class creates its logger instance using LoggerFactory.getLogger(this.getClass.getName.stripSuffix("$")). In another project, I ...
N0rb0's user avatar
  • 1
1 vote
0 answers
61 views

Add caller information with Opentelemetry java agent instrumentation

I have test java app with java agent opentelemetry instrumentation: -javaagent:/usr/src/app/opentelemetry-javaagent.jar -Dotel.instrumentation.log4j-context-data.enabled=true -Dotel.instrumentation....
0 votes
1 answer
35 views

Unable to set my app log level to debug, is my log4j2.properties even being read?

I am trying to initialize log4j2 in my servlet application (apache-tomcat 9). This code private static Logger logger = LogManager.getLogger(MyClass.class) ; ... Enumeration enumerator = LogManager....
Siddharth's user avatar
  • 9,544
0 votes
1 answer
176 views

Log4j Init error : Unable to create Lookup for bundle java.lang.ClassCastException: class org.apache.logging.log4j.core.lookup.ResourceBundleLookup

I am trying to initialize log4j2 in my servlet application (apache-tomcat 9). I am getting a series of exceptions 2024-09-26T07:58:02.478967Z main ERROR Unable to create Lookup for bundle java.lang....
Siddharth's user avatar
  • 9,544
0 votes
0 answers
47 views

Tracing kafka message event in lmax disruptor ring buffer sequence

Below is the code for kafka message consumed and published within lmax disruptor ring buffer, now i need to implement tracing for each event may goes through multiple sequence. Before publishing the ...
STM's user avatar
  • 1
0 votes
0 answers
80 views

Log didin't write into filename that specified in log4j2-spring.xml file

Spring boot version 3.3.3, in my linux system I will have two tomcat instance under /opt, one is called /opt/tomcat (which is the dev environment, specified in conf/catalina.properties with spring....
Vincent Zheng's user avatar
1 vote
1 answer
38 views

how to prevent maven to download an excluded transitive dependency (not exists in dependency:tree output)

I have a project with dependency tree like below. <dependency> <groupId>xxxxx</groupId> <artifactId>xxxxxx</artifactId> <exclusions> <...
green.it's user avatar
  • 220
0 votes
0 answers
52 views

Log4j2 does not load custom ConsoleLogConverter and SocketLogResolverFactor plugins

I am trying to add two custom plugins to Log4j2: ConsoleLogConverter and `SocketLogResolverFactory'. However, Log4j2 does not load these plugins when the application is launched, despite the fact that ...
Лев Шаповалов's user avatar
-1 votes
1 answer
79 views

Splitting up the Log Files in Log4j2?

I currently have a "LocalLogger" Class that handles all my logging stuff. I can make a new Object of that class in my other classes, to maintain the same logging all over. Currently the ...
Julian Schaefers's user avatar
-1 votes
1 answer
113 views

Log4j2 Logger Class with 2 seperate Log Files

im currently trying to create a LocalLogger Class which i can use in my Project to log stuff. General Idea is: Logs from TRACE to INFO -> infoLog.log Logs from WARN to FATAL -> errorLog.log ALL ...
Julian Schaefers's user avatar
0 votes
1 answer
57 views

Combining Loggers and Appenders from Multiple Properties Files in Log4j2?

I have a simple web application (sample.war) deployed on Tomcat, which uses a log4j2.properties file for logging configuration by default. Now, I need to create a logger configuration from a different ...
Bharath's user avatar
  • 127
5 votes
0 answers
141 views

Unable to verify if logback is the sole logging implementation with jqassistant

I am trying to verify with jqassistant that we only implement logback (and slf4j) for logging. I'm using version: 2.4.0 and the analyze goal seems to be successful but it shouldn't be. For testing ...
Rensykes's user avatar
0 votes
0 answers
36 views

Log4j2 configuration for Java application using Log4j2.properties file

I have an ETL application that runs every hour through a task scheduler. Whenever the ETL app starts the logfile needs to be generated named as ETL_LOG_<CURRENT_DATE_AND_TIMESTAMP>.log. The file ...
Only For Downloads's user avatar
0 votes
0 answers
39 views

Data related to the response is being filtered and body is not displayed despite various attempts to set it up

I would like the log to include all information regarding requests and responses including their bodies. Despite the following standard logging configuration, the content of the responses is being ...
Walter Butze's user avatar
2 votes
0 answers
38 views

Gradle does not see log field through @Log4j2 annotation inside lombok in InteliJ

I have a class @Log4j2 public class TestClass { public void doSmth() { log.info("doSmth"); } } When I try to compile my code using gradle (tap on "assemble" button ...
Oblivion's user avatar
0 votes
2 answers
235 views

Log4j2 No inject constructor error when launching through java.exe

I have a program in java made through maven and packaged with assembly into a single jar with all the dependencies. I need to run this in docker so I need to be able to launch it with java.exe. The ...
Patrik Holub's user avatar
0 votes
0 answers
43 views

Log4j - incorrect date in the backup file

Below is my log4j configuration file, which should be configured as follows: maximum 5 backups of 20 MB each backup at midnight regardless of the current size of the main file deleting logs older ...
Nef91's user avatar
  • 1
4 votes
1 answer
96 views

Is there a recommended Log4J2 pattern for logging individual jobs to individual files? [duplicate]

We have a platform that uses Log4J to write logs for individual jobs that run on our platform. We do this by creating a new Logger for each job: logger = Logger.getLogger(getClass().getPackage()....
Marc Moskowitz's user avatar
0 votes
1 answer
80 views

How to avoid outputting a lot of useless logs in log4j2?

I am moving a project from Weblogic into Tomcat, and I found that there is a problem of mixing log4j and log4j2 when the project is using Weblogic, but it runs normally in Weblogic and outputs the ...
chmod229's user avatar
1 vote
2 answers
182 views

getting deadlock with log4j

We are using log4j for logging purposes. We are using log4j 2.x through 1.2 bridge. Due to size of the application, we cannot upgrade to 2.x. Problem we are facing is that at the time of rollover, ...
phantom's user avatar
  • 73
0 votes
1 answer
130 views

Log4j2 pattern: Escape double-quotes in passed-down message values

We are using log4j2 in our microservices, which all have patterns that produce key-value pairs where values are enclosed in double-quotes so they can automatically be parsed by security tools (in fact,...
Christoph's user avatar
  • 2,317
0 votes
0 answers
50 views

Log4j2 Not write to log after I exported to .jar

I have a log4j2.xml which works correctly, until I export the project. The basePath in this case configured manually. So the log file location is correct even after export. After the exporting, just ...
Krisztofer Török's user avatar
0 votes
2 answers
516 views

Startup log4j2 ERROR Unrecognized conversion specifier and format specifier

In a project using maven, I have the same issue as described in log4j2 ERROR StatusLogger Unrecognized conversion specifier. But the problem persist even after implementing both solutions described in ...
Valentin Ruano's user avatar
2 votes
1 answer
155 views

How can I unit test whether my app logs as expected with log4j2?

I tried using reflection, but in my case sl4fj creates a final logger. This means I can't customize it. Any advice?
Geoff Langenderfer's user avatar
0 votes
1 answer
59 views

Lo4j2 class level logger's logging level not taking effect

I am bit confused why my log4j2 logging levels and appenders dont seem to work as I expect. Let me give the details. Project Structure: Main.java : package com.my.sample.MySampleProject; import org....
Sumit's user avatar
  • 878
-1 votes
1 answer
40 views

Generate geoserver log as gelf

I'm trying to generate a secondary log appender in Geoserver in the GELF format, so I can export it to graylog, but I can't make the application to recognize the JsonTemplateLayout. Until now, I tryed:...
ebarbara's user avatar
  • 166
-1 votes
1 answer
64 views

Setting logger for com.mongodb.internal.diagnostics.logging.SLF4JLogger does not work

Running with Spring Boot, I get logs like this c.m.i.d.l.SLF4JLogger : Command "insert" started on database "test" using a connection with driver-generated ID 3 and server-...
NealeU's user avatar
  • 1,313
1 vote
1 answer
349 views

How to allow object deserialization in Java JDK 21?

I am working on a vulnerable web application which I am integrating with Spring Boot to demonstrate Log4J vulnerability. My vulnerable web application works with my exploit on JDK 1.8. However, the ...
Hittt's user avatar
  • 21
0 votes
0 answers
109 views

JsonTemplateLayout not recognized in Spark Log4j2.properties

I have the below Log4j2.properties where I have configured JsonTemplateLayout as the log layout type , # See also: http://spark.apache.org/docs/2.0.2/running-on-yarn.html#debugging-your-application ...
user24945713's user avatar
3 votes
0 answers
58 views

Need to retain a log4j2 logs on server up to 14 days

I need to retain a log4j logs up to 14 days on server. I am using log4j 2.17 library in my project. I have added below properties in log4j2.properties. status=error name = PropertiesConfig property....
Megha Tayal's user avatar
0 votes
1 answer
64 views

Addressing Log4j2 Configuration Issue: Data Masking Failure in Application Server Despite Adding @ConverterKeys({"mask"}) %mask in log4j2.xml

I need to address an urgent issue with our application's logging configuration. We are trying to implement data masking using Log4j2's custom pattern converter %mask in the log4j2.xml file. However, ...
Love's user avatar
  • 1
-1 votes
1 answer
112 views

Log4j v2 creates logfile but does not write anything to it and ignores my log levels

The problem is that my Log4J logger does not write to a file although it creates it (and the dir too!) and that the levels enabled are only FATAL, ERROR although I told it to enable ALL. Here is my ...
bliako's user avatar
  • 1,113
0 votes
0 answers
56 views

Log4j configuration not applying

I'm trying to update our logging infrastructure, but the configuration changes aren't taking effect The old system was using log4j 1.2, the new is log4j 2.23 I have it building configuration ...
Nathan S's user avatar
0 votes
1 answer
260 views

How to specify logging file with date in spring application.properties file

I am trying to use logging.file.name in application.properties file to log my application based on date but I can not get current date. I have tried logging.file.name=logs/LogFile.%d{yyyy-MM-dd}.log ...
xxlali's user avatar
  • 1,036
1 vote
1 answer
314 views

Log4j2 RoutingAppender with ListAppenders across Multiple Threads

(This is a follow-up from my original question: Log4j2 Custom Appender in Maven Surefire: Possible to Reuse Across Threads?) I'm attempting to unit test the output of any logging coming from Log4j2 in ...
BtySgtMajor's user avatar
  • 1,462
0 votes
1 answer
88 views

Log4j2 Custom Appender in Maven Surefire: Possible to Reuse Across Threads?

I have a Log4j2 custom appender that's being used in many of my JUnit5 tests. (For what it's worth, I came across the code in a couple articles and have only made minor adjustments.) When run in ...
BtySgtMajor's user avatar
  • 1,462
0 votes
1 answer
25 views

How to configure different logging levels for different loggers in Log4j2

We are trying to utilize Log4j2 in our project. We want to configure Log4j2 via properties files. To reduce the noise in our logs, we want to set the root logger to info and set debug logging only for ...
SCote's user avatar
  • 684
0 votes
0 answers
67 views

Log4J2.xml file is not generating a log file

I'm having an issue with my Log4J2.xml file. It is placed in the resources folder. It seems that my log4j2.xml file is literally being ignored by Springboot. Attached is the XML configurations. <...
Andrew Johnson's user avatar
0 votes
1 answer
382 views

How to make sure that log4j2 works with jboss server?

I am upgrading log4j to v2.17.2 from v1.2.12 for an application that runs on jboss-esp-7.2 server. After updating the dependencies and classes, if I deploy on the server, I saw that the logs were not ...
tanvi kulkarni's user avatar
0 votes
0 answers
70 views

Log4j is logging logs with wrong (lower) level

Having the root logger with INFO level: rootLogger.level=INFO rootLogger.appenderRef.console.ref=ConsoleAppender and a specific logger with DEBUG level: logger.kinesis.name=org.apache.flink.streaming....
Vadim Vararu's user avatar
2 votes
1 answer
194 views

Why are my log4j2-settings being ignored?

The log4j2.xml file is simple: <?xml version="1.0"?> <Configuration> <Appenders> <Console name="stderr" target="SYSTEM_ERR"> ...
Mikhail T.'s user avatar
  • 3,937

1
2 3 4 5
56