CodeIgniter Forums

Full Version: how do I set error logging?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I'm playing with CI4, I've used CI before years ago. I've gotten as far as 

https://df2.pennyjack.co.uk/index.php

and I'm getting: 


Quote:Whoops!

We seem to have hit a snag. Please try again later...

I cannot find error logs anywhere. I've swallowed hard and set the writable folder to 777 but still nothing.  How do I set/get the error logs?


Thanks
First thing I do is search in Config/App for 0644 which is the log file permissions and change to 0777.

Edit:

I also have these settings in index.php to delete the LOGFILE.:

Code:
define('LOGFILE',   '../writable/logs/log-' .date('Y-m-d') .'.php');
define('LOCALHOST', 'localhost'===$_SERVER['SERVER_NAME']);
if(LOCALHOST) :
  define('CI_DEBUG', ! FALSE); // bypass (bool) app/Config/boot/development.php
  ini_set('display_errors', '1');
  $_SERVER['CI_ENVIRONMENT'] = 'development'; // bypass .env & .htaccess
  $useKint = FALSE;
  # require '../system/ThirdParty/Kint/kint.php';

# CLEANER -  only shows last error logs and debugbar JSON files
  $ok = @unlink(LOGFILE);
  $ok = @array_map('unlink', glob("../writable/debugbar/*.json"));
endif;
Edit the env file in the root.

Add just below:

# CI_ENVIRONMENT = production

CI_ENVIRONMENT = development

Save the file and rename it to .env

The debug toolbar should now work for you and throw the errors.
(02-02-2020, 10:17 AM)InsiteFX Wrote: [ -> ]Edit the env file in the root.

Add just below:

# CI_ENVIRONMENT = production

CI_ENVIRONMENT = development

Save the file and rename it to .env

The debug toolbar should now work for you and throw the errors.

thank you. That is working. And tells me that the issue is


Code:
CodeIgniter\Cache\Exceptions\CacheException Cache unable to write to {0}

I've given the writable folder and all subfolders to nginx:nginx, I've even bitten hard and made it 777. Still getting that error.
It sounds like nginx is not configured correct if you are getting a write error.

Are you sure that the cache folder is writable?
writable and all its subfolders are owned by nginx:nginx and set to 777 (until I get this working). If it would help you can see the error reports at:

https://df2.pennyjack.co.uk/
(02-03-2020, 08:50 AM)InsiteFX Wrote: [ -> ]It sounds like nginx is not configured correct if you are getting a write error.

Are you sure that the cache folder is writable?
 
writable and everything under it is set to 777. 

update - I have remmed out the exception call -


Code:
public function __construct($config)
        {
                $path = ! empty($config->storePath) ? $config->storePath : WRITEPATH . 'cache';
                if (! is_really_writable($path))
                {
                //      throw CacheException::forUnableToWrite($path); <- THIS LINE REMOVED
                }

                $this->prefix = $config->prefix ?: '';
                $this->path  = rtrim($path, '/') . '/';
        }
 
expecting CI to break in a way that gave me clues, and what's actually happened is it all appears to be working.

What's a way to force writes to the folders in /writable/ ?

Thanks for your help, it is appreciated.