/** * Sets up a mocked logger stream * * @return void **/ public function setUp() { parent::setUp(); $class = $this->getMockClass('BaseLog'); CakeLog::config('queuetest', array('engine' => $class, 'types' => array('error'), 'scopes' => ['gearman'])); $this->logger = CakeLog::stream('queuetest'); Configure::write('Gearman', array()); }
/** * Sets up a mocked logger stream * * @return void **/ public function setUp() { parent::setUp(); $this->_root = Nodes\Environment::getRoot(); Nodes\Environment::setRoot('/var/www/test'); $class = $this->getMockClass('BaseLog'); CakeLog::config('queuetest', array('engine' => $class, 'types' => array('error'))); $this->logger = CakeLog::stream('queuetest'); }
/** * Sets up a mocked logger stream * * @return void **/ public function setUp() { parent::setUp(); $class = $this->getMockClass('BaseLog', array('write'), array(), 'SQSBaseLog'); CakeLog::config('queuetest', array('engine' => $class, 'types' => array('error', 'debug'), 'scopes' => array('sqs'))); $this->logger = CakeLog::stream('queuetest'); CakeLog::disable('stderr'); Configure::write('SQS', array()); }
/** * Constructor - sets up the log listener. * * @return \LogPanel */ public function __construct() { parent::__construct(); $existing = CakeLog::configured(); if (empty($existing)) { CakeLog::config('default', array('engine' => 'FileLog')); } CakeLog::config('debug_kit_log_panel', array('engine' => 'DebugKit.DebugKitLog', 'panel' => $this)); }
public function setUp() { parent::setUp(); CakeLog::config('debug', array( 'engine' => 'FileLog', 'types' => array('notice', 'info', 'debug'), 'file' => 'debug', )); CakeLog::config('error', array( 'engine' => 'FileLog', 'types' => array('error', 'warning'), 'file' => 'error', )); }
public function testLog() { $stream = CakeLog::stream('error'); $engine = get_class($stream); $config = array_merge($stream->config(), compact('engine')); CakeLog::config('error', array_merge($config, array('engine' => 'FileLog', 'path' => TMP . 'tests' . DS))); $filepath = TMP . 'tests' . DS . 'error.log'; if (file_exists($filepath)) { unlink($filepath); } $this->assertTrue($this->Model->log('Test warning 1')); $this->assertTrue($this->Model->log(array('Test' => 'warning 2'))); $result = file($filepath); $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Error: Test warning 1$/', $result[0]); $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Error: Array$/', $result[1]); $this->assertRegExp('/^\\($/', $result[2]); $this->assertRegExp('/\\[Test\\] => warning 2$/', $result[3]); $this->assertRegExp('/^\\)$/', $result[4]); unlink($filepath); $this->assertTrue($this->Model->log('Test warning 1', LOG_WARNING)); $this->assertTrue($this->Model->log(array('Test' => 'warning 2'), LOG_WARNING)); $result = file($filepath); $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 1$/', $result[0]); $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Array$/', $result[1]); $this->assertRegExp('/^\\($/', $result[2]); $this->assertRegExp('/\\[Test\\] => warning 2$/', $result[3]); $this->assertRegExp('/^\\)$/', $result[4]); unlink($filepath); CakeLog::config('error', array_merge($config, array('engine' => 'FileLog', 'path' => TMP . 'tests' . DS, 'scopes' => array('some_scope')))); $this->assertTrue($this->Model->log('Test warning 1', LOG_WARNING)); $this->assertTrue(!file_exists($filepath)); $this->assertTrue($this->Model->log('Test warning 1', LOG_WARNING, 'some_scope')); $result = file($filepath); $this->assertRegExp('/^2[0-9]{3}-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+ Warning: Test warning 1$/', $result[0]); CakeLog::config('error', $config); }
/** * test log() depth * * @return void */ public function testLogDepth() { if (file_exists(LOGS . 'debug.log')) { unlink(LOGS . 'debug.log'); } CakeLog::config('file', array('engine' => 'File', 'path' => TMP . 'logs' . DS)); $val = array('test' => array('key' => 'val')); Debugger::log($val, LOG_DEBUG, 0); $result = file_get_contents(LOGS . 'debug.log'); $this->assertContains('DebuggerTest::testLog', $result); $this->assertNotContains("/'val'/", $result); unlink(LOGS . 'debug.log'); }
/** * Configure the cache handlers that CakePHP will use for internal * metadata like class maps, and model schema. * * By default File is used, but for improved performance you should use APC. * * Note: 'default' and other application caches should be configured in app/Config/bootstrap.php. * Please check the comments in bootstrap.php for more info on the cache engines available * and their settings. */ $engine = 'File'; // In development mode, caches should expire quickly. $duration = '+999 days'; if (Configure::read('debug') > 0) { $duration = '+10 seconds'; } // Prefix each application on the same server with a different string, to avoid Memcache and APC conflicts. $prefix = 'site_'; App::uses('CakeLog', 'Log'); CakeLog::config('default', array('engine' => 'FileLog')); /** * Configure the cache used for general framework caching. Path information, * object listings, and translation cache files are stored with this configuration. */ Cache::config('_cake_core_', array('engine' => $engine, 'prefix' => $prefix . 'cake_core_', 'path' => CACHE . 'persistent' . DS, 'serialize' => $engine === 'File', 'duration' => $duration)); /** * Configure the cache for model and datasource caches. This cache configuration * is used to store schema descriptions, and table listings in connections. */ Cache::config('_cake_model_', array('engine' => $engine, 'prefix' => $prefix . 'cake_model_', 'path' => CACHE . 'models' . DS, 'serialize' => $engine === 'File', 'duration' => $duration)); Cache::config('default', array('engine' => $engine, 'serialize' => $engine === 'File', 'duration' => 31 * DAY));
* Configure::write('I18n.preferApp', true); */ /** * You can attach event listeners to the request lifecycle as Dispatcher Filter. By default CakePHP bundles two filters: * * - AssetDispatcher filter will serve your asset files (css, images, js, etc) from your themes and plugins * - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers * * Feel free to remove or add filters as you see fit for your application. A few examples: * * Configure::write('Dispatcher.filters', array( * 'MyCacheFilter', // will use MyCacheFilter class from the Routing/Filter package in your app. * 'MyCacheFilter' => array('prefix' => 'my_cache_'), // will use MyCacheFilter class from the Routing/Filter package in your app with settings array. * 'MyPlugin.MyFilter', // will use MyFilter class from the Routing/Filter package in MyPlugin plugin. * array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch * array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch * * )); */ Configure::write('Dispatcher.filters', array('AssetDispatcher', 'CacheDispatcher')); /** * Configures default file logging options */ App::uses('CakeLog', 'Log'); CakeLog::config('default', array('engine' => 'File')); CakeLog::config('debug', array('engine' => 'File', 'types' => array('notice', 'info', 'debug'), 'file' => 'debug')); CakeLog::config('error', array('engine' => 'File', 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'), 'file' => 'error')); CakeLog::config('payment', array('engine' => 'FileLog', 'types' => array('info', 'error', 'warning'), 'scopes' => array('payment'), 'file' => 'payment')); CakePlugin::load('DebugKit'); CakePlugin::load('Upload'); CakePlugin::load('BoostCake');
/** * Teardown */ public function tearDown() { CakeLog::config('default', array('engine' => 'FileLog')); parent::tearDown(); }
public function shepherds() { CakeLog::config('sensor', array('engine' => 'FileLog', 'types' => array('warning', 'error', 'info'), 'scopes' => array('sensors'), 'file' => 'sensors.log')); $this->layout = 'ajax'; if ($this->request->is('put')) { $this->logMe('PUT /pswn/shepherds'); $return = '{"action":"updated"}'; } else { if ($this->request->is('get')) { $this->logMe('GET /pswn/shepherds'); $str = ''; $return = '{"timeslice":"1/6","beacon_time":23,"bcc":120}'; } } $this->response->type('json'); $this->set('jsonResponse', $return); }
'file' => 'debug', ));*/ /*CakeLog::config('error', array( 'engine' => 'File', 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'), 'file' => 'error', ));*/ CakeLog::config('debug', Configure::read(APP_NAME . '.logging.debug')); CakeLog::config('error', Configure::read(APP_NAME . '.logging.error')); /* * Load plugins */ //CakePlugin::load('OrcaTools', array('bootstrap' => true)); CakePlugin::load('OrcaAppSetup'); CakePlugin::load('FakeSeeder'); CakePlugin::load('DebugKit'); CakePlugin::load('MultiColumnUniqueness'); //CakePlugin::load('ValidForeignKeyBehavior'); CakePlugin::load('Migrations'); CakePlugin::load('DatabaseLog'); CakePlugin::load('ClearCache'); // Load those plugins only when in debug mode if (Configure::read('debug')) { CakePlugin::load('TestDataValidation'); } /** * Setup additional logging */ if (Configure::check(APP_NAME . '.logging.database')) { CakeLog::config('default', Configure::read(APP_NAME . '.logging.database')); }
/** * testSendWithLogAndScope method * * @return void */ public function testSendWithLogAndScope() { CakeLog::config('email', array('engine' => 'File', 'path' => TMP, 'types' => array('cake_test_emails'), 'scopes' => array('email'))); CakeLog::drop('default'); $this->CakeEmail->transport('Debug'); $this->CakeEmail->to('*****@*****.**'); $this->CakeEmail->from('*****@*****.**'); $this->CakeEmail->subject('My title'); $this->CakeEmail->config(array('log' => array('level' => 'cake_test_emails', 'scope' => 'email'))); $result = $this->CakeEmail->send("Logging This"); App::uses('File', 'Utility'); $File = new File(TMP . 'cake_test_emails.log'); $log = $File->read(); $this->assertTrue(strpos($log, $result['headers']) !== FALSE); $this->assertTrue(strpos($log, $result['message']) !== FALSE); $File->delete(); CakeLog::drop('email'); }
CakePlugin::load('Jcamp'); /** * To prefer app translation over plugin translation, you can set * * Configure::write('I18n.preferApp', true); */ /** * You can attach event listeners to the request lifecycle as Dispatcher Filter. By default CakePHP bundles two filters: * * - AssetDispatcher filter will serve your asset files (css, images, js, etc) from your themes and plugins * - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers * * Feel free to remove or add filters as you see fit for your application. A few examples: * * Configure::write('Dispatcher.filters', array( * 'MyCacheFilter', // will use MyCacheFilter class from the Routing/Filter package in your app. * 'MyCacheFilter' => array('prefix' => 'my_cache_'), // will use MyCacheFilter class from the Routing/Filter package in your app with settings array. * 'MyPlugin.MyFilter', // will use MyFilter class from the Routing/Filter package in MyPlugin plugin. * array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch * array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch * * )); */ Configure::write('Dispatcher.filters', ['AssetDispatcher', 'CacheDispatcher']); /** * Configures default file logging options */ App::uses('CakeLog', 'Log'); CakeLog::config('debug', ['engine' => 'File', 'types' => ['notice', 'info', 'debug'], 'file' => 'debug']); CakeLog::config('error', ['engine' => 'File', 'types' => ['warning', 'error', 'critical', 'alert', 'emergency'], 'file' => 'error']);
/** * Constructs this Shell instance. * * @param ConsoleOutput $stdout * A ConsoleOutput object for stdout. * @param ConsoleOutput $stderr * A ConsoleOutput object for stderr. * @param ConsoleInput $stdin * A ConsoleInput object for stdin. * @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell */ public function __construct($stdout = null, $stderr = null, $stdin = null) { if ($this->name == null) { $this->name = Inflector::camelize(str_replace(array('Shell', 'Task'), '', get_class($this))); } $this->Tasks = new TaskCollection($this); $this->stdout = $stdout; $this->stderr = $stderr; $this->stdin = $stdin; if ($this->stdout == null) { $this->stdout = new ConsoleOutput('php://stdout'); } CakeLog::config('stdout', array('engine' => 'ConsoleLog', 'types' => array('notice', 'info'), 'stream' => $this->stdout)); if ($this->stderr == null) { $this->stderr = new ConsoleOutput('php://stderr'); } CakeLog::config('stderr', array('engine' => 'ConsoleLog', 'types' => array('emergency', 'alert', 'critical', 'error', 'warning', 'debug'), 'stream' => $this->stderr)); if ($this->stdin == null) { $this->stdin = new ConsoleInput('php://stdin'); } $parent = get_parent_class($this); if ($this->tasks !== null && $this->tasks !== false) { $this->_mergeVars(array('tasks'), $parent, true); } if ($this->uses !== null && $this->uses !== false) { $this->_mergeVars(array('uses'), $parent, false); } }
* - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers * * Feel free to remove or add filters as you see fit for your application. A few examples: * * Configure::write('Dispatcher.filters', array( * 'MyCacheFilter', // will use MyCacheFilter class from the Routing/Filter package in your app. * 'MyCacheFilter' => array('prefix' => 'my_cache_'), // will use MyCacheFilter class from the Routing/Filter package in your app with settings array. * 'MyPlugin.MyFilter', // will use MyFilter class from the Routing/Filter package in MyPlugin plugin. * array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch * array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch * * )); */ Configure::write('Dispatcher.filters', array('AssetDispatcher', 'CacheDispatcher')); /** * Configures default file logging options */ App::uses('CakeLog', 'Log'); $log_path = LOGS . DS . date('Ymd') . '_'; CakeLog::config('debug', array('engine' => 'File', 'types' => array('notice', 'info', 'debug'), 'file' => 'debug', 'path' => $log_path)); CakeLog::config('error', array('engine' => 'File', 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'), 'file' => 'error', 'path' => $log_path)); // 待機からチャットへ意向する時のデータ作成時ログ define('LOG_WAITING', 'log_waiting'); CakeLog::config('log_waiting', array('engine' => 'FileLog', 'types' => array('log_waiting'), 'file' => 'log_waiting')); // 詳細なdebug define('FULL_LOG_WRITE', 0); if (FULL_LOG_WRITE) { define('FULL_LOG', 'log_full'); CakeLog::config('log_full', array('engine' => 'FileLog', 'types' => array('log_full'), 'file' => 'log_full', 'path' => $log_path)); } CakePlugin::load('DebugKit');
/** * Test writing log files with custom levels * * @return void */ public function testCustomLevelWrites() { $this->_deleteLogs(); $this->_resetLogConfig(); CakeLog::levels(array('spam', 'eggs')); $testMessage = 'error message'; CakeLog::write('error', $testMessage); CakeLog::defaultLevels(); $this->assertTrue(file_exists(LOGS . 'error.log')); $contents = file_get_contents(LOGS . 'error.log'); $this->assertContains('Error: ' . $testMessage, $contents); CakeLog::config('spam', array('engine' => 'File', 'file' => 'spam.log', 'types' => 'spam')); CakeLog::config('eggs', array('engine' => 'File', 'file' => 'eggs.log', 'types' => array('spam', 'eggs'))); $testMessage = 'spam message'; CakeLog::write('spam', $testMessage); CakeLog::defaultLevels(); $this->assertTrue(file_exists(LOGS . 'spam.log')); $this->assertTrue(file_exists(LOGS . 'eggs.log')); $contents = file_get_contents(LOGS . 'spam.log'); $this->assertContains('Spam: ' . $testMessage, $contents); $testMessage = 'egg message'; CakeLog::write('eggs', $testMessage); CakeLog::defaultLevels(); $contents = file_get_contents(LOGS . 'spam.log'); $this->assertNotContains('Eggs: ' . $testMessage, $contents); $contents = file_get_contents(LOGS . 'eggs.log'); $this->assertContains('Eggs: ' . $testMessage, $contents); CakeLog::drop('spam'); CakeLog::drop('eggs'); $this->_deleteLogs(); }
/** * Constructor - sets up the log listener. * * @return void */ function __construct($settings) { parent::__construct(); 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)); }
<?php CakeLog::config('AuthManager', array('engine' => 'FileLog', 'types' => array('AuthManager'), 'file' => 'authManager.log')); Configure::load('AuthManager.API/UserCredentials');
/** * explict tests for drop() * * @return void **/ function testDrop() { CakeLog::config('file', array( 'engine' => 'FileLog', 'path' => LOGS )); $result = CakeLog::configured(); $this->assertEqual($result, array('file')); CakeLog::drop('file'); $result = CakeLog::configured(); $this->assertEqual($result, array()); }
<?php /* 注意这里的插件加载必须在DbLog配置前调用, 否则会出现错误 */ CakePlugin::loadAll(array('Media' => array('bootstrap' => true))); /* 配置LogStream Writer */ App::uses('CakeLog', 'Log'); CakeLog::config('DbLog', array('engine' => 'DbLog', 'model' => 'Log'));
/** * Used to enable or disable logging stream output to stdout and stderr * If you don't wish to see in your stdout or stderr everything that is logged * through CakeLog, call this function with first param as false * * @param boolean $enable whether to enable CakeLog output or not * @return void */ protected function _useLogger($enable = true) { if (!$enable) { CakeLog::drop('stdout'); CakeLog::drop('stderr'); return; } CakeLog::config('stdout', array('engine' => 'Console', 'types' => array('notice', 'info'), 'stream' => $this->stdout)); CakeLog::config('stderr', array('engine' => 'Console', 'types' => array('emergency', 'alert', 'critical', 'error', 'warning', 'debug'), 'stream' => $this->stderr)); }
/** * Configure the stderr logger * * @return void */ protected function _configureStdErrLogger() { CakeLog::config('stderr', array('engine' => 'Console', 'types' => array('emergency', 'alert', 'critical', 'error', 'warning', 'debug'), 'stream' => $this->stderr)); }
* CakePlugin::load('DebugKit'); //Loads a single plugin named DebugKit * */ CakePlugin::load('Dompdf', array('bootstrap' => true)); CakePlugin::load('CakeCAS'); CakePlugin::loadAll(); /** * You can attach event listeners to the request lifecyle as Dispatcher Filter . By Default CakePHP bundles two filters: * * - AssetDispatcher filter will serve your asset files (css, images, js, etc) from your themes and plugins * - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers * * Feel free to remove or add filters as you see fit for your application. A few examples: * * Configure::write('Dispatcher.filters', array( * 'MyCacheFilter', // will use MyCacheFilter class from the Routing/Filter package in your app. * 'MyPlugin.MyFilter', // will use MyFilter class from the Routing/Filter package in MyPlugin plugin. * array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch * array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch * * )); */ Configure::write('Dispatcher.filters', array('AssetDispatcher', 'CacheDispatcher')); /** * Configures default file logging options */ App::uses('CakeLog', 'Log'); 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')); CakeLog::config('proxy', array('engine' => 'FileLog', 'types' => array('proxy'), 'file' => 'proxy'));
// 環境変数からパラメータを取得 $parameter = getUrlParamFromEnv(); Configure::write('BcRequest.pureUrl', $parameter); // ※ requestActionに対応する為、routes.php で上書きされる if (BC_INSTALLED) { /** * tmpフォルダ確認 */ checkTmpFolders(); /** * Configures default file logging options */ App::uses('CakeLog', 'Log'); 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')); CakeLog::config('update', array('engine' => 'FileLog', 'types' => array('update'), 'file' => 'update')); /** * キャッシュ設定 */ $cacheEngine = Configure::read('BcCache.engine'); $cachePrefix = Configure::read('BcCache.prefix'); $cacheDuration = Configure::read('BcCache.duration'); // モデルスキーマ Cache::config('_cake_model_', array('engine' => $cacheEngine, 'prefix' => $cachePrefix . 'cake_model_', 'path' => CACHE . 'models' . DS, 'serialize' => $cacheEngine === 'File', 'duration' => $cacheDuration)); // コア環境 Cache::config('_cake_core_', array('engine' => $cacheEngine, 'prefix' => $cachePrefix . 'cake_core_', 'path' => CACHE . 'persistent' . DS, 'serialize' => $cacheEngine === 'File', 'duration' => $cacheDuration)); // DBデータキャッシュ Cache::config('_cake_data_', array('engine' => $cacheEngine, 'path' => CACHE . 'datas', 'probability' => 100, 'prefix' => $cachePrefix . 'cake_data_', 'lock' => true, 'serialize' => $cacheEngine === 'File', 'duration' => $cacheDuration)); // 環境情報キャッシュ Cache::config('_cake_env_', array('engine' => $cacheEngine, 'probability' => 100, 'path' => CACHE . 'environment', 'prefix' => $cachePrefix . 'cake_env_', 'lock' => false, 'serialize' => $cacheEngine === 'File', 'duration' => $cacheDuration)); /**
/** * testLog method * * @return void */ public function testLog() { if (file_exists(LOGS . 'debug.log')) { unlink(LOGS . 'debug.log'); } CakeLog::config('file', array('engine' => 'File', 'path' => TMP . 'logs' . DS)); Debugger::log('cool'); $result = file_get_contents(LOGS . 'debug.log'); $this->assertRegExp('/DebuggerTest\\:\\:testLog/i', $result); $this->assertRegExp("/'cool'/", $result); unlink(LOGS . 'debug.log'); Debugger::log(array('whatever', 'here')); $result = file_get_contents(LOGS . 'debug.log'); $this->assertRegExp('/DebuggerTest\\:\\:testLog/i', $result); $this->assertRegExp('/\\[main\\]/', $result); $this->assertRegExp('/array/', $result); $this->assertRegExp("/'whatever',/", $result); $this->assertRegExp("/'here'/", $result); }
/** * testSendWithLog method * * @return void */ public function testSendWithLog() { $path = CAKE . 'Test' . DS . 'test_app' . DS . 'tmp' . DS; CakeLog::config('email', array( 'engine' => 'FileLog', 'path' => TMP )); CakeLog::drop('default'); $this->CakeEmail->transport('Debug'); $this->CakeEmail->to('*****@*****.**'); $this->CakeEmail->from('*****@*****.**'); $this->CakeEmail->subject('My title'); $this->CakeEmail->config(array('log' => 'cake_test_emails')); $result = $this->CakeEmail->send("Logging This"); App::uses('File', 'Utility'); $File = new File(TMP . 'cake_test_emails.log'); $log = $File->read(); $this->assertTrue(strpos($log, $result['headers']) !== false); $this->assertTrue(strpos($log, $result['message']) !== false); $File->delete(); CakeLog::drop('email'); }
* Plug in your own custom JavaScript compressor by dropping a script in your webroot to handle the * output, and setting the config below to the name of the script. * * To use, prefix your JavaScript link URLs with '/cjs/' instead of '/js/' or use JavaScriptHelper::link(). */ //Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php'); /** * The class name and database used in CakePHP's * access control lists. */ Configure::write('Acl.classname', 'DbAcl'); Configure::write('Acl.database', 'default'); /** * Uncomment this line and correct your server timezone to fix * any date & time related errors. */ date_default_timezone_set('UTC'); /** * Configure Cache from environment variables */ Cache::config('default', CacheDsn::parse(env('CACHE_URL'))); Cache::config('debug_kit', CacheDsn::parse(env('CACHE_DEBUG_KIT_URL'))); Cache::config('_cake_core_', CacheDsn::parse(env('CACHE_CAKE_CORE_URL'))); Cache::config('_cake_model_', CacheDsn::parse(env('CACHE_CAKE_MODEL_URL'))); /** * Configure logs from environment variables */ App::uses('CakeLog', 'Log'); CakeLog::config('default', LogDsn::parse(env('LOG_URL'))); CakeLog::config('error', LogDsn::parse(env('LOG_ERROR_URL')));
* * Feel free to remove or add filters as you see fit for your application. A few examples: * * Configure::write('Dispatcher.filters', array( * 'MyCacheFilter', // will use MyCacheFilter class from the Routing/Filter package in your app. * 'MyCacheFilter' => array('prefix' => 'my_cache_'), // will use MyCacheFilter class from the Routing/Filter package in your app with settings array. * 'MyPlugin.MyFilter', // will use MyFilter class from the Routing/Filter package in MyPlugin plugin. * array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch * array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch * * )); */ /** * 認証用プラグイン */ Configure::write('Dispatcher.filters', array('AssetDispatcher', 'CacheDispatcher')); /** * Configures default file logging options */ App::uses('CakeLog', 'Log'); CakeLog::config('debug', array('engine' => 'File', 'types' => array('notice', 'info', 'debug'), 'file' => 'debug')); CakeLog::config('error', array('engine' => 'File', 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'), 'file' => 'error')); CakePlugin::load('Opauth', array('routes' => true, 'bootstrap' => true)); /** * Facebook認証のためのstrategy */ Configure::write('Opauth.Strategy.Facebook', array('app_id' => 'YOUR FACEBOOK APP ID', 'app_secret' => 'YOUR FACEBOOK APP SECRET')); /** * 認証用のURL設定 */ Configure::write('Opauth.path', '/skills/auth/');
<?php // include de autoload from composer App::import('Vendor', 'KickboxEmail.Kickbox', array('file' => 'autoload.php')); // By default debugging is enabled and data is saved in a log file Configure::write('KickboxEmail.log', true); // CakeLog config CakeLog::config('kickbox', array('engine' => 'FileLog', 'types' => array('info'), 'scopes' => array('kickbox'), 'file' => 'kickbox.log'));