Category: Software, Data

In the case where you are dealing with sensitive data in your application, it is difficult to mask at the code level because so many of the libraries log data that you do not have control over the message input. What Log4j offers is a way to intercept the data before it logs it to a file by creating a Rewrite Policy.

In this example; When you run your application you will notice that the logger is intercepted after it writes to the console and before it writes to the log file.

Therefore it is better to leave it as just the Rolling File Appender so that no sensitive data is persisted and the console stays legible.

Related Articles