Community discussions

MikroTik App
 
jphconstantin
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 88
Joined: Fri Sep 22, 2017 7:17 pm
Location: Switzerland

How to debug a script ?

Fri Dec 29, 2017 6:00 pm

I added script in /system logging but I see nothing in the log window when I execute a script.
What is missing ?
ccr1009-7g-1c-pc
router os v 6.46.4
 
User avatar
sebastia
Forum Guru
Forum Guru
Posts: 1797
Joined: Tue Oct 12, 2010 3:23 am
Location: Antwerp, BE

Re: How to debug a script ?

Sun Dec 31, 2017 4:59 pm

Hi

You'll need to add some logging code into your script example:

:log info "Hello world!"
 
jphconstantin
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 88
Joined: Fri Sep 22, 2017 7:17 pm
Location: Switzerland

Re: How to debug a script ?

Tue Jan 02, 2018 8:03 pm

Can I display variables ?
ccr1009-7g-1c-pc
router os v 6.46.4
 
toffifee
just joined
Posts: 3
Joined: Tue Jan 02, 2018 7:46 pm
Location: Germany

Re: How to debug a script ?

Tue Jan 02, 2018 8:12 pm

:log info "Variable $var"
 
User avatar
sebastia
Forum Guru
Forum Guru
Posts: 1797
Joined: Tue Oct 12, 2010 3:23 am
Location: Antwerp, BE

Re: How to debug a script ?

Wed Jan 03, 2018 12:06 am

Sure
:local msg "world!"
:log info "Hello $msg"
 
User avatar
noyo
Member Candidate
Member Candidate
Posts: 114
Joined: Sat Jan 28, 2012 12:25 am
Location: Mazury - Poland
Contact:

Re: How to debug a script ?

Wed Jan 03, 2018 12:12 am

:do { ***command*** } on-error={ ***run if error command*** }
 
tangram
Member Candidate
Member Candidate
Posts: 133
Joined: Wed Nov 16, 2016 9:55 pm

Re: How to debug a script ?

Mon Jan 08, 2018 2:46 pm

also you can run "/system script print" to do a syntax debug.

Who is online

Users browsing this forum: No registered users and 30 guests