logging exception the code below allows to save the content of an exception in a text file. Here I\'m getting only the decription of the error.
I am only answering for the ask, other people have already mentioned about the code already. If you want the line number to be included in your log you need to include the generated debug files (pdb) in your deployment to the server. If its just your Dev/Test region that is fine but I don't recommend using in production.