Introduction
Error logging helps you find and fix problems in your scripts by saving error messages in a file or showing them clearly.
When you want to keep track of errors in a script running on a server.
When debugging a script that sometimes fails without clear messages.
When running automated tasks and you need to check what went wrong later.
When you want to separate normal output from error messages.
When you want to alert someone by logging errors to a file.