You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2012/10/20 02:22:57 UTC
svn commit: r1400349 - in /logging/log4j/log4j2/trunk:
core/src/main/java/org/apache/logging/log4j/core/net/Priority.java
core/src/test/java/org/apache/logging/log4j/core/net/PriorityTest.java
src/changes/changes.xml
Author: rgoers
Date: Sat Oct 20 00:22:56 2012
New Revision: 1400349
URL: http://svn.apache.org/viewvc?rev=1400349&view=rev
Log:
LOG4J2-102 - The Facility value was being improperly calculated.
Added:
logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/PriorityTest.java
Modified:
logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/Priority.java
logging/log4j/log4j2/trunk/src/changes/changes.xml
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/Priority.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/Priority.java?rev=1400349&r1=1400348&r2=1400349&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/Priority.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/Priority.java Sat Oct 20 00:22:56 2012
@@ -43,7 +43,7 @@ public class Priority {
* @return The integer value of the priority.
*/
public static int getPriority(Facility facility, Level level) {
- return facility.getCode() << 3 + Severity.getSeverity(level).getCode();
+ return (facility.getCode() << 3) + Severity.getSeverity(level).getCode();
}
/**
Added: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/PriorityTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/PriorityTest.java?rev=1400349&view=auto
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/PriorityTest.java (added)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/PriorityTest.java Sat Oct 20 00:22:56 2012
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.core.net;
+
+import org.apache.logging.log4j.Level;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+/**
+ *
+ */
+public class PriorityTest {
+
+ @Test
+ public void testP1() {
+ int p = Priority.getPriority(Facility.AUTH, Level.INFO);
+ assertTrue("Expected priority value is 38, got "+ p, p == 38);
+ }
+}
Modified: logging/log4j/log4j2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/changes/changes.xml?rev=1400349&r1=1400348&r2=1400349&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/changes/changes.xml (original)
+++ logging/log4j/log4j2/trunk/src/changes/changes.xml Sat Oct 20 00:22:56 2012
@@ -23,6 +23,9 @@
<body>
<release version="2.0-beta3" date="TBD" description= "Bug fixes and enhancements">
+ <action issue="LOG4J2-102" dev="rgoers" type="fix" due-to="Emanuele Colombo">
+ The Facility value was being improperly calculated.
+ </action>
<action issue="LOG4J2-101" dev="rgoers" type="fix" due-to="Emanuele Colombo">
A NullPointerException would occur if no format value was passed to the SyslogAppender.
</action>