views:

16

answers:

1

We currently have a simple Log class that can take in an exception. In our business logic if we happen to need a try/catch around a specific set of code, we log the exception and then rethrow it. The problem is that our Log class is in a common dll and when it writes the log I want to be able to also grab the path of the offending code (e.g. "D:\application\libraries"). Is there a simple way to do this without always having to pass in the executing assembly path to the logger each time?

Edit: Forgot to mention we're using C# 4.0.

A: 

Have you tried with Assembly.GetCallingAssembly() inside your log method?

Sebastian Piu
Seems to work although I will have to do some string formatting to make it look "pretty" but it does get the job done. Thanks.
phreak3eb