Skip to content

Log files don't appear when running MUSE from a Python script #600

@tsmbland

Description

@tsmbland

If you run muse from the command line (e.g. muse settings.toml), you'll get a couple of log files appearing in the results folder.

Another way of running MUSE is from a Python script, for example:

from logging import getLogger
from muse.mca import MCA
from muse.readers.toml import read_settings
from pathlib import Path

current_script_path = Path(__file__).resolve()
path_settings = current_script_path.parent / 'settings.toml'
settings = read_settings(path_settings)
getLogger("muse").setLevel(settings.log_level)
model = MCA.factory(settings)
model.run()

However, in this case the log files don't appear.

We could make users call add_file_logger() manually when running muse from a script, but it would be nice if this was the default behaviour without users having to do this

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions