The Java agent uses a relocated (shadowed) packages for some libraries so it does not conflict with the application's dependencies. Log4J is one of these dependencies.
But the contents of the file log4j2.component.properties will be used to configure the agent's loggers. The contents of this file are read in PropertiesUtil.LOG4J_PROPERTIES. PropertyUtil does not seem to have a way to remove properties. So it will likely be needed to use reflection to get the private final Environment environment field and clear the collections inside of it. To make it more complicated, Environment is a private class.
It was not verified, but it is possible that the contents of log4j2.system.properties will also be used by the agent. But depending on how the environment is cleaned, it may also remove the contents of this file.
Acceptance Criteria
The contents of that file are not used to configure the agent's loggers, but will still be used to configure the application's loggers.
Description
The Java agent uses a relocated (shadowed) packages for some libraries so it does not conflict with the application's dependencies. Log4J is one of these dependencies.
To prevent the customer's Log4J configuration from applying some steps are taken, such as temporarily removing system properties.
But the contents of the file
log4j2.component.properties
will be used to configure the agent's loggers. The contents of this file are read inPropertiesUtil.LOG4J_PROPERTIES
.PropertyUtil
does not seem to have a way to remove properties. So it will likely be needed to use reflection to get theprivate final Environment environment
field and clear the collections inside of it. To make it more complicated,Environment
is a private class.It was not verified, but it is possible that the contents of
log4j2.system.properties
will also be used by the agent. But depending on how theenvironment
is cleaned, it may also remove the contents of this file.Acceptance Criteria
The contents of that file are not used to configure the agent's loggers, but will still be used to configure the application's loggers.