Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Logging levels in production ignored #34

Closed
rvolz opened this issue Jan 14, 2013 · 1 comment
Closed

Logging levels in production ignored #34

rvolz opened this issue Jan 14, 2013 · 1 comment
Assignees
Labels
Milestone

Comments

@rvolz
Copy link
Owner

rvolz commented Jan 14, 2013

As mentioned in http://www.mobileread.com/forums/showpost.php?p=2380982&postcount=4 the logging library ignores the settings for production. Lots of debug messages appear in production logs.

Quick fix, add the following lines in index.php, before line 112:

$app = Slim::getInstance();                                                             
$log = $app->getLog();                                                                  
$log->setEnabled(false); 

Real fix: upgrade Slim Framework to version 2+

@ghost ghost assigned rvolz Jan 14, 2013
@janeczku
Copy link
Contributor

The log.writer, log.level and log.enabled switches are only available upon instantiation and thus don't work when invoked by $app->config. See http://help.slimframework.com/discussions/problems/763-logging-with-custom-writer#comment_17031171 and http://docs.slimframework.com/#Activate-Logging
AFAIK, this is still true for Slim v2.

Furthermore, log.levels should be set using constants not integers. See http://docs.slimframework.com/

App mode should be set up like this. I can confirm it is working:

/**
 * Configure app for production
 */
function confprod() {
    global $app, $appname, $appversion;
    $app->config(array(
        'debug' => false,
        'cookies.lifetime' => '1 day',
        'cookies.secret_key' => 'b4924c3579e2850a6fad8597da7ad24bf43ab78e',
    ));
    $app->getLog()->setEnabled(true);
    $app->getLog()->setLevel(Slim_Log::WARN);
    $app->getLog()->info($appname.' '.$appversion.': Running in production mode.');
}

rvolz added a commit that referenced this issue Mar 31, 2013
The logging levels work now as intended. In DEBUG mode a file log is
created.
@rvolz rvolz closed this as completed Mar 31, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants