Intercepting Sikuli logging
A previous thread that is closest to answering my current question is:
https:/
in which RaiMan suggest the usage of a setSikuliXLogCa
I searched the net for setSikuliXLogCa
I recently started looking into Sikuli using IDE first, then I moved onto using standalone Jython, and then finally had the courage to venture into using Ruby, which is the primary language of my test framework.
I was pleasantly surprised how easy and great the interface was. Kudos to RaiMan and contributors on this great tool.
Now, onto my question...
I can redirect the java output to a single log file via Debug.setLogFil
My test framework, however, uses Log4R which direct the log output to multiple files as well as the console.
Ideally I would like to redirect the logging requests to my logger to do it's thing, so that I can get all the output like:
[LOG] CLICK on L(27,10)@S(0)[0,0 1440x900]
in the standard log files.
I kind-a implemented a workaround that does this as follows:
1. I put in a one-line callback patch in the native_
2. Redirected the java logs to a temp file first, by defining and calling the following:
module SikuliLib
def self.log_
@@log_file = log_file
Debug.
end
3. Captured the original logoutput and logged it via myLogger as such:
module SikuliX4Ruby
def self.post_
file = SikuliLib.log_file
File.
FileUtils.rm file
end
end
My workaround does the trick for now, but I'm not happy about the fact that I had to copy and patch the sikulix.rb file.
I would rather not muck with original SikuliX distribution files and use a callback that is officially supported, if there is one (The previous question thread hinted that there might be one already.)
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Lev for more information if necessary.