Debugging, Console, Print

2 replies

clonex / Ivan Hudec

Customer, bbp_participant, community, sq-ultimate, contributor, author, editor, 271 replies.

Visit profile

8 years ago #114065

Hi SQ Team,

 

 

could you give us a little introduction about how to debug or print data in quant editor

 

 

There are TestOutput, SQUtils classes where are  methods which i expect are ready for this. Could you give us a short examples ?

 

Many Thanks

 

Clonex 

 

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

8 years ago #132474

I assume you want to log the data from snippets, right?

The easiest way is to use the build-in logging engine, it will then log your messages directly to the log file.

 

How to do it:

 

1. add two imports (or use Fix Imports after step 2.):

import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
 
2. add static final variable Log to the begining of any class, like this:
 
public class SQDefault extends OverviewTemplate {
    public static final Logger Log = LoggerFactory.getLogger(“name of logger”);
 
 
3. then you can use functions like:
Log.info(“your message”);
Log.debug(“your mesage”+number);
 
anywhere in the class, and the message will be writen to the QA log file.
 
 
You made a good point that it should be easier and beter documented to do this, we’ll add more documentation and better features for it in the new update.

Mark
StrategyQuant architect

0

clonex / Ivan Hudec

Customer, bbp_participant, community, sq-ultimate, contributor, author, editor, 271 replies.

Visit profile

8 years ago #132476

I assume you want to log the data from snippets, right?
The easiest way is to use the build-in logging engine, it will then log your messages directly to the log file.

How to do it:

1. add two imports (or use Fix Imports after step 2.):
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;

2. add static final variable Log to the begining of any class, like this:

public class SQDefault extends OverviewTemplate {
public static final Logger Log = LoggerFactory.getLogger(“name of logger”);

3. then you can use functions like:
Log.info(“your message”);
Log.debug(“your mesage”+number);

anywhere in the class, and the message will be writen to the QA log file.

You made a good point that it should be easier and beter documented to do this, we’ll add more documentation and better features for it in the new update.

Many thanks!

Odoslané z SM-G900F pomocou Tapatalku

0

Viewing 2 replies - 1 through 2 (of 2 total)