Merge pull request #7906 from overleaf/em-downgrade-logs

Downgrade all INFO logs to DEBUG

GitOrigin-RevId: 05ed582ef0721fcada059f0ad158565f50feca27
This commit is contained in:
Eric Mc Sween
2022-05-17 08:05:26 +00:00
committed by Copybot
parent efcb06f0df
commit e0d91eaa26
116 changed files with 487 additions and 423 deletions
+13 -11
View File
@@ -258,13 +258,13 @@ Settings.processTooOld = false
if (Settings.processLifespanLimitMs) {
Settings.processLifespanLimitMs +=
Settings.processLifespanLimitMs * (Math.random() / 10)
logger.info(
logger.debug(
'Lifespan limited to ',
Date.now() + Settings.processLifespanLimitMs
)
setTimeout(() => {
logger.log('shutting down, process is too old')
logger.debug('shutting down, process is too old')
Settings.processTooOld = true
}, Settings.processLifespanLimitMs)
}
@@ -276,10 +276,10 @@ function runSmokeTest() {
smokeTest.lastRunSuccessful() &&
Date.now() - CompileController.lastSuccessfulCompile < INTERVAL / 2
) {
logger.log('skipping smoke tests, got recent successful user compile')
logger.debug('skipping smoke tests, got recent successful user compile')
return setTimeout(runSmokeTest, INTERVAL / 2)
}
logger.log('running smoke tests')
logger.debug('running smoke tests')
smokeTest.triggerRun(err => {
if (err) logger.error({ err }, 'smoke tests failed')
setTimeout(runSmokeTest, INTERVAL)
@@ -300,7 +300,7 @@ app.get('/smoke_test_force', (req, res) => smokeTest.sendNewResult(res))
app.use(function (error, req, res, next) {
if (error instanceof Errors.NotFoundError) {
logger.log({ err: error, url: req.url }, 'not found error')
logger.debug({ err: error, url: req.url }, 'not found error')
return res.sendStatus(404)
} else if (error.code === 'EPIPE') {
// inspect container returns EPIPE when shutting down
@@ -362,19 +362,19 @@ const loadHttpServer = express()
loadHttpServer.post('/state/up', function (req, res, next) {
STATE = 'up'
logger.info('getting message to set server to down')
logger.debug('getting message to set server to down')
return res.sendStatus(204)
})
loadHttpServer.post('/state/down', function (req, res, next) {
STATE = 'down'
logger.info('getting message to set server to down')
logger.debug('getting message to set server to down')
return res.sendStatus(204)
})
loadHttpServer.post('/state/maint', function (req, res, next) {
STATE = 'maint'
logger.info('getting message to set server to maint')
logger.debug('getting message to set server to maint')
return res.sendStatus(204)
})
@@ -407,7 +407,7 @@ if (!module.parent) {
if (error) {
logger.fatal({ error }, `Error starting CLSI on ${host}:${port}`)
} else {
logger.info(`CLSI starting up, listening on ${host}:${port}`)
logger.debug(`CLSI starting up, listening on ${host}:${port}`)
}
})
@@ -415,14 +415,16 @@ if (!module.parent) {
if (error != null) {
throw error
}
return logger.info(`Load tcp agent listening on load port ${loadTcpPort}`)
return logger.debug(`Load tcp agent listening on load port ${loadTcpPort}`)
})
loadHttpServer.listen(loadHttpPort, host, function (error) {
if (error != null) {
throw error
}
return logger.info(`Load http agent listening on load port ${loadHttpPort}`)
return logger.debug(
`Load http agent listening on load port ${loadHttpPort}`
)
})
}
+1 -1
View File
@@ -14,7 +14,7 @@ if ((Settings.clsi != null ? Settings.clsi.dockerRunner : undefined) === true) {
} else {
commandRunnerPath = './LocalCommandRunner'
}
logger.info({ commandRunnerPath }, 'selecting command runner for clsi')
logger.debug({ commandRunnerPath }, 'selecting command runner for clsi')
const CommandRunner = require(commandRunnerPath)
module.exports = CommandRunner
+2 -2
View File
@@ -72,7 +72,7 @@ module.exports = CompileController = {
status = `validation-${error.validate}`
} else if (error != null ? error.timedout : undefined) {
status = 'timedout'
logger.log(
logger.debug(
{ err: error, project_id: request.project_id },
'timeout running compile'
)
@@ -245,7 +245,7 @@ module.exports = CompileController = {
if (image && !isImageNameAllowed(image)) {
return res.status(400).send('invalid image')
}
logger.log({ image, file, project_id }, 'word count request')
logger.debug({ image, file, project_id }, 'word count request')
return CompileManager.wordcount(
project_id,
+9 -6
View File
@@ -69,7 +69,7 @@ function doCompile(request, callback) {
COMPILE_TIME_BUCKETS
)
const timer = new Metrics.Timer('write-to-disk', 1, request.metricsOpts)
logger.log(
logger.debug(
{ projectId: request.project_id, userId: request.user_id },
'syncing resources to disk'
)
@@ -95,7 +95,7 @@ function doCompile(request, callback) {
)
return callback(error)
}
logger.log(
logger.debug(
{
projectId: request.project_id,
userId: request.user_id,
@@ -257,7 +257,7 @@ function doCompile(request, callback) {
Metrics.gauge('load-avg', loadavg[0])
}
const ts = timer.done()
logger.log(
logger.debug(
{
projectId: request.project_id,
userId: request.user_id,
@@ -498,7 +498,10 @@ function syncFromPdf(projectId, userId, page, h, v, imageName, callback) {
if (error != null) {
return callback(error)
}
logger.log({ projectId, userId, page, h, v, stdout }, 'synctex pdf output')
logger.debug(
{ projectId, userId, page, h, v, stdout },
'synctex pdf output'
)
callback(null, SynctexOutputParser.parseEditOutput(stdout, baseDir))
})
}
@@ -561,7 +564,7 @@ function _runSynctex(projectId, userId, command, imageName, callback) {
}
function wordcount(projectId, userId, filename, image, callback) {
logger.log({ projectId, userId, filename, image }, 'running wordcount')
logger.debug({ projectId, userId, filename, image }, 'running wordcount')
const filePath = `$COMPILE_DIR/${filename}`
const command = [
'texcount',
@@ -607,7 +610,7 @@ function wordcount(projectId, userId, filename, image, callback) {
return callback(err)
}
const results = _parseWordcountFromOutput(stdout)
logger.log(
logger.debug(
{ projectId, userId, wordcount: results },
'word count results'
)
+16 -16
View File
@@ -10,7 +10,7 @@ const Path = require('path')
const _ = require('lodash')
const ONE_HOUR_IN_MS = 60 * 60 * 1000
logger.info('using docker runner')
logger.debug('using docker runner')
function usingSiblingContainers() {
return (
@@ -36,7 +36,7 @@ const DockerRunner = {
) {
if (usingSiblingContainers()) {
const _newPath = Settings.path.sandboxedCompilesHostDir
logger.log(
logger.debug(
{ path: _newPath },
'altering bind path for sibling containers'
)
@@ -85,14 +85,14 @@ const DockerRunner = {
// logOptions = _.clone(options)
// logOptions?.HostConfig?.SecurityOpt = "secomp used, removed in logging"
logger.log({ projectId }, 'running docker container')
logger.debug({ projectId }, 'running docker container')
DockerRunner._runAndWaitForContainer(
options,
volumes,
timeout,
(error, output) => {
if (error && error.statusCode === 500) {
logger.log(
logger.debug(
{ err: error, projectId },
'error running container so destroying and retrying'
)
@@ -118,7 +118,7 @@ const DockerRunner = {
},
kill(containerId, callback) {
logger.log({ containerId }, 'sending kill signal to container')
logger.debug({ containerId }, 'sending kill signal to container')
const container = dockerode.getContainer(containerId)
container.kill(error => {
if (
@@ -193,7 +193,7 @@ const DockerRunner = {
if (options != null && options.HostConfig != null) {
options.HostConfig.SecurityOpt = null
}
logger.log({ exitCode, options }, 'docker container has exited')
logger.debug({ exitCode, options }, 'docker container has exited')
callbackIfFinished()
})
}
@@ -352,7 +352,7 @@ const DockerRunner = {
callback = _.once(callback)
const { name } = options
logger.log({ container_name: name }, 'starting container')
logger.debug({ container_name: name }, 'starting container')
const container = dockerode.getContainer(name)
function createAndStartContainer() {
@@ -412,7 +412,7 @@ const DockerRunner = {
attachStartCallback()
}
logger.log({ containerId }, 'attached to container')
logger.debug({ containerId }, 'attached to container')
const MAX_OUTPUT = 1024 * 1024 // limit output to 1MB
function createStringOutputStream(name) {
@@ -469,13 +469,13 @@ const DockerRunner = {
let timedOut = false
const timeoutId = setTimeout(() => {
timedOut = true
logger.log({ containerId }, 'timeout reached, killing container')
logger.debug({ containerId }, 'timeout reached, killing container')
container.kill(err => {
logger.warn({ err, containerId }, 'failed to kill container')
})
}, timeout)
logger.log({ containerId }, 'waiting for docker container')
logger.debug({ containerId }, 'waiting for docker container')
container.wait((error, res) => {
if (error != null) {
clearTimeout(timeoutId)
@@ -483,13 +483,13 @@ const DockerRunner = {
return callback(error)
}
if (timedOut) {
logger.log({ containerId }, 'docker container timed out')
logger.debug({ containerId }, 'docker container timed out')
error = new Error('container timed out')
error.timedout = true
callback(error)
} else {
clearTimeout(timeoutId)
logger.log(
logger.debug(
{ containerId, exitCode: res.StatusCode },
'docker container returned'
)
@@ -518,7 +518,7 @@ const DockerRunner = {
},
_destroyContainer(containerId, shouldForce, callback) {
logger.log({ containerId }, 'destroying docker container')
logger.debug({ containerId }, 'destroying docker container')
const container = dockerode.getContainer(containerId)
container.remove({ force: shouldForce === true, v: true }, error => {
if (error != null && error.statusCode === 404) {
@@ -531,7 +531,7 @@ const DockerRunner = {
if (error != null) {
logger.error({ err: error, containerId }, 'error destroying container')
} else {
logger.log({ containerId }, 'destroyed container')
logger.debug({ containerId }, 'destroyed container')
}
callback(error)
})
@@ -548,7 +548,7 @@ const DockerRunner = {
const age = now - created
const maxAge = DockerRunner.MAX_CONTAINER_AGE
const ttl = maxAge - age
logger.log(
logger.debug(
{ containerName: name, created, now, age, maxAge, ttl },
'checking whether to destroy container'
)
@@ -579,7 +579,7 @@ const DockerRunner = {
},
startContainerMonitor() {
logger.log(
logger.debug(
{ maxAge: DockerRunner.MAX_CONTAINER_AGE },
'starting container expiry'
)
+1 -1
View File
@@ -32,7 +32,7 @@ module.exports = DraftModeManager = {
return callback()
}
const modified_content = DraftModeManager._injectDraftOption(content)
logger.log(
logger.debug(
{
content: content.slice(0, 1024), // \documentclass is normally v near the top
modified_content: modified_content.slice(0, 1024),
+2 -2
View File
@@ -51,7 +51,7 @@ module.exports = LatexRunner = {
timeout = 60000
} // milliseconds
logger.log(
logger.debug(
{
directory,
compiler,
@@ -169,7 +169,7 @@ module.exports = LatexRunner = {
callback = function () {}
}
const id = `${project_id}`
logger.log({ id }, 'killing running compile')
logger.debug({ id }, 'killing running compile')
if (ProcessTable[id] == null) {
logger.warn({ id }, 'no such project to kill')
return callback(null)
+3 -3
View File
@@ -17,7 +17,7 @@ const { spawn } = require('child_process')
const _ = require('lodash')
const logger = require('@overleaf/logger')
logger.info('using standard command runner')
logger.debug('using standard command runner')
module.exports = CommandRunner = {
run(
@@ -35,7 +35,7 @@ module.exports = CommandRunner = {
command = Array.from(command).map(arg =>
arg.toString().replace('$COMPILE_DIR', directory)
)
logger.log({ project_id, command, directory }, 'running command')
logger.debug({ project_id, command, directory }, 'running command')
logger.warn('timeouts and sandboxing are not enabled with CommandRunner')
// merge environment settings
@@ -69,7 +69,7 @@ module.exports = CommandRunner = {
proc.on('close', function (code, signal) {
let err
logger.info({ code, signal, project_id }, 'command exited')
logger.debug({ code, signal, project_id }, 'command exited')
if (signal === 'SIGTERM') {
// signal from kill method below
err = new Error('terminated')
+2 -2
View File
@@ -464,7 +464,7 @@ module.exports = OutputCacheManager = {
OutputCacheManager.ARCHIVE_SUBDIR,
buildId
)
logger.log({ dir: archiveDir }, 'archiving log files for project')
logger.debug({ dir: archiveDir }, 'archiving log files for project')
return fse.ensureDir(archiveDir, function (err) {
if (err != null) {
return callback(err)
@@ -577,7 +577,7 @@ module.exports = OutputCacheManager = {
const removeDir = (dir, cb) =>
fse.remove(Path.join(cacheRoot, dir), function (err, result) {
logger.log({ cache: cacheRoot, dir }, 'removed expired cache dir')
logger.debug({ cache: cacheRoot, dir }, 'removed expired cache dir')
if (err != null) {
logger.error({ err, dir }, 'cache remove error')
}
+1 -1
View File
@@ -53,7 +53,7 @@ module.exports = OutputFileFinder = {
'f',
'-print',
]
logger.log({ args }, 'running find command')
logger.debug({ args }, 'running find command')
const proc = spawn('find', args)
let stdout = ''
+1 -1
View File
@@ -71,7 +71,7 @@ module.exports = OutputFileOptimiser = {
}
const tmpOutput = dst + '.opt'
const args = ['--linearize', '--newline-before-endstream', src, tmpOutput]
logger.log({ args }, 'running qpdf command')
logger.debug({ args }, 'running qpdf command')
const timer = new Metrics.Timer('qpdf')
const proc = spawn('qpdf', args)
@@ -121,7 +121,7 @@ module.exports = ProjectPersistenceManager = {
if (error != null) {
return callback(error)
}
logger.log({ project_ids }, 'clearing expired projects')
logger.debug({ project_ids }, 'clearing expired projects')
const jobs = Array.from(project_ids || []).map(project_id =>
(
project_id => callback =>
@@ -152,7 +152,7 @@ module.exports = ProjectPersistenceManager = {
if (callback == null) {
callback = function () {}
}
logger.log({ project_id, user_id }, 'clearing project for user')
logger.debug({ project_id, user_id }, 'clearing project for user')
return CompileManager.clearProject(project_id, user_id, function (error) {
if (error != null) {
return callback(error)
@@ -173,7 +173,7 @@ module.exports = ProjectPersistenceManager = {
if (callback == null) {
callback = function () {}
}
logger.log({ project_id }, 'clearing project from cache')
logger.debug({ project_id }, 'clearing project from cache')
return UrlCache.clearProject(project_id, function (error) {
if (error != null) {
logger.err({ error, project_id }, 'error clearing project from cache')
@@ -212,7 +212,7 @@ module.exports = ProjectPersistenceManager = {
},
}
logger.log(
logger.debug(
{ EXPIRY_TIMEOUT: ProjectPersistenceManager.EXPIRY_TIMEOUT },
'project assets kept timeout'
)
+3 -3
View File
@@ -26,7 +26,7 @@ module.exports = {
const stateFile = Path.join(basePath, this.SYNC_STATE_FILE)
if (state == null) {
// remove the file if no state passed in
logger.log({ state, basePath }, 'clearing sync state')
logger.debug({ state, basePath }, 'clearing sync state')
fs.unlink(stateFile, function (err) {
if (err && err.code !== 'ENOENT') {
return callback(err)
@@ -35,7 +35,7 @@ module.exports = {
}
})
} else {
logger.log({ state, basePath }, 'writing sync state')
logger.debug({ state, basePath }, 'writing sync state')
const resourceList = resources.map(resource => resource.path)
fs.writeFile(
stateFile,
@@ -67,7 +67,7 @@ module.exports = {
const resourceList = array.slice(0, adjustedLength - 1)
const oldState = array[adjustedLength - 1]
const newState = `stateHash:${state}`
logger.log(
logger.debug(
{ state, oldState, basePath, stateMatches: newState === oldState },
'checking sync state'
)
+3 -3
View File
@@ -32,7 +32,7 @@ module.exports = ResourceWriter = {
callback = function () {}
}
if (request.syncType === 'incremental') {
logger.log(
logger.debug(
{ project_id: request.project_id, user_id: request.user_id },
'incremental sync'
)
@@ -77,7 +77,7 @@ module.exports = ResourceWriter = {
}
)
}
logger.log(
logger.debug(
{ project_id: request.project_id, user_id: request.user_id },
'full sync'
)
@@ -160,7 +160,7 @@ module.exports = ResourceWriter = {
if (err.code === 'EEXIST') {
return callback()
} else {
logger.log({ err, dir: basePath }, 'error creating directory')
logger.debug({ err, dir: basePath }, 'error creating directory')
return callback(err)
}
} else {
+6 -3
View File
@@ -29,7 +29,10 @@ module.exports = TikzManager = {
}
for (const resource of Array.from(resources)) {
if (resource.path === 'output.tex') {
logger.log({ compileDir, mainFile }, 'output.tex already in resources')
logger.debug(
{ compileDir, mainFile },
'output.tex already in resources'
)
return callback(null, false)
}
}
@@ -55,7 +58,7 @@ module.exports = TikzManager = {
: undefined) >= 0
const usesPsTool =
(content != null ? content.indexOf('{pstool}') : undefined) >= 0
logger.log(
logger.debug(
{ compileDir, mainFile, usesTikzExternalize, usesPsTool },
'checked for packages needing main file as output.tex'
)
@@ -82,7 +85,7 @@ module.exports = TikzManager = {
if (error != null) {
return callback(error)
}
logger.log(
logger.debug(
{ compileDir, mainFile },
'copied file to output.tex as project uses packages which require it'
)
+4 -4
View File
@@ -61,7 +61,7 @@ module.exports = UrlFetcher = {
3 * oneMinute
)
logger.log({ url, filePath }, 'started downloading url to cache')
logger.debug({ url, filePath }, 'started downloading url to cache')
const urlStream = request.get({ url, timeout: oneMinute })
urlStream.pause() // stop data flowing until we are ready
@@ -74,7 +74,7 @@ module.exports = UrlFetcher = {
})
urlStream.on('end', () =>
logger.log({ url, filePath }, 'finished downloading file into cache')
logger.debug({ url, filePath }, 'finished downloading file into cache')
)
return urlStream.on('response', function (res) {
@@ -97,7 +97,7 @@ module.exports = UrlFetcher = {
})
fileStream.on('finish', function () {
logger.log({ url, filePath }, 'finished writing file into cache')
logger.debug({ url, filePath }, 'finished writing file into cache')
fs.rename(atomicWrite, filePath, error => {
if (error) {
fs.unlink(atomicWrite, () => callbackOnce(error))
@@ -108,7 +108,7 @@ module.exports = UrlFetcher = {
})
fileStream.on('pipe', () =>
logger.log({ url, filePath }, 'piping into filestream')
logger.debug({ url, filePath }, 'piping into filestream')
)
urlStream.pipe(fileStream)