mcpyproject / McPy

A open source Minecraft server written 100% in Python
GNU Affero General Public License v3.0
84 stars 15 forks source link

Not logging chat message #72

Closed Ow1e closed 3 years ago

Ow1e commented 3 years ago

Bug Description Chat is not being logged by logging import

To Reproduce

  1. Send Text in Minecraft
  2. No logging for message

Expected behaviour As in the code logging.info(message) in Connection.py its expected to be logged as info

Host system:

Geolykt commented 3 years ago

Cannot reproduce on my side where I am getting "[2021-05-07 21:23:50,708 - INFO - NETWORK_THREAD] \<emeric987> tt" as intended. Could be yet another OS-dependent bug (what's wrong with you python?)

hydrostaticcog commented 3 years ago

Great, more Mac errors. I will attempt to reproduce this bug soon, when u have access to my Mac.

Ow1e commented 3 years ago

I found a explanation to this issue: [https://docs.python.org/3/howto/logging.html#a-simple-example]() Example of this issue: import logging logging.warning('Watch out!') # will print a message to the console logging.info('I told you so') # will not print anything

Geolykt commented 3 years ago

I found a explanation to this issue: https://docs.python.org/3/howto/logging.html#a-simple-example Example of this issue: import logging logging.warning('Watch out!') # will print a message to the console logging.info('I told you so') # will not print anything

We are setting the log level in https://github.com/mcpyproject/McPy/blob/master/classes/mcPy/McPy.py#L57-L58 though. Though could you try to run the server with "--debug" to see if it works

hydrostaticcog commented 3 years ago

I can confirm that this bug does not seem to exist on Ubuntu Linux 20.04.2 LTS (Kernel 5.4).

hydrostaticcog commented 3 years ago

I can also confirm this bug on MacOS 10.10.5 (Yosemite)

ntoskrnl4 commented 3 years ago

ah fun, another MacOS one it seems. Can you try setting a breakpoint inside the program and checking the log level there? Just to make sure it didn't change out from under us

hydrostaticcog commented 3 years ago

Issue identified: if the debug option is not passed, it sets an empty logging format. I am creating a PR to resolve this now.

hydrostaticcog commented 3 years ago

Resolved by #73