Skip to content

Tag: log4j2

log4j custom appender stop method not getting called

I am trying to implement a custom log appender for log4j and will need to initialize some resources before start and cleanup at the end. Somehow my stop method will not be executed. I’ve tried using LogManager.shutdown(); but I cannot see my method getting called. This is my appender class: And this is …

Why Log4j2 doesn’t write logs to a file?

This is my configuration log4j2.xml with path to file – src/com/tarasiuk/task_01/log/dataLogger.log: Structure of my project: What I do: change path to log file from src/com/tarasiuk/task_01/log/dataLogger.log to com/tarasiuk/task_01/log/dataLogger.log – no result. change level in <Logger> f…

Disable logging from log4j 2 library, how?

I’m using log4j 2 for logging and want to turn off the log messages from the library itself, e.g.: I got the following in my log4j2.XML file but I still get DEBUG messages like the one above: This question is not a duplicate of Disabling Log4J Output in Java because I don’t want to turn off all ou…