Difference between revisions of "Module Syslog (developer)"

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
m
m (Import interlang links (links to translated versions of this page in other languages) from Multi Language Manager table.)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
<!-- BEGIN origin interlang links -->
 +
<!-- You can edit this section but do NOT remove these comments
 +
    Links below will be automatically replicated on translated pages by PolyglotBot -->
 +
[[es:Módulo_Syslog_(desarrollador)]]
 +
[[fr:Module_Syslog_(développeur)]]
 +
<!-- END interlang links -->
 +
 
[[Category:Syslog]]
 
[[Category:Syslog]]
[[Category:List of Modules]]
+
[[Category:List of Modules (developer)‎]]
{{ToTranslate}}
 
 
{{TemplateDocDevEn}}
 
{{TemplateDocDevEn}}
{{TemplateModEN}}
+
{{TemplateModEN Developer}}
 
{{BasculeDevUser|
 
{{BasculeDevUser|
 
nom=Users|
 
nom=Users|
Line 12: Line 18:
 
= 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 37:
 
</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}}

Latest revision as of 13:21, 23 July 2019

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