Suppose, you have a special log table of your application.
What do you think about creating a BLOB field for a possible stack trace ?
Logging is done to file as well, but it is not so convenient to read a text file, moreover database is more "accessible".