Wednesday, June 26, 2013

CakeLog and scope : Restricting scope to only one logger

Hi

I'd like to set a up log file so that only messages with a scope of soap get logged to that file.  Conversely, I'd also like to prevent messages with a scope of soap being logged against the default logs of debug and error.

Here is my current setup in bootstrap.php.

CakeLog::config('soap', array(
'engine' => 'FileLog',
'types' => array('info','debug','error'),
'scopes' => array('soap'),
'file' => 'soap'
));

CakeLog::config('debug', array(
'engine' => 'FileLog',
'types' => array('notice', 'info', 'debug'),
'file' => 'debug',
));
CakeLog::config('error', array(
'engine' => 'FileLog',
'types' => array('warning', 'error', 'critical', 'alert', 'emergency'),
'file' => 'error',
));

Here is a snippet from one of my libs that makes soap calls.

CakeLog::debug("REQUEST:\n" . $client->__getLastRequest() . "\n", 'soap');
CakeLog::debug("RESPONSE:\n" . $client->__getLastResponse() . "\n", 'soap');

} catch (SoapFault $e) {
CakeLog::error(print_r($result,true), 'soap');
CakeLog::error('Exception: (' . $e->getCode() . ') ' . $e->getMessage(), 'soap');
if (isset($client)) {
CakeLog::error("Errored REQUEST:\n" . print_r($client->__getLastRequest(), true) . "\n", 'soap');
}

When I do this current set up, I get the debug soap messages in debug.log and soap.log, which is not desirable.


Regards
Reuben Helms

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: