Change:
This doesn't get logged when creating a terminal with trace logging on
I tried to do this like you and Jackson did for the on the branch merogge/remote-inv, but i'm still not seeing the logs anywhere when using remote WSL. Thoughts? Need this to investigate remote terminal reconnection bc when ssh'ing to localhost, I can't repro the issue and don't want to have to setup a vm.
maybe bc it's in platform instead of workbench it's not working? can't be in workbench though for the ptyService
instead of an output channel I think what we're after is something like this: Here: I thought that's what the LogLevelChannel was doing but maybe not? Or maybe that particular log service/channel type doesn't work on the server since it does in the shared process? !

Discussion:
ShellIntegrationCommandHistory = 'terminal.integrated.shellIntegration.history' } <ins> export const enum TerminalLogConstants { FileName = 'ptyhost' } </ins> export const enum PosixShellType { PowerShell = 'pwsh', Bash = 'bash',

*  Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ <ins> import { join } from 'vs/base/common/path'; </ins> import { ProxyChannel } from 'vs/base/parts/ipc/common/ipc'; import { Server } from 'vs/base/parts/ipc/node/ipc.cp'; <del> import { ConsoleLogger, LogService } from 'vs/platform/log/common/log'; </del> <ins> import { OPTIONS, parseArgs } from 'vs/platform/environment/node/argv'; import { NativeEnvironmentService } from 'vs/platform/environment/node/environmentService'; import { ConsoleLogger, getLogLevel, LogService, MultiplexLogService } from 'vs/platform/log/common/log'; </ins> import { LogLevelChannel } from 'vs/platform/log/common/logIpc'; <del> import { IReconnectConstants, TerminalIpcChannels } from 'vs/platform/terminal/common/terminal'; </del> <ins> import { SpdLogLogger } from 'vs/platform/log/node/spdlogLog'; import product from 'vs/platform/product/common/product'; import { IProductService } from 'vs/platform/product/common/productService'; import { IReconnectConstants, TerminalIpcChannels, TerminalLogConstants } from 'vs/platform/terminal/common/terminal'; </ins> import { HeartbeatService } from 'vs/platform/terminal/node/heartbeatService'; import { PtyService } from 'vs/platform/terminal/node/ptyService';

const lastPtyId = parseInt(process.env.VSCODE_LAST_PTY_ID || '0'); delete process.env.VSCODE_LAST_PTY_ID; <del> const logService = new LogService(new ConsoleLogger()); const logChannel = new LogLevelChannel(logService); server.registerChannel(TerminalIpcChannels.Log, logChannel); </del> <ins> // Logging const productService: IProductService = { _serviceBrand: undefined, ...product }; const environmentService = new NativeEnvironmentService(parseArgs(process.argv, OPTIONS), productService); const logService = new LogService(new MultiplexLogService([ new ConsoleLogger(), new SpdLogLogger(TerminalLogConstants.FileName, join(environmentService.logsPath, `${TerminalLogConstants.FileName}.log`), true, false, getLogLevel(environmentService)) ])); const logLevelChannel = new LogLevelChannel(logService); server.registerChannel(TerminalIpcChannels.Log, logLevelChannel); </ins> const heartbeatService = new HeartbeatService(); server.registerChannel(TerminalIpcChannels.Heartbeat, ProxyChannel.fromService(heartbeatService));

private _startPtyHost(): [Client, IPtyService] { const opts: IIPCOptions = { serverName: 'Pty Host', <del> args: ['--type=ptyHost'], </del> <ins> args: ['--type=ptyHost', '--logsPath', this._environmentService.logsPath], </ins> env: { VSCODE_LAST_PTY_ID: lastPtyId, VSCODE_AMD_ENTRYPOINT: 'vs/platform/terminal/node/ptyHostMain',

import { IDownloadService } from 'vs/platform/download/common/download'; import { DownloadServiceChannel } from 'vs/platform/download/common/downloadIpc'; import { timeout } from 'vs/base/common/async'; <ins> import { TerminalLogConstants } from 'vs/platform/terminal/common/terminal'; </ins> export class LabelContribution implements IWorkbenchContribution { constructor(

if (remoteEnv) { const outputChannelRegistry = Registry.as<IOutputChannelRegistry>(OutputExt.OutputChannels); outputChannelRegistry.registerChannel({ id: 'remoteExtensionLog', label: localize('remoteExtensionLog', "Remote Server"), file: joinPath(remoteEnv.logsPath, `${RemoteExtensionLogFileName}.log`), log: true }); <ins> outputChannelRegistry.registerChannel({ id: 'remotePtyHostLog', label: localize('remotePtyHostLog', "Remote Pty Host"), file: joinPath(remoteEnv.logsPath, `${TerminalLogConstants.FileName}.log`), log: true }); </ins> } }); }

*  Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ <ins> import { URI } from 'vs/base/common/uri'; import { Disposable, toDisposable } from 'vs/base/common/lifecycle'; </ins> import { Schemas } from 'vs/base/common/network'; <ins> import { localize } from 'vs/nls'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IFileService } from 'vs/platform/files/common/files'; </ins> import { ILabelService } from 'vs/platform/label/common/label'; <ins> import { ILogService } from 'vs/platform/log/common/log'; </ins> import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; import { ITerminalEditorService, ITerminalGroupService, ITerminalService, terminalEditorId } from 'vs/workbench/contrib/terminal/browser/terminal'; import { terminalStrings } from 'vs/workbench/contrib/terminal/common/terminalStrings'; import { IEditorResolverService, RegisteredEditorPriority } from 'vs/workbench/services/editor/common/editorResolverService'; <ins> import { registerLogChannel } from 'vs/workbench/services/output/common/output'; import { join } from 'vs/base/common/path'; import { TerminalLogConstants } from 'vs/platform/terminal/common/terminal'; </ins> /** * The main contribution for the terminal contrib. This contains calls to other components necessary * to set up the terminal but don't need to be tracked in the long term (where TerminalService would * be more relevant). */ <del> export class TerminalMainContribution implements IWorkbenchContribution { </del> <ins> export class TerminalMainContribution extends Disposable implements IWorkbenchContribution { </ins> constructor( @IEditorResolverService editorResolverService: IEditorResolverService, <ins> @IEnvironmentService environmentService: IEnvironmentService, @IFileService private readonly _fileService: IFileService, </ins> @ILabelService labelService: ILabelService, <ins> @ILogService private readonly _logService: ILogService, </ins> @ITerminalService terminalService: ITerminalService, @ITerminalEditorService terminalEditorService: ITerminalEditorService, @ITerminalGroupService terminalGroupService: ITerminalGroupService ) { <ins> super(); </ins> // Register terminal editors editorResolverService.registerEditor( `${Schemas.vscodeTerminal}:/**`,

separator: '' } }); <ins> // Register log channel this._registerLogChannel('ptyHostLog', localize('ptyHost', "Pty Host"), URI.file(join(environmentService.logsPath, `${TerminalLogConstants.FileName}.log`))); } private _registerLogChannel(id: string, label: string, file: URI): void { const promise = registerLogChannel(id, label, file, this._fileService, this._logService); this._register(toDisposable(() => promise.cancel())); </ins> } }