Relative Content

Tag Archive for javalog4j2

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 they are correctly positioned and annotated.
I did this in principle in order to add masking to the logs, but so far I can’t even test whether it works or not

How to output info, warn to console and output error to file in log4j2?

I’m trying to figure out how to configure Log4J2 so that I can direct, say INFO and WARN level messages to the console, while directing ERROR level messages to a file. (For a stretch goal, I might want to direct DEBUG level messages to another file.) I’ve found some posts that gave variations of using ThresholdFilter, but that didn’t seem to work. I couldn’t figure out what it was doing when I made a tweak to the config.

How to output info, warn to console and output error to file in log4j2?

I’m trying to figure out how to configure Log4J2 so that I can direct, say INFO and WARN level messages to the console, while directing ERROR level messages to a file. (For a stretch goal, I might want to direct DEBUG level messages to another file.) I’ve found some posts that gave variations of using ThresholdFilter, but that didn’t seem to work. I couldn’t figure out what it was doing when I made a tweak to the config.

Log4j2, explicitly load Properties configuration file from specific location – not XML

I would like to have Log4j2 load the configuration (.properties) file I explicitly give to it. I can not find examples to do this that actually work and are for v2 and are for .properties files. It’s puzzling that with all the serious vulnerabilities that hit this module, it still insists on the philosophy of “just throw the configuration file in your classpath and we will find&load it.”. What if I have two configuration files with different extensions (xml, json, yaml, properties)? Even this Apache tutorial https://logging.apache.org/log4j/2.x/manual/configuration.html does not mention a solution to my reasonable, justified above, demand.