Module Syslog (developer): Difference between revisions

No edit summary
m (Import interlang links (links to translated versions of this page in other languages) from Multi Language Manager table.)
 
(10 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 9: Line 15:
devdoc=This page|
devdoc=This page|
userdoc=None}}
userdoc=None}}


= Fonction du module =
= Fonction du module =


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


= Détails du module =
* 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)


Le logging permet d'enregistrer des messages de log :
See module setup to choose.


* Dans un fichier
= PHP functions =
** Le fichier par défaut sera '''DOL_DATA_ROOT/dolibarr.log''' (par exemple '''www.monsite.fr/dolibarr/documents/dolibarr.log''').
** Il est possible de changer le fichier d'enregistrement dans la page de configuration du module.
* Dans les logs PHP (avec la fonction syslog())


= Fonction PHP =
== Definition ==


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


<source lang="php">
<source lang="php">
Line 40: Line 37:
</source>
</source>


''Cette fonction est définie à la ligne 22 du fichier dolibarr/htdocs/lib/functions.lib.php''
''This function is defined into file dolibarr/htdocs/lib/functions.lib.php''
 
== Parameters ==


== Paramètres ==
* '''$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.


* '''$message''' : chaîne à enregistrer dans le fichier de log
= Notes =
* '''$level''' : constante permettant d'indiquer le niveau du message. Elle peut prendre les valeurs suivantes:
** Sur serveur Windows : 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
** Il est ensuite possible de configurer le niveau d'enregistrement des logs dans la page de configuration du module.


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


''"Les fonctions syslog sont bugguées sous Windows et genèrent des fautes de protection mémoire.''
''To solve this, use the file logging instead of syslog logging (see module setup page).  


''Pour resoudre, utiliser le loggage fichier, au lieu du loggage syslog (configuration du module). Si SYSLOG_FILE_NO_ERROR défini, on ne gère pas erreur é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]

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