[
https://issues.apache.org/jira/browse/LOG4J2-2697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16936626#comment-16936626
]
Jose Luis edited comment on LOG4J2-2697 at 9/24/19 9:50 AM:
------------------------------------------------------------
Hello, we keep testing the code using different levels, but some CustomLevel
are not appling properly.
In the configuration file, we set these Custom Levels:
{code:java}
<CustomLevels>
<CustomLevel name="EMERGENCY" intLevel="50" />
<CustomLevel name="ALERT" intLevel="150" />
<CustomLevel name="CRITICAL" intLevel="199" />
<CustomLevel name="ERROR" intLevel="250" />
<CustomLevel name="WARNING" intLevel="301" />
<CustomLevel name="NOTICE" intLevel="399" />
<CustomLevel name="INFORMAL" intLevel="450" />
<CustomLevel name="DEBUG" intLevel="501" />
</CustomLevels>
{code}
{{The protocol RFC 5424 uses 8 severity levels: EMERGENCY(0), ALERT(1),
CRITICAL(2), ERROR(3), WARNING(4), NOTICE(5), INFORMATIONAL(6), DEBUG(7). so we
are testing the different severity values in the priority levels.}}
{{Our tests are showing right values for most of the CustomLevels:}}
{code:java}
EMERGENCY = 184 (OK, 23x8+0=184)
ALERT = 185 (OK)
CRITICAL = 185 (FAILED, should be 186)
ERROR = 187 (OK)
WARNING = 188 (OK)
NOTICE = 188 (FAILED, should be 189)
INFO = 190 (OK)
{code}
As you can see, the behaviour for the levels CRITICAL and NOTICE is not right.
Those two levels are not Log4j's standard levels, so maybe I need to include
them somehow. I've found two possible solutions: [Generating Extender
Loggers|http://logging.apache.org/log4j/2.x/manual/customloglevels.html] or
[Socket Appender|https://stackoverflow.com/a/42119716].
I'm not sure which of these methods is better to solve this situacion.
{{Any suggestion to solve this issue? Or any other idea how to solve it?}}
was (Author: jlsg-deimos):
Hello, we keep testing the code using different levels, but some CustomLevel
are not appling properly.
In the configuration file, we set these Custom Levels:
{code:java}
<CustomLevels>
<CustomLevel name="EMERGENCY" intLevel="50" />
<CustomLevel name="ALERT" intLevel="150" />
<CustomLevel name="CRITICAL" intLevel="199" />
<CustomLevel name="ERROR" intLevel="250" />
<CustomLevel name="WARNING" intLevel="301" />
<CustomLevel name="NOTICE" intLevel="399" />
<CustomLevel name="INFORMAL" intLevel="450" />
<CustomLevel name="DEBUG" intLevel="501" />
</CustomLevels>
{code}
{{The protocol RFC 5424 uses 8 severity levels: EMERGENCY(0), ALERT(1),
CRITICAL(2), ERROR(3), WARNING(4), NOTICE(5), INFORMATIONAL(6), DEBUG(7). so we
are testing the different severity values in the priority levels.}}
{{Our tests are showing right values for most of the CustomLevels:}}
{code:java}
EMERGENCY = 184 (OK, 23x8+0=184)
ALERT = 185 (OK)
CRITICAL = 185 (FAILED, should be 186)
ERROR = 187 (OK)
WARNING = 188 (OK)
NOTICE = 188 (FAILED, should be 189)
INFO = 190 (OK)
{code}
As you can see, the behaviour for the levels CRITICAL and NOTICE is not right.
Those two levels are not Log4j's standard levels, so maybe I need to include
them somehow. I've found two possible solutions: [Generating Extender
Loggers|http://logging.apache.org/log4j/2.x/manual/customloglevels.html] or
[Socket
Appender|[https://stackoverflow.com/a/42119716]|https://stackoverflow.com/a/42119716].
I'm not sure which of these methods is better to solve this situacion.
{{Any suggestion to solve this issue? Or any other idea how to solve it?}}
> Priority of the Event is not calculated correctly
> -------------------------------------------------
>
> Key: LOG4J2-2697
> URL: https://issues.apache.org/jira/browse/LOG4J2-2697
> Project: Log4j 2
> Issue Type: Bug
> Components: API, Layouts
> Affects Versions: 2.11.1
> Environment: RedHat 7.6
> OpenJDK 11
> Reporter: Jose Luis
> Priority: Blocker
> Attachments: 02-logEvent_customLevel.jpg,
> 03-TCPStream_All184Values.jpg, CSFLogConfigData.xml
>
>
> We are having a problem with the Priority of the event created by the log4j2
> API.
> * According to the [RFC 5424|https://tools.ietf.org/html/rfc5424]
> specification, the priority is calculated as:
> *{{PRIORITY = ( FACILITY x 8) + SEVERITY}}*
> * In our configuration file (CSFLogConfigData.xml attached) we set the
> *Facility = LOCAL7 (value = 23)* and several Custom Levels:
> *{{<CustomLevels>}}*
> *{{}}{{ <CustomLevel name="EMERGENCY" intLevel="2" />}}*
> *{{}}{{ <CustomLevel name="ALERT" intLevel="3" />}}*
> *{{}}{{ <CustomLevel name="CRITICAL" intLevel="4" />}}*
> *{{}}{{ <CustomLevel name="ERROR" intLevel="5" />}}*
> *{{}}{{ <CustomLevel name="WARNING" intLevel="6" />}}*
> *{{}}{{ <CustomLevel name="NOTICE" intLevel="7" />}}*
> *{{}}{{ <CustomLevel name="INFORMAL" intLevel="8" />}}*
> *{{}}{{ <CustomLevel name="DEBUG" intLevel="9" />}}*
> {{*</CustomLevels>*}}
> * In our testing, we are provoking an Emergency Level event, as you can see
> in the screenshot attached (02-logEvent_customLevel)
> * The priority expected in the event after log4j2 management should be
> {{ *PRIORITY = (23 x 8) + 2 = 186*}}
> * But in the TCP Stream, all the events have *PRIORITY = 184* (screenshot
> attached 03-TCPStream_All184Values). In the screenshot the priority of some
> events can be seen, all of them with *PRIORITY = 184*, no matter the Severity
> Level of the event.
> We are seeing the Severity is not being added when calculating the priority.
> We have test with another facility, and the multiplication is ok, but in
> every case the Severity is not added.
>
> Is this a known problem?
> There is something wrong with our configuration?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)