Home » Logging » Log » Bug #3931
PEAR_LOG_DEBUG messages are not handled with syslog handler
Details
| Submitted | 2005-03-23 14:34 UTC |
|---|---|
| From | e dot grammatico at online dot fr |
| Assigned | jon |
| Status | Closed |
| Package | Log |
| PHP Version | 5.0.3 |
| OS | 2.6.10-1.737_FC3 |
| Roadmaps | (Not assigned) |
Comments
[2005-03-23 14:34 UTC] e dot grammatico at online dot fr
Description:
------------
At DEBUG level, I didnt find any way to have the PEAR_LOG_DEBUG messages handled by the syslog handler. The same code is working perfectly with other handlers, but syslog handler just ignore PEAR_LOG_DEBUG message
Reproduce code:
---------------
<?php
define ("STDOUT", fopen('php://stdout', 'a'));
require_once 'Log.php';
echo "Displaying different log levels available:<br/>\n";
echo "Emergency level is: " . PEAR_LOG_EMERG . "<br/>\n";
echo "Alert level is: " . PEAR_LOG_ALERT . "<br/>\n";
echo "Critical level is: " . PEAR_LOG_CRIT . "<br/>\n";
echo "Error level is: " . PEAR_LOG_ERR . "<br/>\n";
echo "Warning level is: " . PEAR_LOG_WARNING . "<br/>\n";
echo "Notice level is: " . PEAR_LOG_NOTICE . "<br/>\n";
echo "Info level is: " . PEAR_LOG_INFO . "<br/>\n";
echo "Debug level is: " . PEAR_LOG_DEBUG . "<br/>\n";
// =-=-=-=-=-=-=-=-=-=
// | CONSOLE EXAMPLE |
// =-=-=-=-=-=-=-=-=-=
echo "Creating a log on console and changing log level on the fly<br/>\n";
$logger = &Log::factory('console', '', 'identifier', NULL, PEAR_LOG_NOTICE);
$logger->notice("A message at notice level. Must be displayed.");
$logger->debug("This should not appear in the logs");
$logger->notice("Changing log level to debug");
// ==============================================================
// | Why is this code not working ? Have to use setMask instead |
// | This changes log level (visible with method getPriority) |
// | but debug messages are not displayed |
// ==============================================================
//$logger->setPriority(PEAR_LOG_DEBUG);
$logger->setMask(Log::UPTO(PEAR_LOG_DEBUG));
$logger->debug("This message, at debug level, must be visible.");
$logger->info("This message, at info level, must also be visible");
// =-=-=-=-=-=-=-=-=
// | FILE EXAMPLE |
// =-=-=-=-=-=-=-=-=
echo "Creating a log on syslog and changing log level on the fly<br/>\n";
$logger = &Log::factory('file', 'testLogging.log', 'logTester', NULL, PEAR_LOG_NOTICE);
$logger->notice("A message at notice level. Must be displayed.");
$logger->debug("This should not appear in the logs");
$logger->notice("Changing log level to debug");
// ==============================================================
// | Why is this code not working ? Have to use setMask instead |
// | This changes log level (visible with method getPriority) |
// | but debug messages are not displayed |
// ==============================================================
//$logger->setPriority(PEAR_LOG_DEBUG);
$logger->setMask(Log::UPTO(PEAR_LOG_DEBUG));
$logger->debug("This message, at debug level, must be visible.");
$logger->info("This message, at info level, must also be visible");
// =-=-=-=-=-=-=-=-=-=
// | SYSLOG EXAMPLE |
// =-=-=-=-=-=-=-=-=-=
echo "Creating a log on syslog and changing log level on the fly<br/>\n";
$logger = &Log::factory('syslog', '', 'identifier', NULL, PEAR_LOG_NOTICE);
$logger->notice("A message at notice level. Must be displayed.");
$logger->debug("This should not appear in the logs");
$logger->notice("Changing log level to debug");
// ==============================================================
// | Why is this code not working ? Have to use setMask instead |
// | This changes log level (visible with method getPriority) |
// | but debug messages are not displayed |
// ==============================================================
//$logger->setPriority(PEAR_LOG_DEBUG);
$logger->setMask(Log::UPTO(PEAR_LOG_DEBUG));
// !! The following message is not displayed only with syslog !!
$logger->debug("This message, at debug level, must be visible.");
$logger->info("This message, at info level, must also be visible");
?>
Expected result:
----------------
PEAR_LOG_DEBUG messages are not available in syslog at DEBUG level.
Actual result:
--------------
PEAR_LOG_DEBUG messages should be available in syslog at DEBUG level.
[2005-03-23 14:39 UTC] e dot grammatico at online dot fr
Sorry, 'Expected result' and 'Actual result' should be exchanged.....
[2005-03-29 08:18 UTC] e dot grammatico at online dot fr
Thanks Jon. You made the point !
Sorry for that.
Eric.