Skip to content
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

Log exception causes no logging at all #7305

Closed
robsch opened this issue Feb 16, 2015 · 4 comments
Closed

Log exception causes no logging at all #7305

robsch opened this issue Feb 16, 2015 · 4 comments
Assignees
Labels
Milestone

Comments

@robsch
Copy link

robsch commented Feb 16, 2015

When I call Yii::error(new Exception('asdf')); nothing gets logged. Even other loggings are then ignored for the current request.

Is this a bug? Or not? At least it would be nice if I could easily log an exception. Like described here I'd like to log it easily if possible.

Using Yii2 2.0.2.

@samdark
Copy link
Member

samdark commented Feb 16, 2015

Message parameter accepts string, not an instance of Exception.

@samdark samdark closed this as completed Feb 16, 2015
@robsch
Copy link
Author

robsch commented Feb 16, 2015

Documentation says:

Info: Log messages can be strings as well as complex data, such as arrays or objects.

http://www.yiiframework.com/doc-2.0/guide-runtime-logging.html#log-messages

@samdark samdark reopened this Feb 16, 2015
@samdark samdark added type:bug Bug status:to be verified Needs to be reproduced and validated. labels Feb 16, 2015
@samdark samdark added this to the 2.0.x milestone Feb 16, 2015
@cebe
Copy link
Member

cebe commented May 15, 2015

the problem in this case seems to be that the exception includes a stack trace of the point where it was created. This stack trace also contains pointers to all the object references of functions being called and also their arguments. If this contains a closure at some point (which it does), the var_export here is going to fail:

$output = 'unserialize(' . var_export(serialize($var), true) . ')';

The fallback then fails because of a circular reference.

@cebe cebe self-assigned this May 15, 2015
@cebe cebe modified the milestones: 2.0.5, 2.0.x May 15, 2015
cebe added a commit to yiisoft/yii2-debug that referenced this issue May 15, 2015
@cebe cebe closed this as completed in dd19955 May 15, 2015
@cebe
Copy link
Member

cebe commented May 15, 2015

fixed, thanks for reporting!

@cebe cebe removed the status:to be verified Needs to be reproduced and validated. label May 15, 2015
cebe added a commit that referenced this issue May 15, 2015
cebe added a commit that referenced this issue Aug 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants