Python logging calls result in Error in LogPython

My python script looks like this:

import logging
import unreal as ue

logging.basicConfig(level=logging.DEBUG)

# Print some project info
projSettings = ue.GeneralProjectSettings()
logging.info(projSettings.get_editor_property('company_name'))

As innocent as it is, the Output Log gives me:

LogPython: Error: INFO:root:MyCompany

Is it that the Python stdlibs are completely discouraged here or is this simply a bug?

Alright, I read from the doc that the preferred logging approach is unreal.log() API series. However, the python logging module has much-needed features such as including line numbers and function names. If Epic soft-bans logging (out of sanitation concerns) with that red-coded Error tag. I guess I’ll just have to compromise.

Have you tried creating a handler that pushes to unreal.log with the formatting you want? This was my next task…

The logging StreamHandler defaults to sys.stderr. You can switch it with:

logger = logging.getLogger(__name__)
logger.handlers.clear()
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
ch = logging.StreamHandler(stream=sys.stdout)
ch.setFormatter(formatter)
logger.addHandler(ch)