Login / Status
developer.Resource
Home . Documentation . Document Library . Extension Manuals
Sponsors
hosted by punkt.deTYPO3 and Open Source MagazineAOE Media

1.3. User manual

Using the logging method

To log something simply call t3lib_div::devLog(). This method takes the following parameters:

Parameter

Information

$msg

The message that you want to write to the log

$extKey

The key of the extension writing to the log

$severity

Indication of the severity of the message. The following values are expected:

  1. -1 for ok status

  2. 0 for a purely informational message

  3. 1 for a notice

  4. 2 for a warning

  5. 3 for a (fatal) error

This parameter is optional and defaults to 0.

$dataVar

This is an array that can contain any data you wish and that you find useful for information or debugging purposes. It is serialised before being stored in the database. In the backend module it is unserialised and displayed as with t3lib_div::debug().

This parameter is optional and defaults to false.

Backend module

The backend module provides a way to visualise the entries generated by calls to t3lib_div::devLog() (see screenshot above) and to clean up those entries. The function menu (1) gives access to those two main views.

1) Show log

This screen can be used to filter and browse through the log entries. Many functions are available. First of all, you can choose which entries you want to display (1). This can be either the latest log run or any of the older ones, but also all entries or some of the latest (25, 50 or 100). Checking the “Expand all extra data” box (3) will force the module to automatically display all the extra data, rather than having to expand them one by one.

The screen to automatically refresh itself (2), which it then does at an interval of 2 seconds. In conjunction with this autorefresh feature, the screen can be opened in a new window (4).

The log view (below) itself offers several more options. By clicking on the uid of a log entry (1), you can set a filter to display only the log run this entry belongs to. You can also click on the (+) icon to get a view of the deserialised extra data (4). This is displayed inline using JavaScript.

When viewing all entries you get yet more options. First of all results are paginated (25 entries a page) and you can navigate through them using the page browser (2). What's more various filters (3) are available to select entries based on severity or extension key.

Additionally when viewing a single log run, you get a log run browser (1) to move to the latest, next, previous or oldest log run available (always within the limits of the maximum number of log runs).

2) Clean up

This screen allows to delete log entries which can quickly accumulate. You can choose to clear entries for a given extension or if they are older than a given period of time. Alternately you can simply decide to trash them all... When the clean up is done, you get informed on how many entries were deleted.