Why is logging and monitoring essential for web application security? Discuss how logging and real-time monitoring of web application activities can help detect security incidents early, identify unusual behavior, and respond to attacks effectively. Mention tools and techniques used for secure logging and alerting.