Printing sampled values in separate log file

HI,

I am monitoring certain transactions in monitor component of my testbench. I would like to sample those transactions and print them in separate log file to make it easy for me to go through all at once. Is there way to do it? Whats the method and how it should be implemented?? An example would be better to understand. Thanks

In reply to manavshah33:

Try this (changing ovm to uvm)