# UVM Reporting

**URL:** <https://verificationacademy.com/forums/t/uvm-reporting/29791>\
**Category:** UVM\
**Tags:** UVM, UVM-Reporting\
**Created:** [August 8, 2014, 7:14am UTC](https://verificationacademy.com/forums/t/uvm-reporting/29791 "2014-08-08T07:14:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![deepak\_infy](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/a587f6/32.png) [@deepak\_infy](https://verificationacademy.com/forums/u/deepak_infy)\
**Post date:** [August 8, 2014, 7:14am UTC](https://verificationacademy.com/forums/t/uvm-reporting/29791/1 "2014-08-08T07:14:30Z")

</div>

UVM Reporting

Hi,

I am new to UVM and I have a conceptual doubts on how to use uvm reporting.

I got a BFM, which will display all the trasacastions handled. Now I need to redirect all messages to a log file.

Can somebody please explain how do it with an example.

Thanks,  
Deepak

---

<div class="post-metadata">

**Author:** ![deepak\_infy](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/a587f6/32.png) [@deepak\_infy](https://verificationacademy.com/forums/u/deepak_infy)\
**Post date:** [August 8, 2014, 9:52am UTC](https://verificationacademy.com/forums/t/uvm-reporting/29791/2 "2014-08-08T09:52:54Z")

</div>

_In reply to [deepak\_infy](https://verificationacademy.com/forums/t/uvm-reporting/29791):_

I tried the below code:

```verilog
class file_test extends pcie_top_base_test;
 // component macro
  `uvm_component_utils(file_test)
int fh, fh1;
  // component constructor
  function new(string name, uvm_component parent);
    super.new(name, parent);
  endfunction : new
  function void build_phase(uvm_phase phase);
   super.build_phase(phase);
    uvm_config_wrapper::set(this, "tb.pcie_tx_env.tl_tx_env.tl_tx_agent.tl_tx_sequencer.run_phase",
                            "default_sequence",
                            pack_tl_pkt::type_id::get());
  endfunction : build_phase

virtual task run();
  fh = $fopen ("my_test_fh.log","w"); // opening two text files
  fh1= $fopen ("my_test_fh1.log","w");
  //uvm_top.set_report_default_file_hier(); 
  uvm_top.set_report_default_file(fh1); // setting default write file as fh1
 
 `uvm_info(get_name(),"Hello world",UVM_LOW) // this will be printed only to terminal/ simulation log
                                                          // since 'set_report_severity_action' is not yet set
 
  $fdisplay(fh,"fdisplay - Hello world"); // will be written irrespective of 'set_report_*' setting
 
  uvm_top.set_report_severity_action(UVM_INFO, UVM_LOG); // redirecting `ovm_info ony to text file
 
 `uvm_info(get_name(),"My world",UVM_LOW) // will be in text file my_test_fh1.log
  $fdisplay(fh,"fdisplay - My world");
  uvm_top.set_report_default_file(fh); // setting default to fh, here after all `ovm_info woll be 
                                                          // directed to fh
                                                          // instead of fh1
 
uvm_top.set_report_severity_action(UVM_INFO, UVM_LOG | UVM_DISPLAY ); // setting `ovm_info to be directed to my_test_fh.log 
                                                          // and to terminal/ simulation log
 
  $fdisplay(fh1,"fdisplay1 - My world");
 `uvm_info(get_name(),"My last world :-) ",UVM_LOW) // will be in text file my_test_fh.log 
                                                          // and in terminal/ simulation log
 
  $fclose(fh);
  $fclose(fh1);
endtask:run

endclass :file_test

```

But nothing is written into file. I am not sure if I am missing something.

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [August 8, 2014, 3:10pm UTC](https://verificationacademy.com/forums/t/uvm-reporting/29791/3 "2014-08-08T15:10:29Z")

</div>

You set the file logging correctly for the uvm\_top (used by info messages that are not components), but none of its children. Add the "_hier" suffix to your set\_report_\* calls.
