PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

Logging best practices

Note: This article was originally published at Planet PHP on 4 March 2012.
Planet PHP

Introduction

This document explains some best practices for application error/debug logging. Application logging is an important "tool" to help identifying problems. If done correctly, and if an infrastructure is in place that allows events to be put into context, it's easier to debug situations and thus makes it easier to solve problems sooner.

While out of scope for this document, I'd like to point out the following tools that can make that possible:

A

Different logging meanings

Logging can mean different things and logging can have different purposes. The logging this document refers to is application and semantic logging.

Application logging (also called "debug" or "error" logging) is intended to keep track of the "low level" application behaviour. Application logging is used to log events, that allows for debugging a problem within an application or to monitor application health. In contrast, a different form of logging could for example be Google Analytics. Tracking (or "logging" actions of) visitors of a website, this type of logging is very different and not something this document refers too.

Why do we log

In order to understand how to log, it must first be clear what we try to accomplish with application logging.


Continue reading "Logging best practices"