We are logging any exceptions that happen in our system by writing the Exception.Message to a file. However, they are written in the culture of the client. And Turkish errors don't mean a lot to me.
So how can we log any error messages in English without changing the users culture?
Without WORKAROUNDS.
Tks :)
For Logging purposes, certain applications may need to fetch the English exception message (besides displaying it in the usual client's UICulture).
For that purpose, the following code
and then finally changes the current UICulture back to earlier UICulture.
You can search for the original exception message at unlocalize.com
You should log the call stack instead of just error message (IIRC, simple exception.ToString() should do that for you). From there, you can determine exactly where the exception originated from, and usually deduce which exception it is.
Override exception message in catch block using extension method, Check thrown message is from code or not as mentioned below.
I know this is an old topic, but I think my solution may be quite relevant to anyone who stumbles across it in a web search:
In the exception logger you could log ex.GetType.ToString, which would save the name of the exception class. I would expect that the name of a class ought to be independent of language and would therefore always be represented in English (e.g. "System.FileNotFoundException"), though at present I don't have access to a foreign language system to test out the idea.
If you really want the error message text as well you could create a dictionary of all possible exception class names and their equivalent messages in whatever language you prefer, but for English I think the class name is perfectly adequate.