Skip to content

[New feature] Debugging problems in PhpStorm->Tools->Analyze StackTrace #17168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Conversation

yapro
Copy link
Contributor

@yapro yapro commented Dec 29, 2015

I want to see TraceAsString for debugging problems in PhpStorm->Tools->Analyze StackTrace

Now in my logs I see:

{
    "message": "Fatal Parse Error: syntax error, unexpected 'sadf' (T_STRING)",
    "context": {
        "type": 4,
        "file": "\/var\/www\/src\/Acme\/SecurityBundle\/Controller\/DefaultController.php",
        "line": 511,
        "level": 22527,
        "stack": [
            {
                "function": "Composer\\Autoload\\includeFile",
                "file": "\/var\/www\/vendor\/composer\/ClassLoader.php",
                "line": 301,
                "args": {
                    "file": "???"
                }
            },
            {
                "function": "loadClass",
                "type": "->",
                "class": "Composer\\Autoload\\ClassLoader",
                "file": "\/var\/www\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/Routing\/Loader\/AnnotationClassLoader.php",
                "line": 107,
                "args": {
                    "class": "???"
                }
            },
            //...
        ]
    }
}

But PhpStorm->Tools->Analyze StackTrace use next format:

{
    "message": "Fatal Parse Error: syntax error, unexpected 'sadf' (T_STRING)",
    "context": {
        "type": 4,
        "file": "\/var\/www\/src\/Acme\/SecurityBundle\/Controller\/DefaultController.php",
        "line": 511,
        "level": 22527,
        "stack": "#0 [internal function]: Debug\\Monolog\\Processor\\Debug->__invoke(Array)
#1 /var/www/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(60): call_user_func(Object(Debug\\Monolog\\Processor\\Debug), Array)
#2 /var/www/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(33): Monolog\\Handler\\AbstractProcessingHandler->processRecord(Array)
#3 /var/www/vendor/monolog/monolog/src/Monolog/Logger.php(289): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)
#4 /var/www/vendor/monolog/monolog/src/Monolog/Logger.php(467): Monolog\\Logger->addRecord(500, 'Fatal Parse Err...', Array)
#5 /var/www/vendor/symfony/symfony/src/Symfony/Component/Debug/ErrorHandler.php(490): Monolog\\Logger->log('critical', 'Fatal Parse Err...', Array)
#6 /var/www/vendor/symfony/symfony/src/Symfony/Component/Debug/ErrorHandler.php(565): Symfony\\Component\\Debug\\ErrorHandler->handleException(Object(Symfony\\Component\\Debug\\Exception\\FatalErrorException), Array)
#7 [internal function]: Symfony\\Component\\Debug\\ErrorHandler::handleFatalError()
#8 {main}"
    }
}

…kTrace

I want to see TraceAsString for debugging problems in PhpStorm->Tools->Analyze StackTrace

Now in my logs I see:
```
{
    "message": "Fatal Parse Error: syntax error, unexpected 'sadf' (T_STRING)",
    "context": {
        "type": 4,
        "file": "\/var\/www\/src\/Acme\/SecurityBundle\/Controller\/DefaultController.php",
        "line": 511,
        "level": 22527,
        "stack": [
            {
                "function": "Composer\\Autoload\\includeFile",
                "file": "\/var\/www\/vendor\/composer\/ClassLoader.php",
                "line": 301,
                "args": {
                    "file": "???"
                }
            },
            {
                "function": "loadClass",
                "type": "->",
                "class": "Composer\\Autoload\\ClassLoader",
                "file": "\/var\/www\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/Routing\/Loader\/AnnotationClassLoader.php",
                "line": 107,
                "args": {
                    "class": "???"
                }
            },
            //...
        ]
    }
}
```
But PhpStorm->Tools->Analyze StackTrace use next format:
```
{
    "message": "Fatal Parse Error: syntax error, unexpected 'sadf' (T_STRING)",
    "context": {
        "type": 4,
        "file": "\/var\/www\/src\/Acme\/SecurityBundle\/Controller\/DefaultController.php",
        "line": 511,
        "level": 22527,
        "stack": "#0 [internal function]: Debug\\Monolog\\Processor\\Debug->__invoke(Array)
#1 /var/www/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(60): call_user_func(Object(Debug\\Monolog\\Processor\\Debug), Array)
#2 /var/www/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(33): Monolog\\Handler\\AbstractProcessingHandler->processRecord(Array)
#3 /var/www/vendor/monolog/monolog/src/Monolog/Logger.php(289): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)
#4 /var/www/vendor/monolog/monolog/src/Monolog/Logger.php(467): Monolog\\Logger->addRecord(500, 'Fatal Parse Err...', Array)
#5 /var/www/vendor/symfony/symfony/src/Symfony/Component/Debug/ErrorHandler.php(490): Monolog\\Logger->log('critical', 'Fatal Parse Err...', Array)
#6 /var/www/vendor/symfony/symfony/src/Symfony/Component/Debug/ErrorHandler.php(565): Symfony\\Component\\Debug\\ErrorHandler->handleException(Object(Symfony\\Component\\Debug\\Exception\\FatalErrorException), Array)
#7 [internal function]: Symfony\\Component\\Debug\\ErrorHandler::handleFatalError()
#8 {main}"
    }
}
```
@yapro yapro changed the title Debugging problems in PhpStorm->Tools->Analyze StackTrace [ErrorHandler] Debugging problems in PhpStorm->Tools->Analyze StackTrace Dec 29, 2015
@yapro yapro changed the title [ErrorHandler] Debugging problems in PhpStorm->Tools->Analyze StackTrace [New feature] Debugging problems in PhpStorm->Tools->Analyze StackTrace Dec 29, 2015
@sstok
Copy link
Contributor

sstok commented Dec 29, 2015

Can you explain what problem you are actually experiencing? If you need the format in another format you can use a transformer to change the structured JSON object into another format.

@nicolas-grekas
Copy link
Member

👎 because it reduces the possible usages of the data in the json and because it breaks BC.
Can't you use a monolog transformation instead?

@yapro
Copy link
Contributor Author

yapro commented Dec 29, 2015

@nicolas-grekas @sstok how I can transform result from $exception->getTrace() to result which is returned from $exception->getTraceAsString(). Are you use PhpStorm->Tools->Analyze StackTrace ?

@nicolas-grekas
Copy link
Member

@yapro, I think symfony/monolog-bundle#153 will solve your issue
Btw, with #17202, errors won't be logged in the "php" channel anymore, but in the "request" one.

@yapro
Copy link
Contributor Author

yapro commented Jan 13, 2016

Tnx you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants