Skip to content

Commit adf3c21

Browse files
committed
Check if the log format is JSON once.
(cherry picked from commit 49b138d)
1 parent c3e9d94 commit adf3c21

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

wrappercommon/src/main/java/com/genexus/diagnostics/core/provider/Log4J2Logger.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
public class Log4J2Logger implements ILogger {
2424
private org.apache.logging.log4j.Logger log;
25+
private static final boolean IS_JSON_FORMAT = isJsonLogFormat();
2526

2627
public Log4J2Logger(final Class<?> clazz) {
2728
log = org.apache.logging.log4j.LogManager.getLogger(clazz);
@@ -239,7 +240,7 @@ public void setContext(String key, Object value) {
239240

240241
public void write(String message, int logLevel, Object data, boolean stackTrace) {
241242
if (isEnabled(logLevel)) {
242-
if (isJsonLogFormat())
243+
if (IS_JSON_FORMAT)
243244
writeJsonFormat(message, logLevel, data, stackTrace);
244245
else
245246
writeTextFormat(message, logLevel, data, stackTrace);

0 commit comments

Comments
 (0)