Module Syslog (developer): Difference between revisions

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 12: Line 12:
= Fonction du module =
= Fonction du module =


Ce module permet d'activer la fonction de logging (journalisation) dans Dolibarr. Le logging permet d'enregistrer des messages de log :
This module allows to enable technical logging into Dolibarr. Logging is used to save messages into log files :


* Dans un fichier
* Into a file
** Le fichier par défaut sera '''DOL_DATA_ROOT/dolibarr.log''' (par exemple '''C:/dolibarr/documents/dolibarr.log''').
** File will be by default  '''DOL_DATA_ROOT/dolibarr.log''' (for example '''C:/dolibarr/documents/dolibarr.log''').
** Il est possible de changer le fichier d'enregistrement dans la page de configuration du module.
** You can change file name on the setup page of module.
* Dans les logs systemes (avec la fonction syslog())
* Into systems logs (using syslog)


Voir la configuration du module pour choisir.
See module setup to choose.


= Fonction PHP =
= PHP functions =


== Définition ==
== Definition ==


Pour utiliser le logging dans du code PHP, il faut utiliser la fonction suivante :
To use loggin in your PHP coding, you must use the following function :


<source lang="php">
<source lang="php">
Line 31: Line 31:
</source>
</source>


''Cette fonction est définie dans le fichier dolibarr/htdocs/lib/functions.lib.php''
''This function is defined into file dolibarr/htdocs/lib/functions.lib.php''


== Paramètres ==
== Parameters ==


* '''$message''' : chaîne à enregistrer dans le fichier de log
* '''$message''' : string with message to write into log file
* '''$level''' : constante permettant d'indiquer le niveau du message. Elle peut prendre les valeurs suivantes:
* '''$level''' : constant that define level of message. It can have following values:
** Sur serveur Windows : LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=LOG_DEBUG=6
** On Windows server: LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=LOG_DEBUG=6
** Sur serveur Unix : LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7
** On Unix/Linux server : LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7
** Il est ensuite possible de configurer le niveau d'enregistrement des logs dans la page de configuration du module.
** You can then set the level of messages you want to write, with the module setup page.


= Remarques =
= Notes =


''"Les fonctions syslog sont bugguées sous Windows et genèrent des fautes de protection mémoire.''
''"Syslog functions are bugged with Windows et generates memory protection fault.''


''Pour resoudre, utiliser le loggage fichier, au lieu du loggage syslog (configuration du module).  
''To solve this, use the file logging instead of syslog logging (see module setup page).  


Si SYSLOG_FILE_NO_ERROR est défini, on ne génère pas de message en cas d'erreur lors de l'écriture log."''
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
Source: documentation Doxygen


= Voir aussi =
= See also =


Documentation Doxygen : [http://www.dolibarr.fr/doxygen/d9/d69/functions_8lib_8php.html#a9862cc723ca3a2d05ef5723946cc9250]
Doxygen Documentation : [http://www.dolibarr.fr/doxygen/d9/d69/functions_8lib_8php.html#a9862cc723ca3a2d05ef5723946cc9250]


{{ToComplete}}
{{ToComplete}}

Revision as of 18:32, 31 March 2010

En verysmall.png Page waiting for translation. To translate, create an account, go back and clic on "Modify".
Fr verysmall.png Page en attente de traduction. Pour traduire, créez un compte, revenez et cliquez sur "Modifier".
Es verysmall.png Página a traducir. Para traducirla, cree una cuenta, vuelva a la página y haga clic en "editar".
It verysmall.png Pagina da tradurre. Per tradurla, crea un utente, torna indietro e clicca su "modifica".
Pt verysmall.png Página a aguardar por tradução. Para traduzir, crie uma conta, volte atrás e clique em "Modificar".
De verysmall.png Seite wartet auf Übersetzung. Um Übersetzung zu erstellen, richte einen Account ein, geh zurück und klicke auf "bearbeiten".
Zh verysmall.png 页面等待翻译。若要翻译本页,先创建一个帐户、登录并返回本页后单击“编辑”。

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 ページは未完成の状態です。完成させるにはアカウントを作成し、ページに戻って「編集」をクリックして下さい。