Open connoramoreno opened 6 months ago
Here's the most promising solution I could find. Unfortunately, I don't think that PyStell-UW's logging is handled by the logger manager, since it seems the logger dictionary mentioned in the article only contains logger objects, which PyStell-UW doesn't create. Here's the output from printing the logger dictionary, in case I'm missing something:
{ 'PIL': <logging.PlaceHolder object at 0x7f8db6a4ce90>,
'PIL.Image': <Logger PIL.Image (WARNING)>,
'PIL.PngImagePlugin': <Logger PIL.PngImagePlugin (WARNING)>,
'ezdxf': <Logger ezdxf (WARNING)>,
'fontTools': <Logger fontTools (WARNING)>,
'fontTools.misc': <logging.PlaceHolder object at 0x7f8da24b4c90>,
'fontTools.misc.configTools': <Logger fontTools.misc.configTools (WARNING)>,
'fontTools.misc.fixedTools': <Logger fontTools.misc.fixedTools (WARNING)>,
'fontTools.misc.roundTools': <Logger fontTools.misc.roundTools (WARNING)>,
'fontTools.ttLib': <Logger fontTools.ttLib (WARNING)>,
'fontTools.ttLib.sfnt': <Logger fontTools.ttLib.sfnt (WARNING)>,
'fontTools.ttLib.ttCollection': <Logger fontTools.ttLib.ttCollection (WARNING)>,
'fontTools.ttLib.ttFont': <Logger fontTools.ttLib.ttFont (WARNING)>,
'matplotlib': <Logger matplotlib (WARNING)>,
'matplotlib._afm': <Logger matplotlib._afm (WARNING)>,
'matplotlib._constrained_layout': <Logger matplotlib._constrained_layout (WARNING)>,
'matplotlib._layoutgrid': <Logger matplotlib._layoutgrid (WARNING)>,
'matplotlib.artist': <Logger matplotlib.artist (WARNING)>,
'matplotlib.axes': <logging.PlaceHolder object at 0x7f8db599ec50>,
'matplotlib.axes._axes': <Logger matplotlib.axes._axes (WARNING)>,
'matplotlib.axes._base': <Logger matplotlib.axes._base (WARNING)>,
'matplotlib.axis': <Logger matplotlib.axis (WARNING)>,
'matplotlib.backend_bases': <Logger matplotlib.backend_bases (WARNING)>,
'matplotlib.category': <Logger matplotlib.category (WARNING)>,
'matplotlib.colorbar': <Logger matplotlib.colorbar (WARNING)>,
'matplotlib.dates': <Logger matplotlib.dates (WARNING)>,
'matplotlib.dviread': <Logger matplotlib.dviread (WARNING)>,
'matplotlib.figure': <Logger matplotlib.figure (WARNING)>,
'matplotlib.font_manager': <Logger matplotlib.font_manager (WARNING)>,
'matplotlib.gridspec': <Logger matplotlib.gridspec (WARNING)>,
'matplotlib.image': <Logger matplotlib.image (WARNING)>,
'matplotlib.lines': <Logger matplotlib.lines (WARNING)>,
'matplotlib.mathtext': <Logger matplotlib.mathtext (WARNING)>,
'matplotlib.pyplot': <Logger matplotlib.pyplot (WARNING)>,
'matplotlib.style': <logging.PlaceHolder object at 0x7f8db594d310>,
'matplotlib.style.core': <Logger matplotlib.style.core (WARNING)>,
'matplotlib.texmanager': <Logger matplotlib.texmanager (WARNING)>,
'matplotlib.text': <Logger matplotlib.text (WARNING)>,
'matplotlib.textpath': <Logger matplotlib.textpath (WARNING)>,
'matplotlib.ticker': <Logger matplotlib.ticker (WARNING)>,
'packaging': <logging.PlaceHolder object at 0x7f8db5489050>,
'packaging.tags': <Logger packaging.tags (WARNING)>,
'parastell': <logging.PlaceHolder object at 0x7f8da4737cd0>,
'parastell.log': <Logger parastell.log (INFO)>,
'pkg_resources': <logging.PlaceHolder object at 0x7f8d9e8bcf50>,
'pkg_resources.extern': <logging.PlaceHolder object at 0x7f8d9e8bcf90>,
'pkg_resources.extern.packaging': <logging.PlaceHolder object at 0x7f8d9e8bced0>,
'pkg_resources.extern.packaging.tags': <Logger pkg_resources.extern.packaging.tags (WARNING)>}
I think it makes sense to PR into pystell_UW to introduce logger objects...
It seems that logging to the command line is being duplicated, as exemplified below:
I believe this issue is stemming from PyStell-UW since the logging format of the duplicate lines follow that specified in
read_vmec.py
, exemplified by the first logging output line,WARNING:root:...
, which is raised inread_vmec.py
. Moreover, this issue does not occur when using ParaStell functionality that does not rely on PyStell-UW (e.g., a script that only importsmagnet_coils
).Poking around in
read_vmec.py
a bit, I think the issue is that its logging does not occur via aLogger
object, but rather directly usinglogging
function calls (e.g.,logging.warning(...)
,logging.error(...)
, etc.).If need be, I can create an issue or PR in PyStell-UW but in the interest of expediency, I'm hoping there's a solution I can implement in ParaStell instead. I haven't been able to find anything online so far.