Macro Definition Vanishes

Every once in a while XWiki 10.7 (Windows 7, MySQL 5.7, Tomcat 8.5.24) forgets macro definitions. I have to dummy-save them, to get them registered again. Any idea, how this could happen? Thanks, Guido

Hi Guido. Hmm that doesn’t ring a bell.

Have you wiki restarted when you notice that the macro(s) are not available anymore?

If the wiki has not restarted then I don’t see how it can happen at all. The only way for a wiki macro to disappear is for it to be unregistered, i.e. the page it’s contained in has been deleted (or some manual scripting to explicitly remove it).

Actually I have an idea: When you modify a wiki macro’s page and save it, it’ll first unregister the macro and register it again. Maybe the registration fails for some reason (you should have info on the screen and in xwiki’s logs) and thus the macro is not available anymore?

@tmortagne: I see that in several places we only output debug logs on errors, this is weird to me and wrong. I think we should log as WARN, WDYT? Here are 2 places:

Seems it’s me who did this in https://github.com/xwiki/xwiki-platform/commit/30aab34bf8c00eea340fd028ada616eb694c6b4f#diff-c4f1be7828fa8a91bcfbc51639d40a98R112 :slight_smile: I don’t know why but it seems it would be hard for the user to know the problem. WDYT?

Okay, that helps. The macro is attached to an AppWithinMinutes page. I get very often errors when saving changes to an AppWithinMinutes (server not responding or the like). I’ll move the macro to a separate page.

Anyway, turning the debug messages into warning messages would help.

Cheers
Guido

Note that you can turn on debug logging for WikiMacroInitializerListener for ex, see screenshot:

18

Thanks!