You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tn...@apache.org on 2013/02/20 11:01:42 UTC
svn commit: r1448063 - in /commons/proper/logging/trunk/src:
changes/changes.xml
main/java/org/apache/commons/logging/impl/Jdk14Logger.java
test/java/org/apache/commons/logging/jdk14/CustomConfigTestCase.java
Author: tn
Date: Wed Feb 20 10:01:41 2013
New Revision: 1448063
URL: http://svn.apache.org/r1448063
Log:
[LOGGING-132] Jdk14Logger now correctly uses the specified logger name.
Modified:
commons/proper/logging/trunk/src/changes/changes.xml
commons/proper/logging/trunk/src/main/java/org/apache/commons/logging/impl/Jdk14Logger.java
commons/proper/logging/trunk/src/test/java/org/apache/commons/logging/jdk14/CustomConfigTestCase.java
Modified: commons/proper/logging/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/logging/trunk/src/changes/changes.xml?rev=1448063&r1=1448062&r2=1448063&view=diff
==============================================================================
--- commons/proper/logging/trunk/src/changes/changes.xml (original)
+++ commons/proper/logging/trunk/src/changes/changes.xml Wed Feb 20 10:01:41 2013
@@ -44,6 +44,9 @@ The <action> type attribute can be add,u
</properties>
<body>
<release version="1.1.2" date="In SVN" description="Bug fixes.">
+ <action type="fix" issue="LOGGING-132">
+ Jdk14Logger now correctly uses the specified logger name.
+ </action>
<action type="update" issue="LOGGING-133">
Change scope of Jdk14Logger.log(Level, String, Throwable) to protected, allowing
subclasses to modify the logging output.
Modified: commons/proper/logging/trunk/src/main/java/org/apache/commons/logging/impl/Jdk14Logger.java
URL: http://svn.apache.org/viewvc/commons/proper/logging/trunk/src/main/java/org/apache/commons/logging/impl/Jdk14Logger.java?rev=1448063&r1=1448062&r2=1448063&view=diff
==============================================================================
--- commons/proper/logging/trunk/src/main/java/org/apache/commons/logging/impl/Jdk14Logger.java (original)
+++ commons/proper/logging/trunk/src/main/java/org/apache/commons/logging/impl/Jdk14Logger.java Wed Feb 20 10:01:41 2013
@@ -75,13 +75,13 @@ public class Jdk14Logger implements Log,
// Hack (?) to get the stack trace.
Throwable dummyException = new Throwable();
StackTraceElement locations[] = dummyException.getStackTrace();
- // Caller will be the third element
- String cname = "unknown";
+ // LOGGING-132: use the provided logger name instead of the class name
+ String cname = name;
String method = "unknown";
+ // Caller will be the third element
if( locations != null && locations.length > 2 ) {
- StackTraceElement caller=locations[2];
- cname=caller.getClassName();
- method=caller.getMethodName();
+ StackTraceElement caller = locations[2];
+ method = caller.getMethodName();
}
if( ex == null ) {
logger.logp( level, cname, method, msg );
Modified: commons/proper/logging/trunk/src/test/java/org/apache/commons/logging/jdk14/CustomConfigTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/logging/trunk/src/test/java/org/apache/commons/logging/jdk14/CustomConfigTestCase.java?rev=1448063&r1=1448062&r2=1448063&view=diff
==============================================================================
--- commons/proper/logging/trunk/src/test/java/org/apache/commons/logging/jdk14/CustomConfigTestCase.java (original)
+++ commons/proper/logging/trunk/src/test/java/org/apache/commons/logging/jdk14/CustomConfigTestCase.java Wed Feb 20 10:01:41 2013
@@ -168,10 +168,10 @@ public class CustomConfigTestCase extend
public void setUp() throws Exception {
setUpManager
("org/apache/commons/logging/jdk14/CustomConfig.properties");
- setUpLogger("TestLogger");
+ setUpLogger(this.getClass().getName());
setUpHandlers();
setUpFactory();
- setUpLog("TestLogger");
+ setUpLog(this.getClass().getName());
}
@@ -244,7 +244,7 @@ public class CustomConfigTestCase extend
public void testPristineLogger() {
assertNotNull("Logger exists", logger);
- assertEquals("Logger name", "TestLogger", logger.getName());
+ assertEquals("Logger name", this.getClass().getName(), logger.getName());
// Assert which logging levels have been enabled
assertTrue(logger.isLoggable(Level.SEVERE));