php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51118 Allow multiple simultaneous syslog connections
Submitted: 2010-02-22 18:57 UTC Modified: 2011-10-09 14:14 UTC
Votes:9
Avg. Score:4.3 ± 0.9
Reproduced:5 of 5 (100.0%)
Same Version:2 (40.0%)
Same OS:2 (40.0%)
From: sylvain at abstraction dot fr Assigned: fat
Status: Wont fix Package: *General Issues
PHP Version: trunk OS: all
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-02-22 18:57 UTC] sylvain at abstraction dot fr
Description:
------------
the openlog function does not return a resource like would do the fopen or any database connection function.

That implementation limits to 1 the simultaneous number of connections possible to syslog and this is problematic when we aim to use syslog with different log locals.

Expected result:
----------------
$syslog_local0 = openlog('foo', LOG_NDELAY, LOG_LOCAL0);
syslog($syslog_local0, LOG_WARNING, "blah");

$syslog_local1 = openlog('bar', LOG_NDELAY, LOG_LOCAL1);
syslog($syslog_local1, LOG_WARNING, "blah blah");

closelog($syslog_local0);
closelog($syslog_local1);


Patches

php-syslog.v4.patch.txt (last revision 2011-07-05 13:31 UTC) by fat@php.net)
php-syslog.patch (last revision 2011-01-30 13:31 UTC) by fat@php.net)
php_syslog_multiple_context.patch (last revision 2011-01-29 13:02 UTC) by fat@php.net)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-23 05:23 UTC] fat@php.net
The following patch has been added/updated:

Patch Name: php_syslog_multiple_context.patch
Revision:   1279855421
URL:        http://bugs.php.net/patch-display.php?bug=51118&patch=php_syslog_multiple_context.patch&revision=1279855421
 [2010-07-23 05:30 UTC] fat@php.net
I just attached a patch which should do the trick. I don't know if it'll be 
accepted by the dev team who handle this part of PHP.

openlog() returns a ressource instead of a bool.

closelog() and syslog() have now a last and optional parameter: a context 
ressource.

Everything which was working before, should still work. The only change is the 
return value of openlog() which should be strictely compared (openlog(...) !== 
true).

here is a sample test script:

<?php
  syslog(LOG_ERR, "test 1 on ressource #0");
  // Jul 23 05:20:22 wild php: test 1 on ressource #0

  $r1 = openlog("test syslog #1", LOG_PID, LOG_SYSLOG);
  $r2 = openlog("test syslog #2", LOG_PID, LOG_SYSLOG);
  syslog(LOG_ERR, "test on ressource #1", $r1);
  // Jul 23 05:20:22 wild test syslog #1[24144]: test on ressource #1

  syslog(LOG_ERR, "test on ressource #2", $r2);
  // Jul 23 05:20:22 wild test syslog #2[24144]: test on ressource #2

  closelog($r1);
  closelog($r2);
  syslog(LOG_ERR, "test 2 on ressource #0");
  // Jul 23 05:20:22 wild php[24144]: test 2 on ressource #0

  openlog("test syslog #0", LOG_PID, LOG_SYSLOG);
  syslog(LOG_ERR, "test 3 on ressource #0");
  // Jul 23 05:20:22 wild test syslog #0[24144]: test 3 on ressource #0

  closelog();
  syslog(LOG_ERR, "test 4 on ressource #0");
  // Jul 23 05:20:22 wild php[24144]: test 4 on ressource #0
?>
 [2010-07-23 13:11 UTC] sylvain at abstraction dot fr
-Package: Feature/Change Request +Package: *General Issues
 [2010-07-23 13:11 UTC] sylvain at abstraction dot fr
Thank you very much for your time.

Hope it will be accepted in trunk.

Regards.
 [2011-01-29 14:02 UTC] fat@php.net
The following patch has been added/updated:

Patch Name: php_syslog_multiple_context.patch
Revision:   1296306149
URL:        http://bugs.php.net/patch-display.php?bug=51118&patch=php_syslog_multiple_context.patch&revision=1296306149
 [2011-01-29 14:03 UTC] fat@php.net
I've just updated the patch with a compliant trunk patch.
 [2011-01-30 11:58 UTC] fat@php.net
The following patch has been added/updated:

Patch Name: php-syslog.patch
Revision:   1296385081
URL:        http://bugs.php.net/patch-display.php?bug=51118&patch=php-syslog.patch&revision=1296385081
 [2011-01-30 11:58 UTC] fat@php.net
The patch php-syslog.v1.patch add multiple syslog connexion and enhancements of 
the syslog() PHP core functions.
 [2011-01-30 14:23 UTC] fat@php.net
The following patch has been added/updated:

Patch Name: php-syslog.patch
Revision:   1296393811
URL:        http://bugs.php.net/patch-display.php?bug=51118&patch=php-syslog.patch&revision=1296393811
 [2011-01-30 14:31 UTC] fat@php.net
The following patch has been added/updated:

Patch Name: php-syslog.patch
Revision:   1296394262
URL:        http://bugs.php.net/patch-display.php?bug=51118&patch=php-syslog.patch&revision=1296394262
 [2011-01-30 14:44 UTC] fat@php.net
-PHP Version: 5.2.12 +PHP Version: trunk
 [2011-01-30 14:44 UTC] fat@php.net
as it changes openlog,syslog,closelog prototype, it should be apply to trunk only
 [2011-06-03 15:41 UTC] sylvain at abstraction dot fr
Hi,

any news of that being included to the trunk ?
 [2011-07-05 09:31 UTC] fat@php.net
The following patch has been added/updated:

Patch Name: php-syslog.v4.patch.txt
Revision:   1309872692
URL:        https://bugs.php.net/patch-display.php?bug=51118&patch=php-syslog.v4.patch.txt&revision=1309872692
 [2011-07-05 09:32 UTC] fat@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: fat
 [2011-07-05 09:32 UTC] fat@php.net
-Status: Assigned +Status: Analyzed
 [2011-07-05 09:32 UTC] fat@php.net
a RFC has been written and will be submitted to internals very soon:

https://wiki.php.net/rfc/allow_multiple_simultaneous_syslog_connections
 [2011-07-05 09:54 UTC] fat@php.net
and it's been submitted to internals:

http://news.php.net/php.internals/53744
 [2011-10-09 14:14 UTC] fat@php.net
-Status: Analyzed +Status: Wont fix
 [2011-10-09 14:14 UTC] fat@php.net
no one seems to care. I'm dropping this.

sorry
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sun Apr 20 03:02:42 2014 UTC