-
Notifications
You must be signed in to change notification settings - Fork 448
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
adding exception details to FileLogger #3486
Conversation
actualException = actualException.InnerException; | ||
} | ||
|
||
formattedMessage += $"{Environment.NewLine}{actualException.Message}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Full stack trace is useful. Especially for out-of-proc languages where there are compilation errors. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They won't want the .NET stack, though. That'll just show the executor, invoker, etc. I suspect that whatever message an out-of-proc language logs here will include the stack for that message. I'll give it a test with node really quick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. I just verified with your changes
Result: Failure
Exception: ReferenceError: coext is not defined
Stack: ReferenceError: coext is not defined
at module.exports (D:\pgopaGit\azure-functions-host\sample\Node\HttpTrigger\index.js:4:5)
at WorkerChannel.invocationRequest (D:\pgopaGit\azure-functions-host\src\WebJobs.Script.WebHost\bin\Debug\netcoreapp2.1\workers\node\worker-bundle.js:28843:26)
at ClientDuplexStream.WorkerChannel.eventStream.on (D:\pgopaGit\azure-functions-host\src\WebJobs.Script.WebHost\bin\Debug\netcoreapp2.1\workers\node\worker-bundle.js:28733:30)
at ClientDuplexStream.emit (events.js:182:13)
at addChunk (_stream_readable.js:283:12)
at readableAddChunk (_stream_readable.js:264:11)
at ClientDuplexStream.Readable.push (_stream_readable.js:219:10)
at Object.onReceiveMessage (D:\pgopaGit\azure-functions-host\src\WebJobs.Script.WebHost\bin\Debug\netcoreapp2.1\workers\node\worker-bundle.js:43673:19)
at InterceptingListener.module.exports.InterceptingListener.recvMessageWithContext (D:\pgopaGit\azure-functions-host\src\WebJobs.Script.WebHost\bin\Debug\netcoreapp2.1\workers\node\worker-bundle.js:43000:19)
at D:\folder\azure-functions-host\src\WebJobs.Script.WebHost\bin\Debug\netcoreapp2.1\workers\node\worker-bundle.js:43099:14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wrote some nonsense in a js script and ran it. Before this change it looks like this in the file log:
2018-09-19T17:02:38.394 [Error] Executed 'Functions.HttpTrigger' (Failed, Id=74640518-a61d-4806-abcb-00676be13dca)
Now it looks like:
2018-09-19T16:59:52.268 [Error] Executed 'Functions.HttpTrigger' (Failed, Id=15486ec0-7fcd-4d41-8abb-ed75158ec90b)
Result: Failure
Exception: ReferenceError: gds is not defined
Stack: ReferenceError: gds is not defined
at module.exports (C:\git\brettsam\azure-functions-host\sample\Node\HttpTrigger\index.js:10:5)
at WorkerChannel.invocationRequest (c:\git\brettsam\azure-functions-host\src\WebJobs.Script.WebHost\bin\Debug\netcoreapp2.1\workers\node\worker-bundle.js:28843:26)
at ClientDuplexStream.WorkerChannel.eventStream.on (c:\git\brettsam\azure-functions-host\src\WebJobs.Script.WebHost\bin\Debug\netcoreapp2.1\workers\node\worker-bundle.js:28733:30)
at ClientDuplexStream.emit (events.js:182:13)
at addChunk (_stream_readable.js:283:12)
at readableAddChunk (_stream_readable.js:264:11)
at ClientDuplexStream.Readable.push (_stream_readable.js:219:10)
at Object.onReceiveMessage (c:\git\brettsam\azure-functions-host\src\WebJobs.Script.WebHost\bin\Debug\netcoreapp2.1\workers\node\worker-bundle.js:43673:19)
at InterceptingListener.module.exports.InterceptingListener.recvMessageWithContext (c:\git\brettsam\azure-functions-host\src\WebJobs.Script.WebHost\bin\Debug\netcoreapp2.1\workers\node\worker-bundle.js:43000:19)
at c:\git\brettsam\azure-functions-host\src\WebJobs.Script.WebHost\bin\Debug\netcoreapp2.1\workers\node\worker-bundle.js:43099:14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Fixes #3481
Replacement for #3482
The FileLogger wasn't logging any exception details. This is a port of the v1 behavior from: https://github.com/Azure/azure-functions-host/blob/v1.x/src/WebJobs.Script/Diagnostics/FileTraceWriter.cs#L203-L222