How to add a universal form submit handler to ALL forms? Suppose i need to record all form submissions in a site, i mean all of them.
I would add a new submit handler to be executed after each forms submit handler, like $form['#submit'][] = 'log_submit' , right?

The problem is that some forms may not have the submit handler inside $form['#submit'] array but in $form['buttons'] or $form['#actions'] etc...

How would i add my own submit handler to ALL of these forms, in one hook_form_alter() and in a clean way?

Thanks
You can use hook_form_alter(&amp;$form, &amp;$form_state, $form_id) without traditional if inside. Then it'll work on all forms.

Problems start when submit handlers are attached not to form, but to buttons. If you have to take care about that, you will need to scan recursively form tree, find all elements with ['#submit'] set and attach your handler to them. to do this, write recursive* function. Drupal mixes properties with children elements, so to avoid scanning properties, use element_children(&amp;$elements, $sort = FALSE).

*Of course you can make it iterative, too, should be faster, but recursion is more intuitive approach.