janhq / cortex.cpp

Local AI API Platform
https://cortex.so
Apache License 2.0
2.04k stars 115 forks source link

bug: Multiprocess cannot write log to the same file #1056

Closed nguyenhoangthuan99 closed 1 month ago

nguyenhoangthuan99 commented 2 months ago

Problem In windows, once a file is taken by one process, other process can not modify it. For example, when the server is writing to log file, it hold cortex.log, and if we run CLI command, it cannot write message to cortex.log.

Solution In window, we are planning to use Unix Domain Socket to start a thread and write log to file. Below are detail implementation:

nguyenhoangthuan99 commented 1 month ago

For windows, we are planning to use Unix Domain Socket to communicate between process, only one process will write to log file

dan-homebrew commented 1 month ago

@nguyenhoangthuan99 Question from my side - did we consider having a separate log for CLI and Server?

nguyenhoangthuan99 commented 1 month ago

we will separate log for CLI and server, details in this comment