Skip to content

Logging with log4m #245

Open
Open

Description

@tiborauer

Is your feature request related to a problem? Please describe.
aas_log needs more flexibility, content-awareness, and unified behaviour

Describe the solution you'd like
Rewrite aas_log based on log4m to support:

  • log levels with controllable reporting/crash
  • reference to calling function, which should be included in the log
  • log IDs to track logging specific logs with an option to display only once (local only)
  • log object should be included in aacache and passed to jobs
  • log object/information saved/returned by jobs in case of error

Activity

  1. AljenU commented on Sep 24, 2021

    @AljenU
    Collaborator

    Log4m works with a singleton logging object, it will be interesting to see if and how that can integrate with logging from the workers.

  2. tiborauer commented on Sep 25, 2021

    @tiborauer
    MemberAuthor

    I see what you mean. The object could be configured centrally and then saved into the aacache (aas_cache_put and aas_cache_get; I am happy to show you), which is passed to the workers. Then the actual worker could set the logfile path to the domain root (aas_getstudypath, aas_getsubjpath, and aas_getsesspath).

  3. AljenU commented on Nov 12, 2021

    @AljenU
    Collaborator
    1. The solution suggests to rewrite based on log4m. Although this may help for some of the items, it may make other ones more difficult to achieve. And, there is logging functionality already in aa. Thus, why not try to add these features to aas_log without log4m?

    2. What are the specific problems that each of the items is solving? What workflow is currently not possible because of it? (And if possible to say, does it look like it would be difficult to solve the issue by making changes to aas_log?)

  4. tiborauer commented on Nov 12, 2021

    @tiborauer
    MemberAuthor

    Ad 1.: I have no objections against extending aas_log; however, I thought using log4m would be an easier solution.

    Ad 2.: The current logging solution is not uniform and streamlined. There are already pieces of code (e.g. aap.gui_controls) and

    if ~aap.gui_controls.usecolouroutput
    style='text';
    elseif nargin < 4
    if ~isempty(strfind(msg,'ERROR')) && isfield(aap.gui_controls.colours,'error'), style = aap.gui_controls.colours.error;
    elseif ~isempty(strfind(msg,'WARNING')) && isfield(aap.gui_controls.colours,'warning'), style = aap.gui_controls.colours.warning;
    elseif ~isempty(strfind(msg,'INFO')) && isfield(aap.gui_controls.colours,'info'), style = aap.gui_controls.colours.info;
    else style='text';
    end
    end
    . However, the granularity of verbosity is low, and there is no tracking of logs; which are the most lacking features. They would allow more control over which messages to print out and how often. There are several cases when the same message is printed several times, which can be annoying and an inefficient use of the stdout/diary.

  5. AljenU commented on Nov 18, 2021

    @AljenU
    Collaborator

    Hm, maybe an easy first implementation, that does not require changing all existing aas_log statements, could be to use the log4m object within aas_log. That would make it more easy to have tracking of what messages have been displayed, and to disable certain warnings / errors temporarily. Setting verbose to -1 is currently very generic, whereas the comments where it is used indicate that it is mainly or a very specific use case.

  6. AljenU commented on Nov 18, 2021

    @AljenU
    Collaborator

    And, could then probably work on not having to pass aap into aas_log (init logging only once, though when exactly, after that settings are stored in the logging object).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions