Sebastián Grignoli
Sebastián Grignoli

Reputation: 33432

Symfony: Showing the dev toolbar in "prod" environment

I managed to interactively set the debugging mode of my symfony application On and Off for a user session with something like this:

$configuration = ProjectConfiguration::getApplicationConfiguration($app,
                                                           $env, $debugging);

I know that the Web Debug Toolbar showing up or not does not depend on the value of $debugging, but the configuration of the current environment.

To this moment the only way that the toolbar appears is when $env = 'dev'.

I'd like to activate it when accessing the "prod" environment also.

I have this app setting:

prod:
  .settings:
    no_script_name:         true
    logging_enabled:        false
    web_debug:              true
    error_reporting:        <?php echo (E_ALL | E_STRICT)."\n" ?>

dev:
  .settings:
    error_reporting:        <?php echo (E_ALL | E_STRICT)."\n" ?>
    web_debug:              true
    cache:                  false
    no_script_name:         false
    etag:                   false

The toolbar is not being shown, apparently ignoring the "web_debug" setting.

If I echo(sfConfig::get('sf_web_debug')) I get "true".

¿How could I get the toolbar working?

Upvotes: 1

Views: 6089

Answers (2)

Andreas
Andreas

Reputation: 21

you also need to change the factory.yml . By default, there's no Logger in the 'prod'-environment.

Just comment out like this:

prod:
#  logger:
#    class:   sfNoLogger
#    param:
#      level:   err
#      loggers: ~

Upvotes: 2

Blair McMillan
Blair McMillan

Reputation: 5349

From memory you have to change a value in your frontend php file. Compare the frontend.php and frontend_dev.php files in your web directory. Look for a difference where one is true and the other is false (I think it's the last parameter).

The lines are:

require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', false));
sfContext::createInstance($configuration)->dispatch();

change to:

require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', true));
sfContext::createInstance($configuration)->dispatch();

Upvotes: 1

Related Questions