Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do I know if there are syntax errors in a user macro?

Mikel Rodriguez March 29, 2022

I'm writing a Confluence user macro and whenever I make a syntax error, the macro just stops showing up on the screen but I can't see anything in the Confluence log or anywhere else. So, how am I supposed to know what syntax error I have made?

1 answer

0 votes
Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 29, 2022

Hello @Mikel Rodriguez . As a fellow user macro enthusiast, I understand your pain. You have a few options, some more painful than others:

  • I use Notepad++ with a Velocity module. Not perfect, but it can make it easier to see missing parentheses.
  • I have tried using an IDE as it does tru syntax checking, but has a lot of overhead.
  • Setting up a plugin development environment. Seems a strange thing to do, but it does make sense as it spins up a local instance of Confluence, plus you get a console. As you add a user macro, you will see messages in the console that will indicate a syntax error (or incorrect object reference). The upside of this environment is that it allows you to package your user macros as a plugin for easier distribution (plus other features).

Generally, I build my macros up slowly, often creating small macros to just test one function.

Lastly, you can always started another question for the community to try to find what you can't see (so hard to see your own errors -- I know).

Mikel Rodriguez March 29, 2022

That's my problem, I've already set up a Confluence instance in my computer, I run it directly from Eclipse inside of a Tomcat server, and when there is an error rendering the macro, I look at the console and it's completely silent. I see no stack traces whatsoever. I've already configured log4j so that the root logger is INFO level and I've removed all specific loggers so that the INFO level applies to everything, and still I can't see any errors when I render the macro on a page. I see millions of messages as I've chosen a very verbose root logging level, but nothing related to the macro itself. Could you give me please some insight on what's happening to me? It's mind-boggling isn't it?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events