sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #30992
[Question #263462]: Redirecting the Sikuli Logger and the "setLogger: Jython init: we have problems" Error
New question #263462 on Sikuli:
https://answers.launchpad.net/sikuli/+question/263462
Hi,
I am trying to redirect log messages as explained here: http://sikulix-2014.readthedocs.org/en/latest/scripting.html#writing-and-redirecting-log-and-debug-messages.
Unfortunately, when I try to "Debug.setLogger(obj)" I get an error:
[setLogger: Jython init: we have problems
%s] org.sikuli.scriptrunner.ScriptRunner
Here is an example of what I am trying in the interactive Jython Console:
C:\>echo %CLASSPATH% "<- This works :D"
C:\SikuliX1.1\sikulixapi.jar; "<- This works :D"
C:\>jython
Jython 2.7b4 (default:3672e624962a, Feb 13 2015, 04:59:14)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_71
Type "help", "copyright", "credits" or "license" for more information.
>>> import org.sikuli.basics.SikulixForJython
>>> from sikuli import *
>>> class myLogger():
... def callback(message):
... print "CUSTOM LOG!"
... print message
...
>>> Debug.setLogger(myLogger())
[setLogger: Jython init: we have problems
%s] org.sikuli.scriptrunner.ScriptRunner
>>> Debug.setLoggerAll("callback")
False
>>> App.focus("This window does not exist; an error will be generated")
[log] App.focus This window does not exist; an error will be generated(0) #0
[error] App.focus failed: This window does not exist; an error will be generated not found
Clearly the logger has not been redirected.
Additionally, with regard to the example in the link, why isn't the callback function defined as:
def callback(self, message):
? Doesn't python treat the first arg as an explicit instance reference?
Any help is appreciated!
(NOTE: I am using the current nightly build: sikuli 2015-01-16_01:00nightly)
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.