perf: Logging statements to use parameterized messages (#4399)

This commit is contained in:
Balázs Szücs 2025-09-28 22:17:58 +02:00 committed by GitHub
parent d5a3f768bc
commit e44d5f3714
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 25 additions and 29 deletions

View File

@ -73,11 +73,11 @@ public class ApplicationProperties {
public PropertySource<?> dynamicYamlPropertySource(ConfigurableEnvironment environment)
throws IOException {
String configPath = InstallationPathConfig.getSettingsPath();
log.debug("Attempting to load settings from: " + configPath);
log.debug("Attempting to load settings from: {}", configPath);
File file = new File(configPath);
if (!file.exists()) {
log.error("Warning: Settings file does not exist at: " + configPath);
log.error("Warning: Settings file does not exist at: {}", configPath);
}
Resource resource = new FileSystemResource(configPath);
@ -90,7 +90,7 @@ public class ApplicationProperties {
new YamlPropertySourceFactory().createPropertySource(null, encodedResource);
environment.getPropertySources().addFirst(propertySource);
log.debug("Loaded properties: " + propertySource.getSource());
log.debug("Loaded properties: {}", propertySource.getSource());
return propertySource;
}

View File

@ -167,7 +167,7 @@ public class ProcessExecutor {
semaphore.acquire();
try {
log.info("Running command: " + String.join(" ", command));
log.info("Running command: {}", String.join(" ", command));
ProcessBuilder processBuilder = new ProcessBuilder(command);
// Use the working directory if it's set
@ -252,7 +252,7 @@ public class ProcessExecutor {
String outputMessage = String.join("\n", outputLines);
messages += outputMessage;
if (!liveUpdates) {
log.info("Command output:\n" + outputMessage);
log.info("Command output:\n{}", outputMessage);
}
}
@ -260,7 +260,7 @@ public class ProcessExecutor {
String errorMessage = String.join("\n", errorLines);
messages += errorMessage;
if (!liveUpdates) {
log.warn("Command error output:\n" + errorMessage);
log.warn("Command error output:\n{}", errorMessage);
}
if (exitCode != 0) {
if (isQpdf && exitCode == 3) {

View File

@ -119,7 +119,7 @@ public class DesktopBrowser implements WebBrowser {
private void configureCefSettings(CefAppBuilder builder) {
CefSettings settings = builder.getCefSettings();
String basePath = InstallationPathConfig.getClientWebUIPath();
log.info("basePath " + basePath);
log.info("basePath {}", basePath);
settings.cache_path = new File(basePath + "cache").getAbsolutePath();
settings.root_cache_path = new File(basePath + "root_cache").getAbsolutePath();
// settings.browser_subprocess_path = new File(basePath +
@ -136,7 +136,7 @@ public class DesktopBrowser implements WebBrowser {
new MavenCefAppHandlerAdapter() {
@Override
public void stateHasChanged(org.cef.CefApp.CefAppState state) {
log.info("CEF state changed: " + state);
log.info("CEF state changed: {}", state);
if (state == CefApp.CefAppState.TERMINATED) {
System.exit(0);
}
@ -163,9 +163,9 @@ public class DesktopBrowser implements WebBrowser {
CefDownloadItem downloadItem,
CefDownloadItemCallback callback) {
if (downloadItem.isComplete()) {
log.info("Download completed: " + downloadItem.getFullPath());
log.info("Download completed: {}", downloadItem.getFullPath());
} else if (downloadItem.isCanceled()) {
log.info("Download canceled: " + downloadItem.getFullPath());
log.info("Download canceled: {}", downloadItem.getFullPath());
}
}
});
@ -409,7 +409,7 @@ public class DesktopBrowser implements WebBrowser {
}
}
} catch (Exception e) {
log.debug("Could not load icon from " + path, e);
log.debug("Could not load icon from {}", path, e);
}
}

View File

@ -227,9 +227,7 @@ public class LoadingWindow extends JDialog {
if (!existingPids
.contains(
pid)) {
log.debug(
"Found new explorer.exe with PID: "
+ pid);
log.debug("Found new explorer.exe with PID: {}", pid);
ProcessBuilder
killProcess =
new ProcessBuilder(
@ -247,9 +245,7 @@ public class LoadingWindow extends JDialog {
2,
TimeUnit
.SECONDS);
log.debug(
"Explorer process terminated: "
+ pid);
log.debug("Explorer process terminated: {}", pid);
}
}
}
@ -320,7 +316,7 @@ public class LoadingWindow extends JDialog {
mainPanel.revalidate();
mainPanel.repaint();
} catch (Exception e) {
log.error("Error updating progress to " + progress, e);
log.error("Error updating progress to {}", progress, e);
}
});
}
@ -345,7 +341,7 @@ public class LoadingWindow extends JDialog {
mainPanel.revalidate();
mainPanel.repaint();
} catch (Exception e) {
log.error("Error updating status to: " + status, e);
log.error("Error updating status to: {}", status, e);
}
});
}

View File

@ -263,8 +263,8 @@ public class RearrangePagesPDFController {
} else {
newPageOrder = GeneralUtils.parsePageList(pageOrderArr, totalPages, false);
}
log.info("newPageOrder = " + newPageOrder);
log.info("totalPages = " + totalPages);
log.info("newPageOrder = {}", newPageOrder);
log.info("totalPages = {}", totalPages);
// Create a new list to hold the pages in the new order
List<PDPage> newPages = new ArrayList<>();
for (int i = 0; i < newPageOrder.size(); i++) {

View File

@ -806,7 +806,7 @@ public class CompressController {
try {
Files.deleteIfExists(tempFile);
} catch (IOException e) {
log.warn("Failed to delete temporary file: " + tempFile, e);
log.warn("Failed to delete temporary file: {}", tempFile, e);
}
}
}

View File

@ -219,7 +219,7 @@ public class ExtractImageScansController {
try {
Files.deleteIfExists(path);
} catch (IOException e) {
log.error("Failed to delete temporary image file: " + path, e);
log.error("Failed to delete temporary image file: {}", path, e);
}
});
@ -227,7 +227,7 @@ public class ExtractImageScansController {
try {
Files.deleteIfExists(tempZipFile);
} catch (IOException e) {
log.error("Failed to delete temporary zip file: " + tempZipFile, e);
log.error("Failed to delete temporary zip file: {}", tempZipFile, e);
}
}
@ -236,7 +236,7 @@ public class ExtractImageScansController {
try {
FileUtils.deleteDirectory(dir.toFile());
} catch (IOException e) {
log.error("Failed to delete temporary directory: " + dir, e);
log.error("Failed to delete temporary directory: {}", dir, e);
}
});
}

