P.S.: I already tried the VM argument -Dlog4j.rootCategory=ERROR

It does not help. I get loggings of type DEBUG and INFO.

I can't pass the program argument -q because I run the Jython script.

The logging level can only be controlled from the command line.  I think you should be running your script using bin/maxq rather than directly using Jython.