Attention

TYPO3 v10 has reached end-of-life as of April 30th 2023 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.

Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v10 here: TYPO3 ELTS.

System Log

Warning

A new logging API was introduced in TYPO3 CMS 6.0. It should be used by extension authors starting with TYPO3 v9 LTS. The following section is here as legacy reference, but should not be used in installations with TYPO3 >= 9.

Writing to the system log is done using the backend user object, which writes to the "sys_log" table:

$this->BE_USER->writelog($type, $action, $error, $details_nr, $details, $data, $table, $recuid, $recpid,$event_pid, $NEWid);

Here is a description of the arguments to this function call, and corresponding database fields in table "sys_log":

Field

Type

Var

Description

type

tinyint

$type

Value telling which module in TYPO3 set the log entry. The type values are paired with an action-integer which is telling in more detail what the event was. Here type and action values are arranged hierarchically (type on first level, action on second level):


  • 1 : \TYPO3\CMS\Core\DataHandling\DataHandler ("TYPO3 Core Engine" where database records are manipulated)

    • Action values are:

      • 0 = no category

      • 1 = new record

      • 2 = update record

      • 3 = delete record

      • 4 = move record

      • 5 = check/evaluate

  • 2 : "tce_file" (File handling in fileadmin/ and absolute filemounts)

    • Action values are for various file handling types like upload, rename, edit etc.

  • 3 : System (e.g. sys_history save)

  • 4 : Modules: This is the mode you may use for extensions having backend module functionality. Probably you would like to use BE_USER->writelog() for your extensions.

  • 254 : Personal settings changed

  • 255 : Login or Logout action

    • 1 = login

    • 2 = logout

    • 3 = failed login (+ errorcode 3)

    • 4 = failure_warning_email sent

action

tinyint

$action

See "type" above

When not available, use value "0"

error

tinyint

$error

Error level:

  • 0 = message, a notice of an action that happened.

  • 1 = error, typically a permission problem for the user

  • 2 = System Error, something which should not happen for technical reasons.

  • 3 = Security notice, like login failures

details_nr

tinyint

$details_nr

Number of "detail" message. This number should be unique for the combination of type/action

-1 is a temporary detail number you can use while developing and error messages are not fixed yet.

0 is a value that means the message is not supposed to be translated

>= 1 means the message is fixed and ready for translation.

details

tinytext

$details

The log message text (in english). By identification through type/action/details_nr this can be translated through the localization system.

If you insert "%s" markers in the details message and set $data to an array the first 5 entries (keys 0-4) from $data will substitute the markers sequentially (using sprintf).

log_data

tinyblob

$data

Data that follows the log entry. Can be an array. See "details" for more info.

tablename

varchar(40)

$table

Table name. Special field used by tce_main.php.

recuid

int

$recuid

Record UID. Special field used by tce_main.php.

recpid

int

$recpid

Record PID. Special field used by tce_main.php. [OBSOLETE; not used anymore.]

event_pid

int

$event_pid

The page ID (pid) where the event occurred. Used to select log-content for specific pages.

NEWid

varchar(20)

$NEWid

Special field used by tce_main.php. NEWid string of newly created records.

tstamp

int

-

EXEC_TIME of event, UNIX time in seconds.

uid

int

-

Unique ID for log entry, automatically inserted

userid

int

-

User ID of backend user, automatically set for you

IP

varchar(39)

-

REMOTE_ADDR of client

workspace

int

-

Workspace ID