Replace printing with logging (which doesn't work)