Skip to content

Commit 91b79fe

Browse files
Handling the exception properly; plus improved the error message
1 parent 8d645c3 commit 91b79fe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/dstack/_internal/cli/utils/common.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def configure_logging():
8282
stdout_handler.setLevel(settings.CLI_LOG_LEVEL)
8383
dstack_logger.addHandler(stdout_handler)
8484

85+
log_file = get_dstack_dir() / "logs" / "cli" / "latest.log"
8586
try:
8687
log_file = _get_cli_log_file()
8788
file_handler = logging.FileHandler(log_file)
@@ -93,8 +94,8 @@ def configure_logging():
9394
)
9495
file_handler.setLevel(settings.CLI_FILE_LOG_LEVEL)
9596
dstack_logger.addHandler(file_handler)
96-
except PermissionError as e:
97-
console.print(f"[warning]Warning: Cannot write to CLI log file: {e}[/]")
97+
except PermissionError:
98+
console.print(f"[warning]Couldn't write to {log_file} due to a permissions problem.[/]")
9899

99100
# the logger allows all messages, filtering is done by the handlers
100101
dstack_logger.setLevel(logging.DEBUG)

0 commit comments

Comments
 (0)