logging-log4j2
logging-log4j2 copied to clipboard
JsonTemplateLayout: java.lang.OutOfMemoryError: Java heap space java.lang.OutOfMemoryError: Java heap space
Constructor ERROR Could not create plugin of type class org.apache.logging.log4j.layout.template.json.JsonTemplateLayout for element JsonTemplateLayout: java.lang.OutOfMemoryError: Java heap space java.lang.OutOfMemoryError: Java heap space
Here is what I have configured.
<Console name="CONSOLE-OUTPUT" target="SYSTEM_OUT">
<JsonTemplateLayout eventTemplateUri="classpath:Layout.json" maxStringLength="10000000">
<EventTemplateAdditionalField key="appName" value="AA" />
<EventTemplateAdditionalField key="appenderName" value="OUTPUT" />
<EventTemplateAdditionalField key="consoleLogIdentifier" value="LOG-IDENTIFIER"/>
</JsonTemplateLayout>
<Filters>
<RegexFilter regex="(?s).*AvailabilityReport.*"
useRawMsg="true" onMatch="ACCEPT" onMismatch="NEUTRAL" />
<RegexFilter regex="(?s).*OccupancyReport.*"
useRawMsg="true" onMatch="ACCEPT" onMismatch="DENY" />
</Filters>
</Console>
Configuration
Version: 2.23.1
Operating system: Red Hat Enterprise Linux release 8.4 (Ootpa)
JDK: openjdk version "11.0.13" 2021-10-19 LTS
Logs
2024-04-23 12:00:26,623 Constructor ERROR Could not create plugin of type class org.apache.logging.log4j.layout.template.json.JsonTemplateLayout for element JsonTemplateLayout: java.lang.OutOfMemoryError: Java heap space java.lang.OutOfMemoryError: Java heap space
@PassiveIncomeMachine, could you share the following information too, please?
- A complete stack trace (pointing to some line numbers in the
org.apache.logging.log4jpackage, etc.) Layout.jsonfile
For the record, maxStringLength="10000000" looks dangerous to me. Note that it doesn't limit the total JSON document length, but the maximum length of a String-typed field in the JSON document. I would try to keep it way lower.
Thanks VY please check my TPLayout.json file TPLayout.json
and also attach my send message
<?xml version="1.0" encoding="utf-8" ?> <TPUpdate xmlns="www.w3.org/2001/XMLSchema"> <MatchExecuted>true</MatchExecuted> <EventTime>2023-03-29T03:16:30.000Z</EventTime> <TP> <TP_Identification>RTP29031616</TP_Identification> <TPBGTag> <TPPC>1274612422</TPPC> </TPBGTag> <Inbound_Class></Inbound_Class> <Outbound_Class></Outbound_Class> <Outbound_Destination></Outbound_Destination> <GroupName></GroupName> <TPBG_Security_Status></TPBG_Security_Status> <RequiredLevel>0</RequiredLevel> <ReachedLevel>0</ReachedLevel> <FailedLevel>0</FailedLevel> <ReachedIntensity></ReachedIntensity> <RequiredIntensity>NAL</RequiredIntensity> <Size>80</Size> <NextTP>Coding</NextTP> <FinalTP>AA90</FinalTP> <Last_TPID>521</Last_TPID> <TPPC_Status></TPPC_Status> <Tubbing_Necessity>0</Tubbing_Necessity> <Tubbed_Indicator>0</Tubbed_Indicator> <PriorityIndicator></PriorityIndicator> <PassengerStatus></PassengerStatus> <Next_TPID>4</Next_TPID> <SegregationGroupRule>RULE-1000000001-01</SegregationGroupRule> <SortationDecisionGroupRule>RULE-1000000113-01</SortationDecisionGroupRule> <SortationDecisionGroupID>932942</SortationDecisionGroupID> <NextProcessStep>Route</NextProcessStep> <SegregationGroupRulePriority>99</SegregationGroupRulePriority> <SortationDecisionGroupRulePriority>1</SortationDecisionGroupRulePriority> <ProcessException></ProcessException> <PhysicalClass></PhysicalClass> </TP> <Segment>91000</Segment> <location> <Area>10120</Area> </location> </TPUpdate>
@PassiveIncomeMachine,
- I am still missing a stack trace. Please send a complete stack trace.
- The
TPLayout.jsonyou shared contains a custom resolver:humanMessage. Can this be our smoking gun? - I don't know what I am supposed to the do with the XML formatted message you shared.
This issue is stale because it has been waiting for your feedback for more than 60 days. The Apache Logging Services community values every submitted issue, but without additional information from you, we are unable to provide a solution to your problem. Please comment on this issue or it will be closed in 7 days.
I will do one update ASAP.