py4j / py4j

Py4J enables Python programs to dynamically access arbitrary Java objects

Home Page:https://www.py4j.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Java Gateway does not log through logger

dcontador opened this issue · comments

Some Java Gateway messages are logged using the logging module directly, hence those messages ignore logging level set for py4j.

Particularly happens when any Python script using Spark (2.4.7 in Windows) closes, provoking one or more exceptions that cannot be hidden configuring the py4j logger:

ERROR:root:Exception while sending command.
Traceback (most recent call last):
File "C:\CESADAR\ATAVIA\PYTHON\lib\site-packages\py4j\java_gateway.py", line 1152, in send_command
answer = smart_decode(self.stream.readline()[:-1])
File "C:\CESADAR\ATAVIA\PYTHON\lib\socket.py", line 589, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [WinError 10054] Se ha forzado la interrupción de una conexión existente por el host remoto

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\CESADAR\ATAVIA\PYTHON\lib\site-packages\py4j\java_gateway.py", line 985, in send_command
response = connection.send_command(command)
File "C:\CESADAR\ATAVIA\PYTHON\lib\site-packages\py4j\java_gateway.py", line 1164, in send_command
"Error while receiving", e, proto.ERROR_ON_RECEIVE)
py4j.protocol.Py4JNetworkError: Error while receiving