Define CIVICRM_LOGGING_DSN in PHP?
It's not a setting you can set with Civi::settings. You can set it with a define() anywhere outside of civicrm.settings.php, but it would need to run that section in your file before running the code where it gets used, so somewhere pretty early in a page run. It always falls back to CIVICRM_DSN if CIVICRM_LOGGING_DSN is not set, if your setting runs too late.