Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 756106a

Browse files
committedJul 18, 2024··
Add --log-dir flag
1 parent 59f1c56 commit 756106a

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed
 

‎CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
### Added
1616

1717
- Extra logging around the IDE spawn to help debugging.
18+
- Set `--log-dir` for debugging SSH connections. These logs go into
19+
`<data>/<domain>/logs` where `<domain>` is your Coder deployment's domain and
20+
`<data>` is `XDG_DATA_HOME` on Linux, `LOCALAPPDATA` on Windows, and
21+
`~/Library/Application Support` on macOS.
1822

1923
## 2.13.0 - 2024-07-16
2024

‎src/main/kotlin/com/coder/gateway/cli/CoderCLIManager.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ class CoderCLIManager(
129129
val remoteBinaryURL: URL = settings.binSource(deploymentURL)
130130
val localBinaryPath: Path = settings.binPath(deploymentURL, forceDownloadToData)
131131
val coderConfigPath: Path = settings.dataDir(deploymentURL).resolve("config")
132+
val coderLogPath: Path = settings.dataDir(deploymentURL).resolve("logs")
132133

133134
/**
134135
* Download the CLI from the deployment if necessary.
@@ -262,7 +263,10 @@ class CoderCLIManager(
262263
"--stdio",
263264
if (settings.disableAutostart && feats.disableAutostart) "--disable-autostart" else null,
264265
)
265-
val proxyArgs = baseArgs + listOfNotNull(if (feats.reportWorkspaceUsage) "--usage-app=jetbrains" else null)
266+
val proxyArgs = baseArgs + listOfNotNull(
267+
"--log-dir",
268+
escape(coderLogPath.toString()),
269+
if (feats.reportWorkspaceUsage) "--usage-app=jetbrains" else null)
266270
val backgroundProxyArgs = baseArgs + listOfNotNull(if (feats.reportWorkspaceUsage) "--usage-app=disable" else null)
267271
val extraConfig =
268272
if (settings.sshConfigOptions.isNotBlank()) {
@@ -368,6 +372,8 @@ class CoderCLIManager(
368372
if (contents != null) {
369373
settings.sshConfigPath.parent.toFile().mkdirs()
370374
settings.sshConfigPath.toFile().writeText(contents)
375+
// The Coder cli will *not* create the log directory.
376+
coderLogPath.toFile().mkdirs()
371377
}
372378
}
373379

@@ -453,7 +459,6 @@ class CoderCLIManager(
453459
Features()
454460
} else {
455461
Features(
456-
// Autostart with SSH was added in 2.5.0.
457462
disableAutostart = version >= SemVer(2, 5, 0),
458463
reportWorkspaceUsage = version >= SemVer(2, 13, 0),
459464
)

0 commit comments

Comments
 (0)
Please sign in to comment.