The Logging facade provided by the Lion Framework eases you to control the messages logged in your application.
However, it's important to note that Lion hasn't his own logging implementation since there are really excelents solutions out there. Instead of it, Lion brings a facade as an integrated way to manage logging.
By default, Lion framework is configured to use log4php, a logging framework for PHP currently undergoing incubation at the Apache Software Foundation, which support a lot of interesting logging capabilities.
However, the Logging facade has been designed to work against whatever logging framework, so we are not binding our application to a concrete implementation at all
Configuring the Logging facade
The lion.ini file (located as part of the lion distribution within the app/lion.ini file) has the following logging configuration by default:
...
;-------------------------------------
; LOGGING DIRECTIVES:
;-------------------------------------
LOG_ENABLED = yes
LOGGER_CLASS = "__Log4PhpLogger"
LOG4PHP_CONFIG_FILE = "config/log4php.properties"
...
We can enable or disable the cache by altering the value of LOG_ENABLED directive. Note that you can also point to whatever facade implementation by just setting the LOGGER_CLASS directive.
As soon as the default lion's logging facade work against log4php, we can configure it by setting the config_log4php.properties file.
By default, this file contains the following settings:
To learn more about log4php configuration, visit the log4php site.
This properties file set a default appender to log against the logs_error.log.
In the other hand, the logging level has been set to DEBUG, which means that everything will be logged within our application. However, we are able to setup the logging level as desired.
Logging facade API
Logging facade provides a main instance to log: The logger
To retrieve the default logger associated to our application context, we just need to call the __ContextContainer::getLogger() method: