Tutorials: Logging

Setting Loggers

In order to be able to log messages later on, you first need to open stdout.xml and make sure this tag exists within <listeners>:

<listener class="LoggingListener"/>

then create a <logger> tag (which will hold your logger settings), child of DEVELOPMENT_ENVIRONMENT tag (because logging policies may be different on another environment), child of <loggers> tag. Example:

<loggers> <local> <logger class="FileLoggerWrapper" path="C:\xampp\htdocs\messages" format="%d %f %l %m"/> ... </local> </loggers>

This configures logging into a C:\xampp\htdocs\messages.log file for local DEVELOPMENT_ENVIRONMENT. To learn more how to configure this tag, check official documentation!

Log line can be formatted via format attribute above based on a combination of following placeholders:

Logging Messages

After you have completed Setting Loggers section described above, you are now able to log messages. To log a message, simply use logger attribute defined by framework, which holds a Lucinda\Logging\Logger instance. Example:


Assuming logger matched in XML points to a Lucinda\Logging\FileLogger:

<logger class="FileLoggerWrapper" path="messages" format="%d %f %l %m"/>

Then in file messages.log found in your site root a new line is appended:


For more information about further options logging foundation used by framework, check official documentation!