mirror of
https://github.com/NationalSecurityAgency/ghidra
synced 2024-10-30 02:29:46 +00:00
GP-4313: Loaders now echo their message log to the application.log file.
Can be disabled in launch.properties.
This commit is contained in:
parent
2d9a1ac539
commit
e5e488a807
5 changed files with 27 additions and 1 deletions
|
@ -722,6 +722,11 @@ public final class AutoImporter {
|
|||
.load(provider, importName, project, projectFolderPath, loadSpec, loaderOptions,
|
||||
messageLog, consumer, monitor);
|
||||
|
||||
// Optionally echo loader message log to application.log
|
||||
if (!Loader.loggingDisabled && messageLog.hasMessages()) {
|
||||
Msg.info(AutoImporter.class, "Additional info:\n" + messageLog.toString());
|
||||
}
|
||||
|
||||
// Filter out and release non-Programs
|
||||
List<Loaded<Program>> loadedPrograms = new ArrayList<>();
|
||||
for (Loaded<? extends DomainObject> loaded : loadResults) {
|
||||
|
|
|
@ -25,6 +25,7 @@ import ghidra.app.util.importer.MessageLog;
|
|||
import ghidra.formats.gfilesystem.FSRL;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.util.SystemUtilities;
|
||||
import ghidra.util.classfinder.ClassSearcher;
|
||||
import ghidra.util.classfinder.ExtensionPoint;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
|
@ -51,6 +52,13 @@ public interface Loader extends ExtensionPoint, Comparable<Loader> {
|
|||
*/
|
||||
public static final String OPTIONS_PROJECT_SAVE_STATE_KEY = "LOADER_OPTIONS";
|
||||
|
||||
/**
|
||||
* System property used to disable the loaders' message logs being echoed to the
|
||||
* application.log file
|
||||
*/
|
||||
public static boolean loggingDisabled =
|
||||
SystemUtilities.getBooleanProperty("disable.loader.logging", false);
|
||||
|
||||
/**
|
||||
* If this {@link Loader} supports loading the given {@link ByteProvider}, this methods returns
|
||||
* a {@link Collection} of all supported {@link LoadSpec}s that contain discovered load
|
||||
|
|
|
@ -434,6 +434,11 @@ public class ImporterUtilities {
|
|||
// currently we only show results for the imported program, not any libraries
|
||||
displayResults(pluginTool, loaded.getDomainObject(),
|
||||
loaded.getDomainObject().getDomainFile(), importMessages);
|
||||
|
||||
// Optionally echo loader message log to application.log
|
||||
if (!Loader.loggingDisabled && !importMessages.isEmpty()) {
|
||||
Msg.info(ImporterUtilities.class, "Additional info:\n" + importMessages);
|
||||
}
|
||||
}
|
||||
loaded.release(consumer);
|
||||
firstProgram = false;
|
||||
|
@ -459,6 +464,11 @@ public class ImporterUtilities {
|
|||
try (ByteProvider bp = fsService.getByteProvider(fsrl, false, monitor)) {
|
||||
loadSpec.getLoader().loadInto(bp, loadSpec, options, messageLog, program, monitor);
|
||||
displayResults(tool, program, program.getDomainFile(), messageLog.toString());
|
||||
|
||||
// Optionally echo loader message log to application.log
|
||||
if (!Loader.loggingDisabled && messageLog.hasMessages()) {
|
||||
Msg.info(ImporterUtilities.class, "Additional info:\n" + messageLog.toString());
|
||||
}
|
||||
}
|
||||
catch (CancelledException e) {
|
||||
return;
|
||||
|
|
|
@ -168,7 +168,7 @@ public class ImportBatchTask extends Task {
|
|||
|
||||
Msg.info(this, "Imported " + destInfo.first + "/ " + destInfo.second + ", " +
|
||||
totalAppsImported + " of " + totalEnabledApps);
|
||||
if (messageLog.hasMessages()) {
|
||||
if (!Loader.loggingDisabled && messageLog.hasMessages()) {
|
||||
Msg.info(this, "Additional info:\n" + messageLog.toString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,3 +141,6 @@ VMARGS=-Xshare:off
|
|||
|
||||
# Enables PDB developer mode
|
||||
#VMARGS=-Dghidra.pdb.developerMode=true
|
||||
|
||||
# Disables the loaders echoing their message log to the application.log file
|
||||
#VMARGS=-Ddisable.loader.logging=true
|
||||
|
|
Loading…
Reference in a new issue