How to get the error messages of sikuli program in my own log message?

Asked by Eva K

How to get the error messages in my own log instead of sikuli program log??
I should be able get all the error messages in my own created log.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Not clear what you are talking about.

Revision history for this message
Eva K (eva110000) said :
#2

It logs if there is an error.
Can I get the error messages in my log using file.write .

Revision history for this message
EdEd (sikuli-3-connelm) said :
#3

I have the same problem - if you find an answer I'd be very interested.

Because Sikuli log messages don't use Python's standard output, I'm not able to redirect them when I subclass sys.stdout.

Revision history for this message
RaiMan (raimund-hocke) said :
#4

@EdEd
In fact nearly all messages are produced on the Java level and captured by the IDE to display them in the message area.

Not tested yet:
using
java -jar path-to-sikuli-script.jar path-to-some.sikuli
to run a script from command line leaves the IDE totally aside and may give you a chance to do what you want.

Another possibility might be to use the respective java classes (Debug?) and the methods Sikuli Sorry, cvurr for your own logging.
Running the script from command line, you could pipe stdout to a file.
Since you seem to have already looked into the code: should be rather easy.

@Eva
Sorry, currently no easy way using the IDE.
Might be EdEd has an idea now ;-)

Revision history for this message
Eva K (eva110000) said :
#5

Can we try using trac ini for this process?

Revision history for this message
RaiMan (raimund-hocke) said :
#6

@ Eva
????????????????????????

- trac ini
sorry, what is it and what might it have to do with Sikuli?

- for this process?
what process?

Revision history for this message
Simon Pearson (spearson) said :
#7

Best guess to the origin of the trac ini comment - comes up a lot with logging searches:

http://sikuli.org/wiki/TracIni

Revision history for this message
Ramprasad (ramprasad-info) said :
#8

java -Xms64M -Xmx512M -jar "%SIKULI_HOME%\sikuli-script.jar" "file.sikuli" 2>&1 > log.txt

Sikuli logs will stored in log.txt. you can use print() in sikuli script to add your own logs.

Revision history for this message
Ramprasad (ramprasad-info) said :
#9

oops..sorry not read the above comment by RaiMan. He gave this option already

Revision history for this message
stewazy (stewazy) said :
#10

is there a try catch variant where in catch the error can be caught and logged into a .log or .txt file ?

Can you help with this problem?

Provide an answer of your own, or ask Eva K for more information if necessary.

To post a message you must log in.