diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index dd618161aa27bbabaa13a9edc4bebf917cb88518..df7fc6fd2af2fd10982b5f299e8735c17f894359 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -1,5 +1,5 @@ <?php -/* Copyright (C) 2005-2007 Laurent Destailleur <eldy@users.sourceforge.net> +/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> * * This program is free software; you can redistribute it and/or modify @@ -52,8 +52,6 @@ if ($_POST["action"] == 'set') dolibarr_del_const($db,"SYSLOG_FILE"); dolibarr_set_const($db,"SYSLOG_FACILITY",$_POST["facility"]); dolibarr_syslog("admin/syslog: facility ".$_POST["facility"]); - Header("Location: syslog.php"); - exit; } else { @@ -89,6 +87,7 @@ $def = array(); $syslogfacility=$defaultsyslogfacility=dolibarr_get_const($db,"SYSLOG_FACILITY"); $syslogfile=$defaultsyslogfile=dolibarr_get_const($db,"SYSLOG_FILE"); + if (! $defaultsyslogfacility) $defaultsyslogfacility='LOG_USER'; if (! $defaultsyslogfile) $defaultsyslogfile='dolibarr.log'; diff --git a/htdocs/includes/modules/modSyslog.class.php b/htdocs/includes/modules/modSyslog.class.php index 09bc063147480f5e706e9e482dae27831df3e346..ebd3598480ba0cc056e76dd623c413d7a5cab621 100644 --- a/htdocs/includes/modules/modSyslog.class.php +++ b/htdocs/includes/modules/modSyslog.class.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,13 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ */ /** \defgroup syslog Module syslog - \brief Module pour g�rer les messages d'erreur dans syslog + \brief Module pour gerer les messages d'erreur dans syslog */ /** diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index f69e16c8b968b4a2e696199a6bb2a8e24c180133..4e90a20a02d531b25f4688f9c4a2b84be30f06a9 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -151,8 +151,10 @@ function dolibarr_syslog($message, $level=LOG_INFO) if (defined("SYSLOG_FILE") && SYSLOG_FILE) { - if (defined("SYSLOG_FILE_NO_ERROR")) $file=@fopen(SYSLOG_FILE,"a+"); - else $file=fopen(SYSLOG_FILE,"a+"); + $filelog=SYSLOG_FILE; + $filelog=eregi_replace('DOL_DATA_ROOT',DOL_DATA_ROOT,$filelog); + if (defined("SYSLOG_FILE_NO_ERROR")) $file=@fopen($filelog,"a+"); + else $file=fopen($filelog,"a+"); if ($file) { $ip='unknown_ip'; @@ -178,7 +180,7 @@ function dolibarr_syslog($message, $level=LOG_INFO) elseif (! defined("SYSLOG_FILE_NO_ERROR")) { $langs->load("main"); - print $langs->trans("ErrorFailedToOpenFile",SYSLOG_FILE); + print $langs->trans("ErrorFailedToOpenFile",$filelog); } } else diff --git a/mysql/data/data.sql b/mysql/data/data.sql index 087b09092c81a823fc49ea58edca3e0fc3ba3d25..5e1978eaa2a077a4b129a17347cbe853a1cf459e 100644 --- a/mysql/data/data.sql +++ b/mysql/data/data.sql @@ -60,6 +60,7 @@ insert into llx_const (name, value, type, note, visible) values ('MAIN_NOT_INSTA insert into llx_const (name, value, type, note, visible) values ('MAIN_MONNAIE','EUR','chaine','Monnaie',0); insert into llx_const (name, value, type, note, visible) values ('MAIN_POPUP_CALENDAR','eldy','chaine','Popup calendar module',0); +insert into llx_const(name,value,type,visible,note) values('SYSLOG_FILE','DOL_DATA_ROOT/dolibarr.log','chaine',0,'Directory where to write log file'); insert into llx_const(name,value,type,visible,note) values('SYSLOG_LEVEL','6','chaine',0,'Level of debug info to show'); insert into llx_const (name, value, type, note, visible) values ('MAIN_MAIL_SMTP_SERVER','','chaine','Host or ip address for SMTP server',0);