Deprecate org.apache.commons.logging.LogSource.jdk14IsAvailable
This commit is contained in:
@@ -46,6 +46,7 @@ The <action> type attribute can be add,update,fix,remove.
|
|||||||
<release version="1.3.2" date="2024-05-11" description="This is a feature and maintenance release. Java 8 or later is required.">
|
<release version="1.3.2" date="2024-05-11" description="This is a feature and maintenance release. Java 8 or later is required.">
|
||||||
<action dev="ggregory" issue="LOGGING-190" type="fix" due-to="Hannes Wellmann, Gary Gregory, Johan Compagner">Add OSGi metadata to enable Service Loader Mediator #234.</action>
|
<action dev="ggregory" issue="LOGGING-190" type="fix" due-to="Hannes Wellmann, Gary Gregory, Johan Compagner">Add OSGi metadata to enable Service Loader Mediator #234.</action>
|
||||||
<action dev="ggregory" issue="LOGGING-191" type="fix" due-to="Hannes Wellmann, Gary Gregory, Johan Compagner">Apache commons logging shows 1.4 as latest release instead of 1.3.1.</action>
|
<action dev="ggregory" issue="LOGGING-191" type="fix" due-to="Hannes Wellmann, Gary Gregory, Johan Compagner">Apache commons logging shows 1.4 as latest release instead of 1.3.1.</action>
|
||||||
|
<action dev="ggregory" type="fix" due-to="Gary Gregory">Deprecate org.apache.commons.logging.LogSource.jdk14IsAvailable.</action>
|
||||||
<!-- UPDATE -->
|
<!-- UPDATE -->
|
||||||
<action dev="ggregory" type="update" due-to="Dependabot">Bump org.apache.commons:commons-parent from 67 to 69 #240.</action>
|
<action dev="ggregory" type="update" due-to="Dependabot">Bump org.apache.commons:commons-parent from 67 to 69 #240.</action>
|
||||||
<action dev="ggregory" type="update" due-to="Dependabot">Bump org.slf4j:slf4j-api from 2.0.12 to 2.0.13 #248.</action>
|
<action dev="ggregory" type="update" due-to="Dependabot">Bump org.slf4j:slf4j-api from 2.0.12 to 2.0.13 #248.</action>
|
||||||
|
|||||||
@@ -61,8 +61,13 @@ public class LogSource {
|
|||||||
/** Is Log4j available (in the current classpath) */
|
/** Is Log4j available (in the current classpath) */
|
||||||
static protected boolean log4jIsAvailable;
|
static protected boolean log4jIsAvailable;
|
||||||
|
|
||||||
/** Is JDK 1.4 logging available */
|
/**
|
||||||
static protected boolean jdk14IsAvailable;
|
* Is JDK 1.4 logging available, always true.
|
||||||
|
*
|
||||||
|
* @deprecated Java 8 is the baseline and includes JUL.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
static protected boolean jdk14IsAvailable = true;
|
||||||
|
|
||||||
/** Constructor for current log class */
|
/** Constructor for current log class */
|
||||||
static protected Constructor<?> logImplctor;
|
static protected Constructor<?> logImplctor;
|
||||||
@@ -77,9 +82,6 @@ public class LogSource {
|
|||||||
// Is Log4J Available?
|
// Is Log4J Available?
|
||||||
log4jIsAvailable = isClassForName("org.apache.log4j.Logger");
|
log4jIsAvailable = isClassForName("org.apache.log4j.Logger");
|
||||||
|
|
||||||
// Is JDK 1.4 Logging Available?
|
|
||||||
jdk14IsAvailable = isClassForName("org.apache.commons.logging.impl.Jdk14Logger");
|
|
||||||
|
|
||||||
// Set the default Log implementation
|
// Set the default Log implementation
|
||||||
String name = null;
|
String name = null;
|
||||||
try {
|
try {
|
||||||
@@ -104,10 +106,8 @@ public class LogSource {
|
|||||||
try {
|
try {
|
||||||
if (log4jIsAvailable) {
|
if (log4jIsAvailable) {
|
||||||
setLogImplementation("org.apache.commons.logging.impl.Log4JLogger");
|
setLogImplementation("org.apache.commons.logging.impl.Log4JLogger");
|
||||||
} else if (jdk14IsAvailable) {
|
|
||||||
setLogImplementation("org.apache.commons.logging.impl.Jdk14Logger");
|
|
||||||
} else {
|
} else {
|
||||||
setLogImplementation("org.apache.commons.logging.impl.NoOpLog");
|
setLogImplementation("org.apache.commons.logging.impl.Jdk14Logger");
|
||||||
}
|
}
|
||||||
} catch (final Throwable t) {
|
} catch (final Throwable t) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
28
src/test/java/org/apache/commons/logging/LogSourceTest.java
Normal file
28
src/test/java/org/apache/commons/logging/LogSourceTest.java
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* 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.commons.logging;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
public class LogSourceTest {
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public void testJdk14IsAvailable() throws Exception {
|
||||||
|
assertTrue(LogSource.jdk14IsAvailable);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user