php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #58965 Possibility to disable stderr logging from my_log
Submitted: 2009-11-25 15:05 UTC Modified: 2010-06-18 16:14 UTC
From: mkoppanen@php.net Assigned:
Status: Closed Package: APC (PECL)
PHP Version: Trunk SVN-2009-11-25 (dev) OS: Any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mkoppanen@php.net
New email:
PHP Version: OS:

 

 [2009-11-25 15:05 UTC] mkoppanen@php.net
Description:
------------
Hello,

the patch against trunk is here:

http://valokuva.org/~mikko/patches/apc_disable_output.patch.txt



Reproduce code:
---------------
<?php

apc_store("hello", 1);
apc_store("hello", 2);

?>

Expected result:
----------------
With apc.disable_output=On this would not generate output.

Actual result:
--------------
[Wed Nov 25 20:04:53 2009] [apc-warning] Potential cache slam averted for key 'hello' in Command line code on line 1.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-12 23:52 UTC] shire@php.net
Gopal: should we just move this to a #ifdef _APC_DEBUG_?

Alternatively perhaps we should add an APC debugging level would be easy to integrate this into our apc_xprint functions.  Or perhaps it should just match that of the corresponding PHP error level?

Also do you really run into a case where you're flooded with these messages ie: you're doing multiple stores on the same value repeatedly?
 [2009-12-13 07:39 UTC] mkoppanen@php.net
There are code paths in some of the code that tends to generate quite a lot of apc-warnings. First it was 'realpath failed to canonicalize' and after upgrade I am seeing the cache slam warning. 

As it seems that some of the code seems to generate different warnings (and tons of logs) after upgrade I would like to disable these just all together if possible. 

Is there a reason why the apc errors don't go through the standard error reporting mechanism? Something like:

http://valokuva.org/~mikko/apc_error_levels_v2.patch.txt

with ability to disable apc-warnings/notices all together would be ideal solution in my case. One thing I didn't quite understand is that why does my_log fflushes stdout?
 [2010-01-11 03:46 UTC] marc dot bennewitz at giata dot de
Yes this would not only very nice to disable apc-error messages. Than I could check last error message and generate a better exception message in my code like the following:

if (!@apc_store('test', 1)) {
    $lastErr = error_get_last();
    throw new Exception('Can\'t store apc key "test": ' . $lastErr['message']);
}
 [2010-06-16 11:36 UTC] parf at comfi dot com
Such patches should not be accepted.
Disabling error output to hide bug is a very bad practice.

This 
apc_store("hello", 1);
..
apc_store("hello", 2);

must work in the first place (unless you are out of memory)
 [2010-06-16 11:40 UTC] rasmus@php.net
The APC user cache was not designed for short expiry entries 
like that.  So one fix would be to simply restrict apc_store() 
from setting a ttl of anything under 5 minutes.
 [2010-06-18 16:14 UTC] gopalv82 at yahoo dot com
Moved all error reporting to use php_verror (zend error reporting).

You won't see notices or warnings depending on error_reporting flags.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 15:01:34 2025 UTC