Product SiteDocumentation Site

2.8. The Log Package

2.8.1. Introduction

The Joomla Platform includes a Log package that allows for configurable, hook-driven logging to a variety of formats.
The classes included in the Log package are JLog, JLogEntry, LogException, JLogger as well as the classes JLoggerDatabase, JLoggerEcho, JLoggerFormattedText, JLoggerMessageQueue, JLoggerSyslog and JLoggerW3C which support formatting and storage. Of all these classes, you will generally only use JLog in your projects.
Logging is a two-step process.
First you must add the add loggers to listen for log messages. Any number of loggers can be configured to listen for log messages based on a priority and a category. For example, you can configure all log messages to be logged to the database, but also set just errors to be logged to a file. To do this, you use the JLog::addLogger method.
After at least one logger is configured, you can then add messages using the JLog::addLogEntry method where you can specify a message, and optionally a priority (integer), category (string) and date.