Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

console.log

Bimmel
Contributor
December 5, 2013

I've been tooling around with an user macro that takes some content and manipulate via JavaScript. I have run into a problem with my script and decided to use the console.log method to debug my script issue. However, nothing returns via the console log. I test the variables by typing them directly into Chrome Dev command line and I see the variables getting changed or not as I expected with my script.

My Question is this: Is there something in Confluence blocking the output of the console.log method?

3 answers

0 votes
Aseem Parikh
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.
December 29, 2013

It works fine for me. Did you wrap your JS in a <script> tag? Here's what my full macro looks like:

## Macro title: My Macro
## Macro has a body: Y or N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: My Name
## Date created: dd/mm/yyyy
## Installed by: My Name

&lt;script type="text/javascript"&gt;
    var foo = "foo";
    console.log(foo);
&lt;/script&gt;

0 votes
Bimmel
Contributor
December 29, 2013

There's no errors in either the velocity markup or JS. Try it for yourself. Create a macro, set a variable to something and have the console.log method run that variable. Even simple tests like this come back empty but if I use the command line in Chrome Dev, I see that in fact that foo = "foo";

var foo = "foo";
console.log(foo);
0 votes
Aseem Parikh
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.
December 20, 2013

You might have a syntax error with your velocity markup. Keep an eye on the logs when your macro is executed.

[edit] I'm assuming that since you have the console open, you're keeping an eye out for JS errors

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, team '25 europe, atlassian event, barcelona 2025, jira, confluence, atlassian intelligence, rovo, ai-powered collaboration, developer tools, agile teams, digital transformation, teamwork solutions, atlassian conference, product announcements

🌆 Team '25 Europe registration is now open!

Join the largest European gathering of the Atlassian Community and reimagine what’s possible when great teams and transformative technology come together. Plus, grab your Super Fan ticket now and save over €1,000 on your pass before prices rise on 3 June.

Register now
AUG Leaders

Atlassian Community Events