• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • This community is user driven. Be polite with other users.
    • We recommend purchasing a Chevereto license to participate in this community.
    • Purchase a Community Subscription to get even faster ticket response times.
  • Chevereto Support CLST

    Support response

    Support checklist

    • Got a Something went wrong message? Read this guide and provide the actual error. Do not skip this.
    • Confirm that the server meets the System Requirements
    • Check for any available Hotfix - your issue could be already reported/fixed
    • Read documentation - It will be required to Debug and understand Errors for a faster support response

Error Logging Not Working for json

siddharth

πŸ’– Chevereto Fan
Pro
β–Ά Reproduction steps
  1. Running 3.20.19
  2. Upgrade to Beta V4.0.0.0-Beta-11
  3. Set CHEVERETO_DEBUG_LEVEL=3 in env.php
  4. Upload Image, and I am getting Error
😒 Unexpected result

Error logs are not getting written via Chevereto. It worked for V3 via settings.php
 
This update changed how you debug Chevereto V4. It stopped debugging all errors to all users (as it was intended) and now debug only affects administrators with the setting "Debug errors" enabled.

The env still works, but that's for dev context as it enables debug for all users which may leak sensitive information about your installation.

Read here: https://v4-docs.chevereto.com/developer/how-to/debug.html

By the way, here's the register-handlers code:

PHP:
        try {
            $debug = $_ENV['CHEVERETO_TAG'] ?? '' === 'dev'
                || (getSetting('debug_errors') && Login::isAdmin());
        } catch (Throwable) {
            $debug = false;
        }
        try {
            $debugLevel = Config::system()->debugLevel();
        } catch (Throwable) {
            $debugLevel = (int) ($_ENV['CHEVERETO_DEBUG_LEVEL'] ?? 1);
        }
        $docPublic = new HtmlDocument(
            $handler->withIsDebug(
                in_array($debugLevel, [2, 3]) || $debug
            )
        );

If the system is not logging the error it could be because the error was prematurely caught (it never arrived the handlers) or perhaps your log device stopped working. As you may see, the code reacts to log levels 2,3 OR admin debug flag.
 
I have enabled this settings

1661805533850.png

And when uploading image

1661805603560.png

I am getting the incident ID. But I don't see the error displayed on the screen or in the log location.
If the system is not logging the error it could be because the error was prematurely caught (it never arrived the handlers)

If that's the case I believe incident ID wont be created?

perhaps your log device stopped working. As you may see, the code reacts to log levels 2,3 OR admin debug flag.

I don't think log device stopped working as all PHP errors are getting caught. Only V4 errors are not getting caught in logs or displayed on the screen.
 
Errors in the json are prematurely caught at this time, it means that these error doesn't use the same handler and get written directly to the error stream.

At this time json errors aren't handled the same way. Debug error setting doesn't apply there and not even XR Debug is wired yet.

I will work on add error reporting verbosity, for admins, when getting errors in json context. Also support for XR Debug.
 
This has been fixed already, will be released in 4.0.0.
 
Ok great. As you see, there is a bug in uploading images. Is there any workaround to catch that bug to log so I can create the bug thread, and you can fix it for 4.0.0 ?

I am sure many will face the issue like me who are upgrading with huge images.
 
Last edited:
app/legacy/routes/json.php

Find this:

PHP:
$throwableHandler = throwableHandler($e);
Add below.

PHP:
            writers()->error()->write(
                (new PlainDocument($throwableHandler))
                    ->__toString() . "\n"
            );

P.S. Open a new ticket for the detected issue.
 
The code added instructs that any throwable at json.php writes an error to the error stream regardless of the debug configuration. It should always log, no matter the debug level or debug errors config.

Errors are configured to write to php://stderr (STDERR), where that writes depends on your server. Perhaps you are just checking on the wrong place.
 
Chevereto has its own handler which writes directly to stderr. Doesn't matter the config in the web server, only the php setup. Note that it explicit uses php://stderr.

The documentation provides a summary with the common locations for this file. You are using php-fpm under a proxy, I suggest you to check that and don't take for granted that it works the same in every setup.
 
I checked all the locations, and still, no logs are created.

1) PHP error_log location - no logs are created - This is PHP direct log location
2) nginx error_log location - no logs are created - This is Web Server log location

Unlike all other scripts, why not use the traditional method (sending errors to the web server log location)?
 
  • Like
Reactions: rdn
I provide my own infra, I answer for my work not others. I'm sorry but I can't help you further, in my experience these issues are always config related. Try checking that.

You could donate a server (identical system copy, zero content) so I can play with it freely. That have been always an option, there are about 4 servers donated in which I'm constantly running checks.

If that's not an option this requires Extra Support.
 
Back
Top