There are two ways to log any password – I do not see any problem with either of them.
1. Not log any password, just log the user.
2. Log '******' against the password. logger.info("User=" + user + "logged with Password=******");
Do we have any best practices for these situations?
What is the point of logging ‘******’ in the log? It’s just extra text that takes up space and doesn’t provide any information. Just leave it out.