Question:
I want when exception throw the exception error show in loggerThis is my Controller i add logger in this controller i only add visited page when i visited page that will show in logger the page is visited
Answer:
You can create anErrorController
to handle Exception, Refer to this simple Demo:Program.cs
(.Net 6), Configure the ExceptionHandlerIndex page visted

After throw an Exception, It will catch the error then log it.

If you have better answer, please add a comment about this, thank you!