Module Syslog (developer)

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
Users
Numéro/ID du module 42
Doc utilisateur du module None
Doc développeur du module This page

Fonction du module

This module allows to enable technical logging into Dolibarr. Logging is used to save messages into log files :

  • Into a file
    • File will be by default DOL_DATA_ROOT/dolibarr.log (for example C:/dolibarr/documents/dolibarr.log).
    • You can change file name on the setup page of module.
  • Into systems logs (using syslog)

See module setup to choose.

PHP functions

Definition

To use loggin in your PHP coding, you must use the following function :

dol_syslog($message, $level = LOG_INFO)

This function is defined into file dolibarr/htdocs/lib/functions.lib.php

Parameters

  • $message : string with message to write into log file
  • $level : constant that define level of message. It can have following values:
    • On Windows server: LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=LOG_DEBUG=6
    • On Unix/Linux server : LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7
    • You can then set the level of messages you want to write, with the module setup page.

Notes

"Syslog functions are bugged with Windows et generates memory protection fault.

To solve this, use the file logging instead of syslog logging (see module setup page).

If SYSLOG_FILE_NO_ERROR is defined in your PHP code, no message will be output on screen when there is an error when writing the log message."

Source: documentation Doxygen

See also

Doxygen Documentation : [1]

En verysmall.png Page waiting to complete. To complete, create an account, go back and clic on "Modify".
Fr verysmall.png Page en attente d'être complété. Pour compléter, créez un compte, revenez et cliquez sur "Modifier".
Es verysmall.png Página a completar. Para completarla, cree una cuenta, vuelva a la página y haga clic en "editar"
De verysmall.png Seite wartet auf Vervollständigung. Um zu helfen, erstelle ein Konto, gehe zurück und klicke auf "Bearbeiten".
Cn verysmall.png 待完成,欲帮助完成,注册帐号,点击“编辑"
Jp verysmall.png ページは未完成の状態です。完成させるにはアカウントを作成し、ページに戻って「編集」をクリックして下さい。