Skip to content

Commit

Permalink
Ensure structured logging file exists before running a query
Browse files Browse the repository at this point in the history
  • Loading branch information
aeisenberg committed Mar 2, 2022
1 parent 2579d12 commit b4f63e8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions extensions/ql-vscode/src/queryserver-client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as cp from 'child_process';
import * as path from 'path';
import * as fs from 'fs-extra';

import { DisposableObject } from './pure/disposable-object';
import { Disposable, CancellationToken, commands } from 'vscode';
import { createMessageConnection, MessageConnection, RequestType } from 'vscode-jsonrpc';
Expand Down Expand Up @@ -149,8 +151,11 @@ export class QueryServerClient extends DisposableObject {
}

if (await this.cliServer.cliConstraints.supportsStructuredEvalLog()) {
const structuredLogFile = `${this.opts.contextStoragePath}/structured-evaluator-log.json`;
await fs.ensureFile(structuredLogFile);

args.push('--evaluator-log');
args.push(`${this.opts.contextStoragePath}/structured-evaluator-log.json`);
args.push(structuredLogFile);

// We hard-code the verbosity level to 5 and minify to false.
// This will be the behavior of the per-query structured logging in the CLI after 2.8.3.
Expand All @@ -163,7 +168,7 @@ export class QueryServerClient extends DisposableObject {
}

if (cli.shouldDebugQueryServer()) {
args.push('-J=-agentlib:jdwp=transport=dt_socket,address=localhost:9010,server=y,suspend=n,quiet=y');
args.push('-J=-agentlib:jdwp=transport=dt_socket,address=localhost:9010,server=n,suspend=y,quiet=y');
}

const child = cli.spawnServer(
Expand Down

0 comments on commit b4f63e8

Please sign in to comment.