[TEST] LoggingListener to restore the initial logger levels after any modification

Modifications to LoggingListener pushed with #8820 caused the original logger levels not to be reset after modifications, as the new state was saved for restore instead of the previous one.

 Added unit tests for LoggingListener as well.

Closes #8845