Steps to build the project
- Assemble the project using "mvn assembly:assembly"
Steps to reproduce the issue. Execute the following commands
-
cd target
-
Try running the main class by executing "java -cp .:./tesl4j-1.0-jar-with-dependencies.jar com.main.App"
-
The output should be displayed as
2018-05-08 11:49:32,583 [main] DEBUG org.cloudera.LogMessage1 - From pkg1.LogMessage1 : Mask PASSWORD(ABCD) 2018-05-08 11:49:32,584 [main] DEBUG org.example.LogMessage2 - From pkg2.LogMessage2 : Mask PASSWORD(ABCD)
-
The password ABCD is not masked.
-
Edit the log4j.properties file and uncomment the line number 10 to apply the redactor appenders MASK_PASSWORDS_CONSOLE and MASK_PASSWORDS_FILE to the package com.test.example
log4j.logger.com.test.example=DEBUG, MASK_PASSWORDS_CONSOLE, MASK_PASSWORDS_FILE
-
Save the file and run the main class again by executing "java -cp .:./testl4j.jar com.main.App"
-
The password is now masked but for both the packages when we have specified it for just one.