简体   繁体   中英

c# log4net not logging line number of exception

In my local code base, my log file logs the exact line number where the exception took place. However, my boss just sent me a log file from a client, and I don't see a single line number in the log. Is there a setting I am missing to log the line number for a deployed application?

If you want line numbers in your logged stack trace you have to deploy the matching .pdb files. Even then the line numbers might not match the source code if you compiled with Optimize code enabled (recommended for prod builds).

Note that as well as having a .pdb file - it must be the correct one. If it's a stale/old version of the file, the framework detects that and falls back to quietly just not logging the line numbers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM