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
mixed
The JLogEntry object to add to the log or the message for a new JLogEntry object.- $priority
integer
Message priority.- $category
string
Type of entry- $date
string
Date 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
array
Array of values to map to the format string for the log file.
Response
boolean
True on success.
addLogEntry
Method to add an entry to the appropriate loggers.
addLogEntry(\JLogEntry $entry) : void
since |
11.1 |
---|---|
throws |
|
Arguments
- $entry
\JLogEntry
The 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
array
The object configuration array.- $priorities
integer
Message priority- $categories
array
Types 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
integer
Message priority.- $category
string
Type of entry
Response
array
The 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
string
The filename of the log file.- $options
array
The object configuration array.- $path
string
The 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
\JLog
The 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