You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This causes the logging settings to be overwritten for loggers defined by the users simply by importing the UnityToGymWrapper and leads to double printing (in red) in the console. Here is a minimal example to reproduce the issue:
import logging
import sys
from gym_unity.envs import UnityToGymWrapper
def create_logger(name, loglevel):
logger = logging.getLogger(name)
logger.setLevel(loglevel)
handler = logging.StreamHandler(stream=sys.stdout)
formatter = logging.Formatter(fmt=f'%(asctime)s - {name} - %(message)s', datefmt='%d/%m/%Y %H:%M:%S')
handler.setFormatter(formatter)
logger.addHandler(handler)
return logger
if __name__ == "__main__":
logger = create_logger(name="USER LOGGER", loglevel=logging.INFO)
for i in range(10):
logger.info(f"i={i}")
Which outputs:
(commenting out from gym_unity.envs import UnityToGymWrapper resolves the issue)
Suggested fix:
By simply setting the logging level for the logger instance only seem to solve the issue (Line 22 of gym_unity/envs/__init__.py):
logger.setLevel(logging.INFO)
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had activity in the last 28 days. It will be closed in the next 14 days if no further activity occurs. Thank you for your contributions.
stalebot
added
the
stale
Issues that have been idle for a while. Automatically closed by a bot if idle for too long.
label
Apr 17, 2022
This issue has been automatically closed because it has not had activity in the last 42 days. If this issue is still valid, please ping a maintainer. Thank you for your contributions.
I am using
Python 3.7.4
andgym_unity==0.23.0
In
gym_unity/envs/__init__.py
, the logging level is set globally:https://github.com/Unity-Technologies/ml-agents/blob/master/gym-unity/gym_unity/envs/__init__.py#L22
This causes the logging settings to be overwritten for loggers defined by the users simply by importing the
UnityToGymWrapper
and leads to double printing (in red) in the console. Here is a minimal example to reproduce the issue:Which outputs:
(commenting out
from gym_unity.envs import UnityToGymWrapper
resolves the issue)Suggested fix:
By simply setting the logging level for the logger instance only seem to solve the issue (Line 22 of
gym_unity/envs/__init__.py
):logger.setLevel(logging.INFO)
The text was updated successfully, but these errors were encountered: