zed icon indicating copy to clipboard operation
zed copied to clipboard

If create/access `~/Library/Logs/Zed/Zed.log` failed, Zed can't be launched.

Open Wyvern opened this issue 1 year ago • 3 comments

Check for existing issues

  • [ ] Completed

Describe the bug / provide steps to reproduce it

Zed app launch need ~/Library/Logs/Zed/Zed.log file to be created, is it necessary? If some system disable log writing, you can't create/write log files to specific folder.

  1. Zed app launch shouldn't crash if log file can't be created or accessed.
  2. Zed.log file should set as an logging option NOT a requirement.

Environment

Zed: v0.123.3 (Zed) OS: macOS 14.3.0 Memory: 16 GiB Architecture: x86_64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

Wyvern avatar Feb 22 '24 17:02 Wyvern

Log file initialization happens here:

https://github.com/zed-industries/zed/blob/991c9ec441711a4c0b10ce595f3025f430123800/crates/zed/src/main.rs#L512-L534

We could output the whole thing into stdout, same as the if stdout_is_a_pty() branch above does.

Also, there's OpenLog action that has to be altered too: https://github.com/zed-industries/zed/blob/991c9ec441711a4c0b10ce595f3025f430123800/crates/zed/src/zed.rs#L473

SomeoneToIgnore avatar Feb 22 '24 19:02 SomeoneToIgnore

I am looking at the code now refactoring it. Do I simply default to stdout logger in case we can't open file or also provide a settings option to set explicitly log outputs?

dheeraj-coding avatar Feb 24 '24 20:02 dheeraj-coding

I would start with the simple approach first and, if that looks ok after implementing, give the options a stab.

I'm not sure options will work that well, because they are initialized way below main.rs (in zed.rs) and most probably that refactoring will be big.

SomeoneToIgnore avatar Feb 24 '24 20:02 SomeoneToIgnore