EnergySystemsModellingLab / EnergySystemsModellingLab/MUSE_OS

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

Open
#600 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
29
Forks
12
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.