Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-26088

Unmask LSST_LOG_CONFIG for setting log config

    XMLWordPrintable

Details

    • 1
    • DM Science
    • No

    Description

      lsst.log allows its config to be set via a configuration file at the LSST_LOG_CONFIG environment variable. However currently this feature cannot be used with the PipelineTask framework, because it resets the logging properties.

      It'd be convenient if this reset can be skipped while a configuration file is provided.

      Attachments

        Activity

          The main desire here is to have a way to not reset the log config in every pipetask, and to use a customized log config. 

          I was thinking an alternative could be to have a command line option to skip the log-config reset.  Then I realized npease is refactoring these into the new Click-based command lines and found more discussions in Nate's tickets (though with a different focus there).  So...would this be an acceptable fix for the old pipetask and leave the bigger question to be fixed in the new pipetask2? Thoughts?

          hchiang2 Hsin-Fang Chiang added a comment - The main desire here is to have a way to not reset the log config in every pipetask, and to use a customized log config.  I was thinking an alternative could be to have a command line option to skip the log-config reset.  Then I realized npease is refactoring these into the new Click-based command lines and found more discussions in Nate's tickets (though with a different focus there).  So...would this be an acceptable fix for the old pipetask and leave the bigger question to be fixed in the new pipetask2? Thoughts?

          I think it's a reasonable approach, we should have though about that case before. I don't remember how pipetask2 handles that now, paging npease to have a look.

          salnikov Andy Salnikov added a comment - I think it's a reasonable approach, we should have though about that case before. I don't remember how pipetask2 handles that now, paging npease to have a look.

          pipetask2 log init is very similar to pipetask. Is the proposal to look for a LSST_LOG_CONFIG variable, and skip log init if it exists? That seems fine to me.

           

          npease Nate Pease [X] (Inactive) added a comment - pipetask2 log init is very similar to pipetask. Is the proposal to look for a LSST_LOG_CONFIG variable, and skip log init if it exists? That seems fine to me.  

          npease, yes, I think the same approach should be used in pipetask2 when you initialize logging - if LSST_LOG_CONFIG is defined and points to an existing file then skip initialization, log will then self-initialize using LSST_LOG_CONFIG file.

          salnikov Andy Salnikov added a comment - npease , yes, I think the same approach should be used in pipetask2 when you initialize logging - if LSST_LOG_CONFIG is defined and points to an existing file then skip initialization, log will then self-initialize using LSST_LOG_CONFIG file.

          Thank you both!

          One possible drawback could be that if someone sets LSST_LOG_CONFIG to a bad configuration file, log wouldn't get configured. But if a user sets the env var it's probably okay to assume the user would be responsible of setting sensible config. Additionally, use cases like DM-14068 might be solved by using LSST_LOG_CONFIG.

          Merged.

          hchiang2 Hsin-Fang Chiang added a comment - Thank you both! One possible drawback could be that if someone sets LSST_LOG_CONFIG to a bad configuration file, log wouldn't get configured. But if a user sets the env var it's probably okay to assume the user would be responsible of setting sensible config. Additionally, use cases like DM-14068 might be solved by using LSST_LOG_CONFIG. Merged.

          People

            hchiang2 Hsin-Fang Chiang
            hchiang2 Hsin-Fang Chiang
            Andy Salnikov
            Andy Salnikov, Hsin-Fang Chiang, Nate Pease [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Jenkins

                No builds found.