Substitute process ID for "PID" in log file names
This will help us solve the problem of logs getting clobbered when the server restarts.
This commit is contained in:
parent
c667a98923
commit
e2eda0a43f
1 changed files with 6 additions and 2 deletions
|
@ -644,14 +644,18 @@ namespace ts.server {
|
||||||
const cmdLineVerbosity = getLogLevel(findArgument("--logVerbosity"));
|
const cmdLineVerbosity = getLogLevel(findArgument("--logVerbosity"));
|
||||||
const envLogOptions = parseLoggingEnvironmentString(process.env.TSS_LOG);
|
const envLogOptions = parseLoggingEnvironmentString(process.env.TSS_LOG);
|
||||||
|
|
||||||
const logFileName = cmdLineLogFileName
|
const unsubstitutedLogFileName = cmdLineLogFileName
|
||||||
? stripQuotes(cmdLineLogFileName)
|
? stripQuotes(cmdLineLogFileName)
|
||||||
: envLogOptions.logToFile
|
: envLogOptions.logToFile
|
||||||
? envLogOptions.file || (__dirname + "/.log" + process.pid.toString())
|
? envLogOptions.file || (__dirname + "/.log" + process.pid.toString())
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
const substitutedLogFileName = unsubstitutedLogFileName
|
||||||
|
? unsubstitutedLogFileName.replace("PID", process.pid.toString())
|
||||||
|
: undefined;
|
||||||
|
|
||||||
const logVerbosity = cmdLineVerbosity || envLogOptions.detailLevel;
|
const logVerbosity = cmdLineVerbosity || envLogOptions.detailLevel;
|
||||||
return new Logger(logFileName!, envLogOptions.traceToConsole!, logVerbosity!); // TODO: GH#18217
|
return new Logger(substitutedLogFileName!, envLogOptions.traceToConsole!, logVerbosity!); // TODO: GH#18217
|
||||||
}
|
}
|
||||||
// This places log file in the directory containing editorServices.js
|
// This places log file in the directory containing editorServices.js
|
||||||
// TODO: check that this location is writable
|
// TODO: check that this location is writable
|
||||||
|
|
Loading…
Reference in a new issue