In Mendix, log categories ("nodes" in the internal pub sub handling) are created when something is logged to them the first time. Since Mendix 6, it's possible to set log levels for nodes that do not exist yet, which makes it possible to set log levels to a value at startup of the application before actually starting to process log messages (the start_logging admin api call).
So, allow configuring log levels in the config file, and have them set up during start.
Previously params for the set_log_level admin call would be {"subscriber": subscriber, "node": node, "level": level}.
Three changes have been made to the API:
Instead of "node" and "level", another param "nodes" can be provided, in which case "node" and "level" will be ignored. "nodes" has to be a list of dictionaries containing "name" and "level" as fields.
The "subscriber" param can be omitted (or explicitely set to the value "*"), in which case the log level will be set for all active subscribers.
A "force" param is added, which changes the behavior if the specified node name is not found: instead of erroring, it will create it.
Since the original set_log_level call is overloaded with new behavior, the caller has to determine if this new functionality is available based on Mendix Version, it's not possible to dynamically find out except for a trial and error method.
What's the idea for m2ee-tools?
The existing change log level command stays the same
In the config file, we want to be able to provide a mapping of node and level which will be set early.
Related proposal: #6 I'm not going to merge this, since it also starts overloading configuration file structures and internal functions with different sorts of behavior, resulting in a forest of if else.
Implementation proposal:
Per logsubscriber section in the config, allow setting "loglevel" which simply contains a mapping of node -> level for all levels that we initially want to set.
Use the client set_log_level call to set create these loglevels with the nodes + force param, keep the code path separate from the CLI path.
In Mendix, log categories ("nodes" in the internal pub sub handling) are created when something is logged to them the first time. Since Mendix 6, it's possible to set log levels for nodes that do not exist yet, which makes it possible to set log levels to a value at startup of the application before actually starting to process log messages (the start_logging admin api call).
So, allow configuring log levels in the config file, and have them set up during start.
Previously params for the set_log_level admin call would be {"subscriber": subscriber, "node": node, "level": level}.
Three changes have been made to the API:
Since the original set_log_level call is overloaded with new behavior, the caller has to determine if this new functionality is available based on Mendix Version, it's not possible to dynamically find out except for a trial and error method.
What's the idea for m2ee-tools?
Related proposal: #6 I'm not going to merge this, since it also starts overloading configuration file structures and internal functions with different sorts of behavior, resulting in a forest of if else.
Implementation proposal: