bugy / script-server

Web UI for your scripts with execution management
Other
1.55k stars 246 forks source link

--log-folder has no effects wrt logging.json #584

Closed dmarteau closed 1 year ago

dmarteau commented 1 year ago

Hi,

The --log-folder has no option if a file handler with path is defined in logging.json.

Trying to override the log folder to a existing location leads to the exception above. May be I do not understand the behavior of the option but I would expect that it overrides any other defined options.

Please could you clarify what we should expect from the --log-folder options ?

Thanks for bringing this project.

Running with the option --log-folder=/var/log/script-server leads to the following error:

est-script-server-script_server-1  | Traceback (most recent call last):
test-script-server-script_server-1  |   File "/usr/lib/python3.9/logging/config.py", line 564, in configure
test-script-server-script_server-1  |     handler = self.configure_handler(handlers[name])
test-script-server-script_server-1  |   File "/usr/lib/python3.9/logging/config.py", line 745, in configure_handler
test-script-server-script_server-1  |     result = factory(**kwargs)
test-script-server-script_server-1  |   File "/usr/lib/python3.9/logging/__init__.py", line 1142, in __init__
test-script-server-script_server-1  |     StreamHandler.__init__(self, self._open())
test-script-server-script_server-1  |   File "/usr/lib/python3.9/logging/__init__.py", line 1171, in _open
test-script-server-script_server-1  |     return open(self.baseFilename, self.mode, encoding=self.encoding,
test-script-server-script_server-1  | FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/script-server/logs/server.log'
test-script-server-script_server-1  | 
test-script-server-script_server-1  | The above exception was the direct cause of the following exception:
test-script-server-script_server-1  | 
test-script-server-script_server-1  | Traceback (most recent call last):
test-script-server-script_server-1  |   File "/usr/local/lib/script-server/launcher.py", line 11, in <module>
test-script-server-script_server-1  |     main.main()
test-script-server-script_server-1  |   File "src/main.py", line 74, in main
test-script-server-script_server-1  |     logging.config.dictConfig(log_config)
test-script-server-script_server-1  |   File "/usr/lib/python3.9/logging/config.py", line 809, in dictConfig
test-script-server-script_server-1  |     dictConfigClass(config).configure()
test-script-server-script_server-1  |   File "/usr/lib/python3.9/logging/config.py", line 571, in configure
test-script-server-script_server-1  |     raise ValueError('Unable to configure handler '
test-script-server-script_server-1  | ValueError: Unable to configure handler 'file'
bugy commented 1 year ago

Hi @dmarteau I believe it has the same root cause as #537 thanks for reporting

dmarteau commented 1 year ago

Yes, this is clearly a duplicate of #537 (also usiing docker for running the service).

Anyway thanks for sharing this, it really covers a basic need very efficiently.