orbeon / orbeon-forms

Orbeon Forms is an open source web forms solution. It includes an XForms engine, the Form Builder web-based form editor, and the Form Runner runtime.
http://www.orbeon.com/
GNU Lesser General Public License v2.1
518 stars 220 forks source link

Inspector improvement: logging console #5846

Open ebruchez opened 1 year ago

ebruchez commented 1 year ago

Originally a comment on #5799.

Ideas:

How would we tell <xf:message> to target the inspector console? Options:

I think it would be good to separate:

We could have:

Alternatively, we could introduce:

<xxf:log level="debug" value="..."/>

Does it make sense to split message/log? Maybe! Also, xxf:log would be shorter.

ebruchez commented 1 year ago

+1 today for traceing actions! This is essential. Could be done as part of the inspector, which this issue covers, or a separate console (#2169).

ebruchez commented 1 year ago

We still, as of Orbeon Forms 2022.1, have two formats of actions:

3855 covers migrating from the older format.

In either case, if we log "actions", we should log the higher-level actions, not their translation into lower-level XForms actions (even though that would already be useful compared to having nothing).

I think that this means that every action implementation in actions-20282.xsl (and actions.xsl if don't do #3855 first) should also (possibly optionally) generate an explicit log entry.

ebruchez commented 1 year ago

A log action should also have a name/category so that the logging console can filter on that:

<xxf:log name="orbeon.actions" level="debug" value="..."/>
ebruchez commented 1 year ago

Implementation possibilities:

You could imagine a lower-level approach where the entire logging system (we use slf4j/log4s) can be configured to redirect to the inspector. However, this doesn't seem easy to do and is probably too low-level.

So instead, if we'd like the output to go to a log file but optionally to the inspector, we should go through our own higher-level system.

ebruchez commented 1 year ago
ebruchez commented 11 months ago

One issue with xxf:log is that, if we use an XBL component for the console, and that component listens to events, events that are dispatched before the UI is ready, including logging happening in actions running before the controls are ready, will not show.

Solutions:

  1. buffer log events that happen before the UI is ready (but up to how many?) and dispatch them when the UI is ready
  2. have a more built-in "console server", or UI-less XBL components; but what this would do would be to buffer events anyway, if those have to be sent to a separate console anyway

So solution 1 is probably the way to go. The event buffer could have a certain limit, and be cleared as soon as the UI is ready or they are consumed, whichever comes first.