mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-16 11:23:10 +02:00
perf: Logging statements to use parameterized messages (#4399)
This commit is contained in:
@@ -73,11 +73,11 @@ public class ApplicationProperties {
|
|||||||
public PropertySource<?> dynamicYamlPropertySource(ConfigurableEnvironment environment)
|
public PropertySource<?> dynamicYamlPropertySource(ConfigurableEnvironment environment)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
String configPath = InstallationPathConfig.getSettingsPath();
|
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);
|
File file = new File(configPath);
|
||||||
if (!file.exists()) {
|
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);
|
Resource resource = new FileSystemResource(configPath);
|
||||||
@@ -90,7 +90,7 @@ public class ApplicationProperties {
|
|||||||
new YamlPropertySourceFactory().createPropertySource(null, encodedResource);
|
new YamlPropertySourceFactory().createPropertySource(null, encodedResource);
|
||||||
environment.getPropertySources().addFirst(propertySource);
|
environment.getPropertySources().addFirst(propertySource);
|
||||||
|
|
||||||
log.debug("Loaded properties: " + propertySource.getSource());
|
log.debug("Loaded properties: {}", propertySource.getSource());
|
||||||
|
|
||||||
return propertySource;
|
return propertySource;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ public class ProcessExecutor {
|
|||||||
semaphore.acquire();
|
semaphore.acquire();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
log.info("Running command: " + String.join(" ", command));
|
log.info("Running command: {}", String.join(" ", command));
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder(command);
|
ProcessBuilder processBuilder = new ProcessBuilder(command);
|
||||||
|
|
||||||
// Use the working directory if it's set
|
// Use the working directory if it's set
|
||||||
@@ -252,7 +252,7 @@ public class ProcessExecutor {
|
|||||||
String outputMessage = String.join("\n", outputLines);
|
String outputMessage = String.join("\n", outputLines);
|
||||||
messages += outputMessage;
|
messages += outputMessage;
|
||||||
if (!liveUpdates) {
|
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);
|
String errorMessage = String.join("\n", errorLines);
|
||||||
messages += errorMessage;
|
messages += errorMessage;
|
||||||
if (!liveUpdates) {
|
if (!liveUpdates) {
|
||||||
log.warn("Command error output:\n" + errorMessage);
|
log.warn("Command error output:\n{}", errorMessage);
|
||||||
}
|
}
|
||||||
if (exitCode != 0) {
|
if (exitCode != 0) {
|
||||||
if (isQpdf && exitCode == 3) {
|
if (isQpdf && exitCode == 3) {
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ public class DesktopBrowser implements WebBrowser {
|
|||||||
private void configureCefSettings(CefAppBuilder builder) {
|
private void configureCefSettings(CefAppBuilder builder) {
|
||||||
CefSettings settings = builder.getCefSettings();
|
CefSettings settings = builder.getCefSettings();
|
||||||
String basePath = InstallationPathConfig.getClientWebUIPath();
|
String basePath = InstallationPathConfig.getClientWebUIPath();
|
||||||
log.info("basePath " + basePath);
|
log.info("basePath {}", basePath);
|
||||||
settings.cache_path = new File(basePath + "cache").getAbsolutePath();
|
settings.cache_path = new File(basePath + "cache").getAbsolutePath();
|
||||||
settings.root_cache_path = new File(basePath + "root_cache").getAbsolutePath();
|
settings.root_cache_path = new File(basePath + "root_cache").getAbsolutePath();
|
||||||
// settings.browser_subprocess_path = new File(basePath +
|
// settings.browser_subprocess_path = new File(basePath +
|
||||||
@@ -136,7 +136,7 @@ public class DesktopBrowser implements WebBrowser {
|
|||||||
new MavenCefAppHandlerAdapter() {
|
new MavenCefAppHandlerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void stateHasChanged(org.cef.CefApp.CefAppState state) {
|
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) {
|
if (state == CefApp.CefAppState.TERMINATED) {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
@@ -163,9 +163,9 @@ public class DesktopBrowser implements WebBrowser {
|
|||||||
CefDownloadItem downloadItem,
|
CefDownloadItem downloadItem,
|
||||||
CefDownloadItemCallback callback) {
|
CefDownloadItemCallback callback) {
|
||||||
if (downloadItem.isComplete()) {
|
if (downloadItem.isComplete()) {
|
||||||
log.info("Download completed: " + downloadItem.getFullPath());
|
log.info("Download completed: {}", downloadItem.getFullPath());
|
||||||
} else if (downloadItem.isCanceled()) {
|
} 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) {
|
} catch (Exception e) {
|
||||||
log.debug("Could not load icon from " + path, e);
|
log.debug("Could not load icon from {}", path, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -227,9 +227,7 @@ public class LoadingWindow extends JDialog {
|
|||||||
if (!existingPids
|
if (!existingPids
|
||||||
.contains(
|
.contains(
|
||||||
pid)) {
|
pid)) {
|
||||||
log.debug(
|
log.debug("Found new explorer.exe with PID: {}", pid);
|
||||||
"Found new explorer.exe with PID: "
|
|
||||||
+ pid);
|
|
||||||
ProcessBuilder
|
ProcessBuilder
|
||||||
killProcess =
|
killProcess =
|
||||||
new ProcessBuilder(
|
new ProcessBuilder(
|
||||||
@@ -247,9 +245,7 @@ public class LoadingWindow extends JDialog {
|
|||||||
2,
|
2,
|
||||||
TimeUnit
|
TimeUnit
|
||||||
.SECONDS);
|
.SECONDS);
|
||||||
log.debug(
|
log.debug("Explorer process terminated: {}", pid);
|
||||||
"Explorer process terminated: "
|
|
||||||
+ pid);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -320,7 +316,7 @@ public class LoadingWindow extends JDialog {
|
|||||||
mainPanel.revalidate();
|
mainPanel.revalidate();
|
||||||
mainPanel.repaint();
|
mainPanel.repaint();
|
||||||
} catch (Exception e) {
|
} 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.revalidate();
|
||||||
mainPanel.repaint();
|
mainPanel.repaint();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error updating status to: " + status, e);
|
log.error("Error updating status to: {}", status, e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -263,8 +263,8 @@ public class RearrangePagesPDFController {
|
|||||||
} else {
|
} else {
|
||||||
newPageOrder = GeneralUtils.parsePageList(pageOrderArr, totalPages, false);
|
newPageOrder = GeneralUtils.parsePageList(pageOrderArr, totalPages, false);
|
||||||
}
|
}
|
||||||
log.info("newPageOrder = " + newPageOrder);
|
log.info("newPageOrder = {}", newPageOrder);
|
||||||
log.info("totalPages = " + totalPages);
|
log.info("totalPages = {}", totalPages);
|
||||||
// Create a new list to hold the pages in the new order
|
// Create a new list to hold the pages in the new order
|
||||||
List<PDPage> newPages = new ArrayList<>();
|
List<PDPage> newPages = new ArrayList<>();
|
||||||
for (int i = 0; i < newPageOrder.size(); i++) {
|
for (int i = 0; i < newPageOrder.size(); i++) {
|
||||||
|
|||||||
+1
-1
@@ -806,7 +806,7 @@ public class CompressController {
|
|||||||
try {
|
try {
|
||||||
Files.deleteIfExists(tempFile);
|
Files.deleteIfExists(tempFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.warn("Failed to delete temporary file: " + tempFile, e);
|
log.warn("Failed to delete temporary file: {}", tempFile, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -219,7 +219,7 @@ public class ExtractImageScansController {
|
|||||||
try {
|
try {
|
||||||
Files.deleteIfExists(path);
|
Files.deleteIfExists(path);
|
||||||
} catch (IOException e) {
|
} 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 {
|
try {
|
||||||
Files.deleteIfExists(tempZipFile);
|
Files.deleteIfExists(tempZipFile);
|
||||||
} catch (IOException e) {
|
} 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 {
|
try {
|
||||||
FileUtils.deleteDirectory(dir.toFile());
|
FileUtils.deleteDirectory(dir.toFile());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Failed to delete temporary directory: " + dir, e);
|
log.error("Failed to delete temporary directory: {}", dir, e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -68,7 +68,7 @@ public class PrintFileController {
|
|||||||
new IllegalArgumentException(
|
new IllegalArgumentException(
|
||||||
"No matching printer found"));
|
"No matching printer found"));
|
||||||
|
|
||||||
log.info("Selected Printer: " + selectedService.getName());
|
log.info("Selected Printer: {}", selectedService.getName());
|
||||||
|
|
||||||
if (MediaType.APPLICATION_PDF_VALUE.equals(contentType)) {
|
if (MediaType.APPLICATION_PDF_VALUE.equals(contentType)) {
|
||||||
PDDocument document = Loader.loadPDF(file.getBytes());
|
PDDocument document = Loader.loadPDF(file.getBytes());
|
||||||
|
|||||||
+2
-2
@@ -339,7 +339,7 @@ public class PipelineProcessor {
|
|||||||
}
|
}
|
||||||
Path path = Paths.get(file.getAbsolutePath());
|
Path path = Paths.get(file.getAbsolutePath());
|
||||||
// debug statement
|
// debug statement
|
||||||
log.info("Reading file: " + path);
|
log.info("Reading file: {}", path);
|
||||||
if (Files.exists(path)) {
|
if (Files.exists(path)) {
|
||||||
Resource fileResource =
|
Resource fileResource =
|
||||||
new ByteArrayResource(Files.readAllBytes(path)) {
|
new ByteArrayResource(Files.readAllBytes(path)) {
|
||||||
@@ -351,7 +351,7 @@ public class PipelineProcessor {
|
|||||||
};
|
};
|
||||||
outputFiles.add(fileResource);
|
outputFiles.add(fileResource);
|
||||||
} else {
|
} else {
|
||||||
log.info("File not found: " + path);
|
log.info("File not found: {}", path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info("Files successfully loaded. Starting processing...");
|
log.info("Files successfully loaded. Starting processing...");
|
||||||
|
|||||||
+1
-1
@@ -758,7 +758,7 @@ public class KeygenLicenseVerifier {
|
|||||||
|
|
||||||
HttpResponse<String> response =
|
HttpResponse<String> response =
|
||||||
httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
||||||
log.info("activateMachine Response body: " + response.body());
|
log.info("activateMachine Response body: {}", response.body());
|
||||||
if (response.statusCode() == 201) {
|
if (response.statusCode() == 201) {
|
||||||
log.info("Machine activated successfully");
|
log.info("Machine activated successfully");
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user