Each module can have its own Apache Log4j properties file.
Each module can have its own log4j2.properties file, which is placed in the same directory as the module.properties file. The collection of log4j2.properties files within all modules installed into the alfresco.war act collectively to augment/override the global WEB-INF/classes/log4j2.properties file.
You can control the logging levels of classes within your module without having to modify the main log4j2.properties file; this also allows the logging configuration of a module to be handled cleanly by the Module Management Tool.
Given that {module.id} denotes the value of module.id set in module.properties, your log4j2.properties file should be put in the following position within the source code directory structure of your module:
config/alfresco/module/{module.id}/log4j2.properties
At deployment time, this file will be copied to:
WEB-INF/classes/alfresco/module/{module.id}/log4j2.properties
For example, if module.id=sample, then in the module’s source tree you’ll have:
config/alfresco/module/sample/log4j2.properties
On the servlet container, your module’s log4j2.properties file will be deployed to:
WEB-INF/classes/alfresco/module/sample/log4j2.properties
If you wish to configure Log4j properties in the extensions that aren’t packaged as AMP modules (for example, as JAR modules), you can create log4j2.properties file of the form: {name}-log4j2.properties and place it within the alfresco/extension directory on the server’s classpath. These properties override the module log4j2.properties files. For example:
WEB-INF/classes/alfresco/extension/SIMPLE_EXAMPLE-log4j2.properties
Finally, developers might also wish to maintain a dev-log4j2.properties file outside of the webapp. This allows for changing Log4j settings without touching the “shipping product”, or any of a customer’s local settings. Your optional dev-log4j2.properties file should be in the alfresco/extension directory within the server’s classpath, and outside the webapp itself (so you don’t accidentally delete it).
The dev-log4j2.properties file augments/overrides all others. For example:
$TOMCAT_HOME/shared/classes/alfresco/extension/dev-log4j2.properties