Semantic logging - Log to Database

I have a requirement to check if the log to the database is successful else I have to change the listener to a flat file and log to the flat file.

I have been going through the reference document for Semantic Logging and there it says "The Semantic Logging Application Block uses the error codes listed in the following table to notify you of any problems it encounters at run time."

If you configure as above then you should be able to see failures (and retries, etc.) but it doesn't address your requirement to log the failed message to a "fallback" sink in the event of a failure. As far as I know this is not currently supported.
To get the exact behavior you are looking for I think you would have to write a custom sink that has the specific error handling you want.