We have a method which we use to log java exceptions in a log file. The method allows the caller to pass variables they wish to be shown in the log message for debugging purposes and uses inserts blank lines and tabs to make the message stand out and be more readable.
However, all of the recommendations I see to prevent Log Forging attacks recommend stripping all of the CRLF's out of the logging message.
Is it considered bad practice to have CRLF's in a logging message? This method is only used internally and any user supplied information can be sanitized before being passed to the method.
generally - yes.
while this seems a nice feature at first glance, you should consider the following potential complications: