Jump to content
Sign in to follow this  
Chethan M

Problem with re-directing report into log file

Recommended Posts

Hi,

I am trying to redirect report messages of all the components into a log file as shown below.

1. In top_test.h:

            UVM_FILE default_report;
           std::unique_ptr<std::ofstream> log_file;

2. In top_test.cpp: (At the end of build_phase, after instantiating top_env )

        auto m_uvm_root = uvm_root::get();
        m_uvm_root->set_report_severity_action_hier(UVM_INFO,    UVM_DISPLAY | UVM_LOG);
        m_uvm_root->set_report_severity_action_hier(UVM_WARNING, UVM_DISPLAY | UVM_COUNT | UVM_LOG);
        m_uvm_root->set_report_severity_action_hier(UVM_ERROR,   UVM_DISPLAY | UVM_COUNT | UVM_LOG);
        m_uvm_root->set_report_severity_action_hier(UVM_FATAL,   UVM_DISPLAY | UVM_EXIT  | UVM_LOG);

        log_file = std::unique_ptr<std::ofstream> (new std::ofstream("my_file.log"));
        if (log_file->is_open())
        {
            default_report = log_file.get();
            m_uvm_root->set_report_default_file_hier(default_report);
        }
        else 
        {
            UVM_ERROR(this->name(), "Unable to open my_file.log file");
        }

With the above code, messages in all components other than 'driver' and 'sequence_item' are re-directed into log file.

please let me know how to resolve this issue.

Kindly let me know more information is needed from my side.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×