JLog
Joomla! Log Class
This class hooks into the global log configuration settings to allow for user configured logging events to be sent to where the user wishes them to be sent. On high load sites SysLog is probably the best (pure PHP function), then the text file based loggers (CSV, W3C or plain FormattedText) and finally MySQL offers the most features (e.g. rapid searching) but will incur a performance hit due to INSERT being issued.
| package |
Joomla.Platform |
|---|---|
| subpackage |
Log |
| since |
11.1 |
Methods
__construct
Constructor.
__construct()
| since |
11.1 |
|---|
add
Method to add an entry to the log.
add(mixed $entry, integer $priority = \JLog::INFO, string $category = '', string $date = null) : void
| since |
11.1 |
|---|
Arguments
- $entry
mixedThe JLogEntry object to add to the log or the message for a new JLogEntry object.- $priority
integerMessage priority.- $category
stringType of entry- $date
stringDate of entry (defaults to now if not specified or blank)
addEntry
Method to add an entry to the log file.
addEntry(array $entry) : boolean
| since |
11.1 |
|---|---|
| deprecated |
12.1 Use JLog::add() instead. |
Arguments
- $entry
arrayArray of values to map to the format string for the log file.
Response
booleanTrue on success.
addLogEntry
Method to add an entry to the appropriate loggers.
addLogEntry(\JLogEntry $entry) : void
| since |
11.1 |
|---|---|
| throws |
|
Arguments
- $entry
\JLogEntryThe JLogEntry object to send to the loggers.
addLogger
Method to set the way the JError will handle different error levels.
addLogger(array $options, integer $priorities = \JLog::ALL, array $categories = array()) : void
Use this if you want to override the default settings.
| since |
11.1 |
|---|
Arguments
- $options
arrayThe object configuration array.- $priorities
integerMessage priority- $categories
arrayTypes of entry
findLoggers
Method to find the loggers to use based on priority and category values.
findLoggers(integer $priority, string $category) : array
| since |
11.1 |
|---|
Arguments
- $priority
integerMessage priority.- $category
stringType of entry
Response
arrayThe array of loggers to use for the given priority and category values.
getInstance
Returns a JLog object for a given log file/configuration, only creating it if it doesn't already exist.
getInstance(string $file = 'error.php', array $options = null, string $path = null) : \JLog
This method must be invoked as:
$log = JLog::getInstance($file, $options, $path);
| since |
11.1 |
|---|---|
| deprecated |
12.1 |
Arguments
- $file
stringThe filename of the log file.- $options
arrayThe object configuration array.- $path
stringThe base path for the log file.
Response
setInstance
Returns a reference to the a JLog object, only creating it if it doesn't already exist.
setInstance(\JLog $instance) : void
Note: This is principally made available for testing and internal purposes.
| since |
11.1 |
|---|
Arguments
- $instance
\JLogThe logging object instance to be used by the static methods.
Constants
ALL
All log priorities.
| Value | 30719 |
|---|---|
| since |
11.1 |
Type(s)
integer
EMERGENCY
The system is unusable.
| Value | 1 |
|---|---|
| since |
11.1 |
Type(s)
integer
ALERT
Action must be taken immediately.
| Value | 2 |
|---|---|
| since |
11.1 |
Type(s)
integer
CRITICAL
Critical conditions.
| Value | 4 |
|---|---|
| since |
11.1 |
Type(s)
integer
ERROR
Error conditions.
| Value | 8 |
|---|---|
| since |
11.1 |
Type(s)
integer
WARNING
Warning conditions.
| Value | 16 |
|---|---|
| since |
11.1 |
Type(s)
integer
NOTICE
Normal, but significant condition.
| Value | 32 |
|---|---|
| since |
11.1 |
Type(s)
integer
INFO
Informational message.
| Value | 64 |
|---|---|
| since |
11.1 |
Type(s)
integer
DEBUG
Debugging message.
| Value | 128 |
|---|---|
| since |
11.1 |
Type(s)
integer
Properties
legacy
The array of instances created through the deprecated getInstance method.
configurations
Container for JLogger configurations.
| since |
11.1 |
|---|
Type(s)
array
loggers
Container for JLogger objects.
| since |
11.1 |
|---|
Type(s)
array
lookup
Lookup array for loggers.
| since |
11.1 |
|---|
Type(s)
array