简体   繁体   中英

Symfony development. Clearing cache every time?

i'll preface this with I am rather novice with this framework.

I'm working on developing an API using the symfony framework. I have added a logger to a service container and this seems to have worked without issue when i make a call to the logger. I then added another call to the logger to dump some more information to log. Nothing crazy or unique here. However, it seems that this is not being called. My thoughts were to clear cache for my dev environment which i did. Even after clearing the cache, the code still does not seem to execute.

My questions are:

  • am I missing a step? Are there any expected development settings needed that maybe i'm missing in app_dev.php ?
  • clearing the cache takes extremely long (~7mins). Is this expected and normal?

Update

The development is happening on a vm (virtualbox). when i cycle this box, it would appear the code is being rebuilt as my changes are now being seen. However, this is not a viable solution for development.

my app_dev.php

$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
require_once __DIR__.'/../app/AppKernel.php';

$kernel = new AppKernel('dev', true);
//$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

If you just added in your code another call to your logger, you don't have to do anything in the dev environment to see the changes. My guess is that for some reason, your code is not calling the logger. Use Xdebug or a simple var_dump() call (in Symfony you can use dump() , which is a greatly improved var_dump() ) to check that your code is reaching that logger call.

Regarding the time it takes to clear the cache, rest assure is not normal at all. Even on virtual machines, which are well known for being slow, it should take just a few seconds at most even for complex applications.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM