In reply to hctseng:
You can use uvm_report_catcher. There are a number of example here or elsewhere you can search for.