Core/Logging: Use correct realmId when logging to DB
Core/Logging: Add config option to enable/disable asyncronous logging (disabled by default)