mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-25 17:00:36 -09:00
Merge remote-tracking branch 'origin/GP-6532_ryanmkurtz_log4j' into Ghidra_12.1
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package ghidra.app.script;
|
||||
|
||||
import org.apache.logging.log4j.message.Message;
|
||||
import org.apache.logging.log4j.message.StringFormattedMessage;
|
||||
|
||||
/**
|
||||
* A simple {@link Message} implementation that allows us to use the filtering capability
|
||||
@@ -23,14 +24,22 @@ import org.apache.logging.log4j.message.Message;
|
||||
* message out. Our formatted message is the original message given to us. We use the
|
||||
* unformatted message, in conjunction with a regex filter to allow for filtering such that
|
||||
* the script log file only has script messages.
|
||||
*
|
||||
* <P>See log4j-appender-rolling-file-scripts.xml
|
||||
* <p>
|
||||
* See log4j-appender-rolling-file-scripts.xml
|
||||
* <p>
|
||||
* NOTE: {@link Message#getFormat()} was deprecated in log4j 2.24.0, and the behavior of
|
||||
* {@code useRawMsg} changed to only work with certain classes that implement the {@link Message}
|
||||
* interface, such as {@link StringFormattedMessage}. Implementing our own {@link Message}
|
||||
* resulted in {@code useRawMsg} not calling {@link #getFormat()}. See
|
||||
* <a href="https://github.com/apache/logging-log4j2/pull/2773">logging-log4j2/pull/2773</a> for
|
||||
* more info.
|
||||
*/
|
||||
public class ScriptMessage implements Message {
|
||||
public class ScriptMessage extends StringFormattedMessage {
|
||||
|
||||
private String message;
|
||||
|
||||
public ScriptMessage(String message) {
|
||||
super(message);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
Log4j appender that writes messages to a file.
|
||||
|
||||
We filter the messages for this file by using the 'GhidraScript' text. This text is added
|
||||
to the 'unformatted message' by using the log4j's Message class. We then emit the
|
||||
original message when writing to the file.
|
||||
to the 'unformatted message' by using our ScriptMessage class, which extends log4j's
|
||||
StringFormattedMessage class. We then emit the original message when writing to the file.
|
||||
|
||||
-->
|
||||
<RollingFile
|
||||
|
||||
Reference in New Issue
Block a user