Uploaded image for project: 'OpenAM Agents'
  1. OpenAM Agents
  2. AMAGENTS-4449

Replace hardcoded function names with _func_ macro in web agent log messages

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 5.8.2.1
    • 5.10.0
    • Web Agents

    Description

      This has been broadened from the initial example to the task of completely replacing (throughout the codebase) hardcoded function names used in debug level log messages with the C macro 'func' (with underscores). The initial example of where the current hardcoded names can go wrong follows below.

      This probably stems from refactoring of the code, any logging emitted from enforce_header_setting.c::set_headers_from_map() start with "do_header_set()" as an example:

      2021-07-19 23:53:05 GMT DEBUG   [31dfba38-e20d-c9d3-e4eb-35a5ede8b39c]: (source/enforce/enforce_header_setter.c:60) do_header_set(): clearing STEVE_UID
      2021-07-19 23:53:05 GMT DEBUG   [31dfba38-e20d-c9d3-e4eb-35a5ede8b39c]: (source/enforce/enforce_header_setter.c:60) do_header_set(): clearing STEVE_WAZ_HERE
      2021-07-19 23:53:05 GMT DEBUG   [31dfba38-e20d-c9d3-e4eb-35a5ede8b39c]: (source/enforce/enforce_header_setter.c:60) do_header_set(): clearing STEVE_WHAT_WHAT
      

      Reproduction Steps:
      Enable debug logging for the Agent

      Expected:

      2021-07-19 23:53:05 GMT DEBUG   [31dfba38-e20d-c9d3-e4eb-35a5ede8b39c]: (source/enforce/enforce_header_setter.c:60) set_headers_from_map: clearing STEVE_UID
      

      Actual:

      2021-07-19 23:53:05 GMT DEBUG   [31dfba38-e20d-c9d3-e4eb-35a5ede8b39c]: (source/enforce/enforce_header_setter.c:60) do_header_set(): clearing STEVE_UID
      2021-07-19 23:53:05 GMT DEBUG   [31dfba38-e20d-c9d3-e4eb-35a5ede8b39c]: (source/enforce/enforce_header_setter.c:60) do_header_set(): clearing STEVE_WAZ_HERE
      2021-07-19 23:53:05 GMT DEBUG   [31dfba38-e20d-c9d3-e4eb-35a5ede8b39c]: (source/enforce/enforce_header_setter.c:60) do_header_set(): clearing STEVE_WHAT_WHAT
      

      This isn't a terrible issue, given that the line number is in the logging, but can be confusing when the logging method doesn't match the actual method in the source code.

      Attachments

        Activity

          People

            steven.graham Steven Graham
            steven.graham Steven Graham
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: