mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 21:23:45 +01:00
[git-bridge] Downgrade info logs to debug (#32470)
* [git-bridge] Downgrade `info` logs to `debug` Moving most `info` logs to `debug` to reduce log noise. GitOrigin-RevId: 21f8d11ba950078b5e3a88a245e8ed68f2548141
This commit is contained in:
+1
-1
@@ -83,7 +83,7 @@ public class GitBridgeApp implements Runnable {
|
||||
}
|
||||
|
||||
private void loadConfigFile() throws ConfigFileException, IOException {
|
||||
Log.info("Loading config file at path: " + configFilePath);
|
||||
Log.debug("Loading config file at path: " + configFilePath);
|
||||
config = new Config(configFilePath);
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ public class Bridge {
|
||||
SwapStore swapStore,
|
||||
SnapshotApi snapshotApi) {
|
||||
ProjectLock lock =
|
||||
new ProjectLockImpl((int threads) -> Log.info("Waiting for " + threads + " projects..."));
|
||||
new ProjectLockImpl((int threads) -> Log.debug("Waiting for " + threads + " projects..."));
|
||||
return new Bridge(
|
||||
config,
|
||||
lock,
|
||||
@@ -261,7 +261,7 @@ public class Bridge {
|
||||
* the schema.
|
||||
*/
|
||||
public void checkDB() {
|
||||
Log.info("Checking DB");
|
||||
Log.debug("Checking DB");
|
||||
File rootDir = repoStore.getRootDirectory();
|
||||
for (File f : rootDir.listFiles()) {
|
||||
if (f.getName().equals(".wlgb")) {
|
||||
@@ -342,7 +342,7 @@ public class Bridge {
|
||||
ProjectState state = dbStore.getProjectState(projectName);
|
||||
switch (state) {
|
||||
case NOT_PRESENT:
|
||||
Log.info("[{}] Repo not present", projectName);
|
||||
Log.debug("[{}] Repo not present", projectName);
|
||||
repo = repoStore.initRepo(projectName);
|
||||
break;
|
||||
case SWAPPED:
|
||||
@@ -391,7 +391,7 @@ public class Bridge {
|
||||
CannotAcquireLockException {
|
||||
Log.debug("[{}] pushing to Overleaf", projectName);
|
||||
try (LockGuard __ = lock.lockGuard(projectName)) {
|
||||
Log.info("[{}] got project lock", projectName);
|
||||
Log.debug("[{}] got project lock", projectName);
|
||||
pushCritical(oauth2, projectName, directoryContents, oldDirectoryContents);
|
||||
} catch (SevereSnapshotPostException e) {
|
||||
Log.warn("[" + projectName + "] Failed to put to Overleaf", e);
|
||||
|
||||
@@ -58,13 +58,13 @@ public class GcJobImpl implements GcJob {
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
Log.info("Starting GC job to run every [{}] ms", intervalMs);
|
||||
Log.debug("Starting GC job to run every [{}] ms", intervalMs);
|
||||
timer.scheduleAtFixedRate(TimerUtils.makeTimerTask(this::doGC), intervalMs, intervalMs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
Log.info("Stopping GC job");
|
||||
Log.debug("Stopping GC job");
|
||||
timer.cancel();
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class GcJobImpl implements GcJob {
|
||||
}
|
||||
|
||||
private void doGC() {
|
||||
Log.info("GC job running");
|
||||
Log.debug("GC job running");
|
||||
int numGcs = 0;
|
||||
preGc.get().run();
|
||||
for (Iterator<String> it = gcQueue.iterator(); it.hasNext(); it.remove(), ++numGcs) {
|
||||
@@ -118,7 +118,7 @@ public class GcJobImpl implements GcJob {
|
||||
Log.warn("[{}] Cannot acquire project lock, skipping GC", proj);
|
||||
}
|
||||
}
|
||||
Log.info("GC job finished, num gcs: {}", numGcs);
|
||||
Log.debug("GC job finished, num gcs: {}", numGcs);
|
||||
jobWaitersLock.lock();
|
||||
try {
|
||||
jobWaiters.forEach(w -> w.complete(null));
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ public class SwapJobConfig {
|
||||
public SwapJob.CompressionMethod getCompressionMethod() {
|
||||
CompressionMethod result = SwapJob.stringToCompressionMethod(compressionMethod);
|
||||
if (result == null) {
|
||||
Log.info(
|
||||
Log.warn(
|
||||
"SwapJobConfig: un-supported compressionMethod '{}', default to 'bzip2'",
|
||||
compressionMethod);
|
||||
result = CompressionMethod.Bzip2;
|
||||
|
||||
+2
-2
@@ -178,7 +178,7 @@ public class SwapJobImpl implements SwapJob {
|
||||
@Override
|
||||
public void evict(String projName) throws IOException {
|
||||
Preconditions.checkNotNull(projName, "projName was null");
|
||||
Log.info("Evicting project: {}", projName);
|
||||
Log.debug("Evicting project: {}", projName);
|
||||
try (LockGuard __ = lock.lockGuard(projName)) {
|
||||
try {
|
||||
repoStore.gcProject(projName);
|
||||
@@ -199,7 +199,7 @@ public class SwapJobImpl implements SwapJob {
|
||||
Log.warn("[{}] Cannot acquire project lock, skipping swap", projName);
|
||||
return;
|
||||
}
|
||||
Log.info("Evicted project: {}", projName);
|
||||
Log.debug("Evicted project: {}", projName);
|
||||
}
|
||||
|
||||
private InputStream getBlobStream(String projName, long[] sizePtr) throws IOException {
|
||||
|
||||
@@ -65,7 +65,7 @@ public class Oauth2Filter implements Filter {
|
||||
String requestUri = request.getRequestURI();
|
||||
|
||||
if (requestUri.startsWith("/project")) {
|
||||
Log.info("[{}] Invalid request URI", requestUri);
|
||||
Log.debug("[{}] Invalid request URI", requestUri);
|
||||
sendResponse(
|
||||
response, 404, Arrays.asList("Invalid Project ID (must not have a '/project' prefix)"));
|
||||
return;
|
||||
@@ -157,7 +157,7 @@ public class Oauth2Filter implements Filter {
|
||||
private void handleLinkSharingId(
|
||||
String projectId, String username, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException {
|
||||
Log.info("[{}] Bad project id, User '{}' ip={}", projectId, username, getClientIp(request));
|
||||
Log.debug("[{}] Bad project id, User '{}' ip={}", projectId, username, getClientIp(request));
|
||||
sendResponse(
|
||||
response,
|
||||
404,
|
||||
@@ -174,7 +174,7 @@ public class Oauth2Filter implements Filter {
|
||||
private void handleBadProjectId(
|
||||
String projectId, String username, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException {
|
||||
Log.info("[{}] Bad project id, User '{}' ip={}", projectId, username, getClientIp(request));
|
||||
Log.debug("[{}] Bad project id, User '{}' ip={}", projectId, username, getClientIp(request));
|
||||
sendResponse(
|
||||
response,
|
||||
404,
|
||||
@@ -188,7 +188,7 @@ public class Oauth2Filter implements Filter {
|
||||
private void handleRateLimit(
|
||||
String projectId, String username, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException {
|
||||
Log.info("[{}] Rate limit, User '{}' ip={}", projectId, username, getClientIp(request));
|
||||
Log.debug("[{}] Rate limit, User '{}' ip={}", projectId, username, getClientIp(request));
|
||||
sendResponse(
|
||||
response, 429, Arrays.asList("Rate limit exceeded. Please wait and try again later."));
|
||||
}
|
||||
@@ -196,7 +196,7 @@ public class Oauth2Filter implements Filter {
|
||||
private void handleNeedAuthorization(
|
||||
String projectId, String username, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException {
|
||||
Log.info("[{}] Unauthorized, User '{}' ip={}", projectId, username, getClientIp(request));
|
||||
Log.debug("[{}] Unauthorized, User '{}' ip={}", projectId, username, getClientIp(request));
|
||||
response.setHeader("WWW-Authenticate", "Basic realm=\"Git Bridge\"");
|
||||
if (this.isUserPasswordEnabled) {
|
||||
sendResponse(
|
||||
@@ -226,7 +226,7 @@ public class Oauth2Filter implements Filter {
|
||||
private void handleBadAccessToken(
|
||||
String projectId, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException {
|
||||
Log.info("[{}] Bad access token, ip={}", projectId, getClientIp(request));
|
||||
Log.debug("[{}] Bad access token, ip={}", projectId, getClientIp(request));
|
||||
sendResponse(
|
||||
response,
|
||||
401,
|
||||
@@ -254,7 +254,7 @@ public class Oauth2Filter implements Filter {
|
||||
private void handleUnknownOauthServerError(
|
||||
String projectId, int statusCode, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException {
|
||||
Log.info(
|
||||
Log.debug(
|
||||
"[{}] OAuth server error, statusCode={}, ip={}",
|
||||
projectId,
|
||||
statusCode,
|
||||
@@ -266,14 +266,14 @@ public class Oauth2Filter implements Filter {
|
||||
String projectId, String username, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException {
|
||||
if (username.contains("@")) {
|
||||
Log.info("[{}] Password authentication deprecated, ip={}", projectId, getClientIp(request));
|
||||
Log.debug("[{}] Password authentication deprecated, ip={}", projectId, getClientIp(request));
|
||||
sendResponse(
|
||||
response,
|
||||
403,
|
||||
Arrays.asList(
|
||||
"Overleaf now only supports Git authentication tokens to access git. See: https://www.overleaf.com/learn/how-to/Git_integration_authentication_tokens"));
|
||||
} else {
|
||||
Log.info("[{}] Wrong git URL format, ip={}", projectId, getClientIp(request));
|
||||
Log.debug("[{}] Wrong git URL format, ip={}", projectId, getClientIp(request));
|
||||
sendResponse(
|
||||
response,
|
||||
403,
|
||||
|
||||
Reference in New Issue
Block a user