A firewall helps prevent unauthorized access to your computer and files. It controls the kind of traffic that tries to enter or leave your system. A firewall can also act as an effective tracing tool.
Most firewalls are capable of providing logs.
Compare a firewall to a burglar alarm in your home or place of business. If an intruder tries or is successful to get into your location via a window, for example, then your alarm may go off 'if' you have programmed or made provisions for that window to be monitored. Most firewall applications come pre-programmed to watch for the most common threats. In some cases, and locations, criminal charges may be brought against the intruder. Thus, making logging a key element in gathering evidence in the event of an intrusion.