Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,295,328
Community Members
 
Community Events
165
Community Groups

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

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 Community Leader Mar 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).

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
Community showcase
Published in Confluence

Confluence: Where work and wellness meet

Feeling overwhelmed by the demands of work and life? With a 25% increase in the prevalence of anxiety and depression worldwide during the pandemic, for most of us, it’s a resounding yes . 🙋‍♀️ ...

889 views 11 26
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you