Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F118010830
D4430.1775557067.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D4430.1775557067.diff
View Options
diff --git a/lib/ext/Syncroton/Server.php b/lib/ext/Syncroton/Server.php
--- a/lib/ext/Syncroton/Server.php
+++ b/lib/ext/Syncroton/Server.php
@@ -123,8 +123,7 @@
$decoder = new Syncroton_Wbxml_Decoder($this->_body);
$requestBody = $decoder->decode();
if ($this->_logger instanceof Zend_Log) {
- $requestBody->formatOutput = true;
- $this->_logger->debug(__METHOD__ . '::' . __LINE__ . " xml request:\n" . $requestBody->saveXML());
+ $this->_logDomDocument($requestBody, 'request', __METHOD__, __LINE__);
}
} catch(Syncroton_Wbxml_Exception_UnexpectedEndOfFile $e) {
$requestBody = NULL;
@@ -174,7 +173,7 @@
if ($response instanceof DOMDocument) {
if ($this->_logger instanceof Zend_Log) {
- $this->_logDomDocument(Zend_Log::DEBUG, $response, __METHOD__, __LINE__);
+ $this->_logDomDocument($response, 'response', __METHOD__, __LINE__);
}
if (isset($command) && $command instanceof Syncroton_Command_ICommand) {
@@ -244,13 +243,17 @@
/**
* write (possible big) DOMDocument in smaller chunks to log file
*
- * @param int $priority
* @param DOMDocument $dom
+ * @param string $action
* @param string $method
* @param int $line
*/
- protected function _logDomDocument($priority, DOMDocument $dom, $method, $line)
+ protected function _logDomDocument(DOMDocument $dom, $action, $method, $line)
{
+ if (method_exists($this->_logger, 'hasDebug') && !$this->_logger->hasDebug()) {
+ return;
+ }
+
$tempStream = tmpfile();
$meta_data = stream_get_meta_data($tempStream);
@@ -264,7 +267,7 @@
$loops = 0;
while (!feof($tempStream)) {
- $this->_logger->log($method . '::' . $line . " xml response($loops):\n" . fread($tempStream, 1048576), $priority);
+ $this->_logger->debug("{$method}::{$line} xml {$action} ({$loops}):\n" . fread($tempStream, 1048576));
$loops++;
}
diff --git a/lib/kolab_sync_logger.php b/lib/kolab_sync_logger.php
--- a/lib/kolab_sync_logger.php
+++ b/lib/kolab_sync_logger.php
@@ -58,6 +58,17 @@
}
}
+ /**
+ * Check whether debug logging is enabled
+ *
+ * @return bool
+ */
+ public function hasDebug()
+ {
+ // This is what we check in self::log() below
+ return !empty($this->log_dir) && $this->mode >= self::NOTICE;
+ }
+
/**
* Message logger
*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 7, 10:17 AM (7 h, 26 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18842174
Default Alt Text
D4430.1775557067.diff (2 KB)
Attached To
Mode
D4430: Fix performance by skipping XML debug when debugging is disabled
Attached
Detach File
Event Timeline