Skip to content

Commit 8b1e667

Browse files
committed
By default, log only to stderr, and not to disk.
This fixes a common problem when running under VS Code, the user doesn't have permissions to create a `log` directory in the CWD. The old behavior can be re-enabled by setting RA_INTERNAL_MODE=1
1 parent 1875aa0 commit 8b1e667

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/ra_lsp_server/src/main.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use ra_lsp_server::Result;
66

77
fn main() -> Result<()> {
88
::std::env::set_var("RUST_BACKTRACE", "short");
9-
Logger::with_env_or_str("error")
10-
.duplicate_to_stderr(Duplicate::All)
11-
.log_to_file()
12-
.directory("log")
13-
.start()?;
9+
let logger = Logger::with_env_or_str("error").duplicate_to_stderr(Duplicate::All);
10+
match ::std::env::var("RA_INTERNAL_MODE") {
11+
Ok(ref v) if v == "1" => logger.log_to_file().directory("log").start()?,
12+
_ => logger.start()?,
13+
};
1414
log::info!("lifecycle: server started");
1515
match ::std::panic::catch_unwind(main_inner) {
1616
Ok(res) => {

0 commit comments

Comments
 (0)