Hello,

Is there a way to get the properties from a log4j2 configuration file
programatically?

Like:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG" monitorInterval="10">

  <Properties>
    <Property name="kafkaHost">localhost:9092</Property>
  </Properties>

  ...
</Configuration>

I tried:

LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
ctx.getConfiguration().getProperties();

However, this only returns global properties like hostName and not the
custom ones I added to the configuration.

Thank you,

/David

Reply via email to