Welcome Guest, Not a member yet? Register   Sign In
how do I set error logging?
#1

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
Reply
#2

(This post was last modified: 02-02-2020, 07:14 AM by John_Betong.)

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;
Reply
#3

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.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

(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.
Reply
#5

It sounds like nginx is not configured correct if you are getting a write error.

Are you sure that the cache folder is writable?
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#6

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/
Reply
#7

(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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB