When you write UnitAutomatedTests try to capture(assert) the Business/Functional/Behavioral Requirements.
How you log an exception is a very minute implementation detail
So writing and asserting this in a UnitTest makes that test very fragile – it will change very often
For Erroneous situations just assert that the expected exception is thrown(exception type and error code) and then how we log that Exception is a separate concern (and a very small implementation detail)
Otherwise every time you improve the log message, you have to change the UnitTest