View File

@ -68,7 +68,7 @@ public class PrintFileController {
new IllegalArgumentException(
"No matching printer found"));
log.info("Selected Printer: " + selectedService.getName());
log.info("Selected Printer: {}", selectedService.getName());
if (MediaType.APPLICATION_PDF_VALUE.equals(contentType)) {
PDDocument document = Loader.loadPDF(file.getBytes());

View File

@ -339,7 +339,7 @@ public class PipelineProcessor {
}
Path path = Paths.get(file.getAbsolutePath());
// debug statement
log.info("Reading file: " + path);
log.info("Reading file: {}", path);
if (Files.exists(path)) {
Resource fileResource =
new ByteArrayResource(Files.readAllBytes(path)) {
@ -351,7 +351,7 @@ public class PipelineProcessor {
};
outputFiles.add(fileResource);
} else {
log.info("File not found: " + path);
log.info("File not found: {}", path);
}
}
log.info("Files successfully loaded. Starting processing...");

View File

@ -758,7 +758,7 @@ public class KeygenLicenseVerifier {
HttpResponse<String> response =
httpClient.send(request, HttpResponse.BodyHandlers.ofString());
log.info("activateMachine Response body: " + response.body());
log.info("activateMachine Response body: {}", response.body());
if (response.statusCode() == 201) {
log.info("Machine activated successfully");
return true;