Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updating LogPanel so it doesn't clobber the automagic log configurati…

…on when it creates its own listener. Test case added.
  • Loading branch information...
commit 78fd15e76e24fa719877956b6812b8f1d2189859 1 parent 3703e57
@markstory markstory authored
View
6 controllers/components/toolbar.php
@@ -585,6 +585,12 @@ function __construct($settings) {
if (!class_exists('CakeLog')) {
App::import('Core', 'CakeLog');
}
+ $existing = CakeLog::configured();
+ if (empty($existing)) {
+ CakeLog::config('default', array(
+ 'engine' => 'FileLog'
+ ));
+ }
CakeLog::config('debug_kit_log_panel', array(
'engine' => 'DebugKitLogListener',
'panel' => $this
View
19 tests/cases/controllers/components/toolbar.test.php
@@ -453,6 +453,24 @@ function testLogPanel() {
$this->assertPattern('/\[created\] => 2009-11-07 23:23:23/', $result['content']['error'][2][1]);
$this->assertPattern('/\[Comment\] => Array/', $result['content']['error'][2][1]);
}
+
+/**
+ * test that creating the log panel creates the default file logger if none
+ * are configured. This stops DebugKit from mucking with the default auto-magic log config
+ *
+ * @return void
+ */
+ function testLogPanelConstructCreatingDefaultLogConfiguration() {
+ CakeLog::drop('default');
+ CakeLog::drop('debug_kit_log_panel');
+
+ $panel =& new LogPanel(array());
+ $configured = CakeLog::configured();
+
+ $this->assertTrue(in_array('default', $configured));
+ $this->assertTrue(in_array('debug_kit_log_panel', $configured));
+ }
+
/**
* Test that history state urls set prefix = null and admin = null so generated urls do not
* adopt these params.
@@ -550,4 +568,3 @@ function testSqlLogPanel() {
$this->assertTrue(isset($result['content']['threshold']));
}
}
-?>
Please sign in to comment.
Something went wrong with that request. Please try again.