Any tips on debugging Bean Shell scripts?

Confluence User - 23 Apr, 2021

I'm looking for a way to inspect values within my script.

Is there a simple way to just output a string to the log in runtime?

LogUtil seems to require an exception....i just want to do something like method("some string") or some variable value shows up in the log...

beanshell;debug;log

7


23 Apr, 2021
confluenceUser
confluenceUser

System.out.println(variable here);

23 Apr, 2021
confluenceUser
confluenceUser

I also recommend that if you are developing or testing you regularly dump the catalina.out file. Don't delete it, just assign an empty string (so as not to lose the permissions). On Linux:

sudo echo -n "" > catalina.out
26 Apr, 2021
confluenceUser
confluenceUser

I am using the On-Demand environment and examining the 'Logs' section (below the Performance' module.

System.out.println("hello world");

doesn't appear in the log.

26 Apr, 2021
confluenceUser
1
confluenceUser

Ok, i found out how...


In the bean shell script:

import org.joget.commons.util.LogUtil;
.
.
LogUtil.info("ClassName","Message");

Shoulda searched the KB deeper..found this.

https://dev.joget.org/community/display/KBv4/Message+Logging+in+joget.log




26 Apr, 2021
confluenceUser
confluenceUser

Could be useful, haven't got a chance to test it out yet. Why clear the log regularly? is it for readability sake?

26 Apr, 2021
confluenceUser
confluenceUser

Instead of manually doing this, I would suggest using a utility like logrotate https://www.tecmint.com/install-logrotate-to-manage-log-rotation-in-linux/

27 Apr, 2021
confluenceUser
confluenceUser

Interesting to keep in mind. BTW, i'm not experienced in working with programming for Tomcat stack.

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print