Skip to content

[Feature]: Address cmor logging issues #291

@tomvothecoder

Description

@tomvothecoder

Is your feature request related to a problem?

  1. cmor logger messages are printed in the console during an e3sm_to_cmip run. However, they are not captured in the log file. We won't know if cmor is an issue when assessing a stack-trace in a log file, which can be an issue during debugging.

    Per ChatGPT:

    To capture all warnings and errors from the cmor module into the Python logger, you need to redirect the cmor module's logging output to Python's logging system. **The cmor module uses its own logging

    Use CMOR's logfile Parameter:

    Set the logfile parameter in cmor.setup() to a specific file. This ensures that CMOR logs are written to a file without interfering with stdout or stderr. You can then use Python's logging system to monitor or process this log file if needed.

    import cmor
    
    cmor.setup(
        inpath="path/to/tables",
        netcdf_file_action=cmor.CMOR_REPLACE,
        logfile="cmor.log"  # Logs will be written to this file
    )
  2. Lack of error-reporting to log-files when cmorizing exists prematurely

  • Perhaps cmor itself is responsible for lack of error messages
  • Perhaps cmor fails to return a “fail status” (so that E2C can tell something went wrong)
  1. [Feature]: Get cmor_logs outputs printed in main e3sm_to_cmip log and stdout/stderr #215

Describe the solution you'd like

Describe alternatives you've considered

We capture logs for cmor per variable, but not the actual cmor module logs (e.g., cmor.axis error)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestloggingRelated to logging output, either in the console or log file.

    Type

    No type

    Projects

    Status

    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions