Skip to content

Commit

Permalink
Merge pull request wildfly#18015 from marko-bekhta/jboss-logging-upgrade
Browse files Browse the repository at this point in the history
WFLY-19500 Replace deprecated calls to the JBoss Logger methods
  • Loading branch information
jamezp authored Aug 30, 2024
2 parents 2f41409 + 5af06de commit 6215886
Show file tree
Hide file tree
Showing 79 changed files with 222 additions and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static org.jboss.logging.Logger.Level.ERROR;

import java.io.File;
import java.lang.invoke.MethodHandles;
import java.net.URL;

import javax.xml.stream.Location;
Expand All @@ -32,7 +33,7 @@ public interface AppClientLogger extends BasicLogger {
/**
* The root logger.
*/
AppClientLogger ROOT_LOGGER = Logger.getMessageLogger(AppClientLogger.class, "org.jboss.as.appclient");
AppClientLogger ROOT_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), AppClientLogger.class, "org.jboss.as.appclient");

// /**
// * Logs a generic error message using the {@link Throwable#toString() t.toString()} for the error message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package org.wildfly.extension.batch.jberet._private;

import java.lang.invoke.MethodHandles;
import java.security.Permission;
import jakarta.batch.operations.BatchRuntimeException;
import jakarta.batch.operations.JobSecurityException;
Expand All @@ -31,7 +32,7 @@ public interface BatchLogger extends BasicLogger {
/**
* A logger with the category {@code org.wildfly.extension.batch}.
*/
BatchLogger LOGGER = Logger.getMessageLogger(BatchLogger.class, "org.wildfly.extension.batch");
BatchLogger LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), BatchLogger.class, "org.wildfly.extension.batch");

/**
* Creates an exception indicating there was an error processing the batch jobs directory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

package org.wildfly.extension.beanvalidation.logging;

import java.lang.invoke.MethodHandles;

import org.jboss.logging.BasicLogger;
import org.jboss.logging.Logger;
import org.jboss.logging.annotations.MessageLogger;
Expand All @@ -15,6 +17,6 @@
@MessageLogger(projectCode = "WFLYBV", length = 4)
public interface BeanValidationLogger extends BasicLogger {

BeanValidationLogger ROOT_LOGGER = Logger.getMessageLogger(BeanValidationLogger.class, "org.wildfly.extension.beanvalidation");
BeanValidationLogger ROOT_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), BeanValidationLogger.class, "org.wildfly.extension.beanvalidation");

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import static org.jboss.logging.Logger.Level.WARN;

import java.lang.invoke.MethodHandles;
import java.util.Set;

import org.jboss.as.controller.OperationFailedException;
Expand All @@ -28,7 +29,7 @@ public interface ClusteringLogger extends BasicLogger {
/**
* The root logger.
*/
ClusteringLogger ROOT_LOGGER = Logger.getMessageLogger(ClusteringLogger.class, ROOT_LOGGER_CATEGORY);
ClusteringLogger ROOT_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), ClusteringLogger.class, ROOT_LOGGER_CATEGORY);

@Message(id = 1, value = "%2$g is not a valid value for parameter %1$s. The value must be %3$s %4$g")
OperationFailedException parameterValueOutOfBounds(String name, double value, String relationalOperator, double bound);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import static org.jboss.logging.Logger.Level.INFO;

import java.lang.invoke.MethodHandles;

import org.jboss.logging.BasicLogger;
import org.jboss.logging.annotations.Cause;
import org.jboss.logging.annotations.LogMessage;
Expand All @@ -20,7 +22,7 @@
public interface Logger extends BasicLogger {
String ROOT_LOGGER_CATEGORY = "org.wildfly.clustering.ee.infinispan";

Logger ROOT_LOGGER = org.jboss.logging.Logger.getMessageLogger(Logger.class, ROOT_LOGGER_CATEGORY);
Logger ROOT_LOGGER = org.jboss.logging.Logger.getMessageLogger(MethodHandles.lookup(), Logger.class, ROOT_LOGGER_CATEGORY);

@LogMessage(level = INFO)
@Message(id = 1, value = "Failed to cancel %s on primary owner.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import static org.jboss.logging.Logger.Level.WARN;

import java.lang.invoke.MethodHandles;

import org.jboss.logging.BasicLogger;
import org.jboss.logging.Logger;
import org.jboss.logging.annotations.Cause;
Expand All @@ -26,7 +28,7 @@ public interface InfinispanEjbLogger extends BasicLogger {
/**
* A logger with the category of the default clustering package.
*/
InfinispanEjbLogger ROOT_LOGGER = Logger.getMessageLogger(InfinispanEjbLogger.class, ROOT_LOGGER_CATEGORY);
InfinispanEjbLogger ROOT_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), InfinispanEjbLogger.class, ROOT_LOGGER_CATEGORY);

// @LogMessage(level = WARN)
// @Message(id = 1, value = "Failed to passivate stateful session bean %s")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static org.jboss.logging.Logger.Level.INFO;
import static org.jboss.logging.Logger.Level.WARN;

import java.lang.invoke.MethodHandles;
import java.util.Set;

import org.infinispan.client.hotrod.exceptions.HotRodClientException;
Expand All @@ -30,7 +31,7 @@ public interface InfinispanLogger extends BasicLogger {
/**
* The root logger.
*/
InfinispanLogger ROOT_LOGGER = Logger.getMessageLogger(InfinispanLogger.class, ROOT_LOGGER_CATEGORY);
InfinispanLogger ROOT_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), InfinispanLogger.class, ROOT_LOGGER_CATEGORY);

/**
* Logs an informational message indicating the Infinispan subsystem is being activated.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static org.jboss.logging.Logger.Level.INFO;
import static org.jboss.logging.Logger.Level.WARN;

import java.lang.invoke.MethodHandles;
import java.net.InetSocketAddress;
import java.net.URL;
import java.net.UnknownHostException;
Expand All @@ -33,7 +34,7 @@ public interface JGroupsLogger extends BasicLogger {
/**
* The root logger.
*/
JGroupsLogger ROOT_LOGGER = Logger.getMessageLogger(JGroupsLogger.class, ROOT_LOGGER_CATEGORY);
JGroupsLogger ROOT_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), JGroupsLogger.class, ROOT_LOGGER_CATEGORY);

/**
* Logs an informational message indicating the JGroups subsystem is being activated.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import static org.jboss.logging.Logger.Level.WARN;

import java.lang.invoke.MethodHandles;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
Expand All @@ -29,7 +30,7 @@ public interface ClusteringServerLogger extends BasicLogger {
/**
* The root logger.
*/
ClusteringServerLogger ROOT_LOGGER = Logger.getMessageLogger(ClusteringServerLogger.class, ROOT_LOGGER_CATEGORY);
ClusteringServerLogger ROOT_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), ClusteringServerLogger.class, ROOT_LOGGER_CATEGORY);

/* Command dispatcher messages */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import static org.jboss.logging.Logger.Level.INFO;

import java.lang.invoke.MethodHandles;

import org.jboss.logging.BasicLogger;
import org.jboss.logging.Logger;
import org.jboss.logging.annotations.LogMessage;
Expand All @@ -21,7 +23,7 @@
public interface SingletonLogger extends BasicLogger {
String ROOT_LOGGER_CATEGORY = "org.wildfly.extension.clustering.singleton";

SingletonLogger ROOT_LOGGER = Logger.getMessageLogger(SingletonLogger.class, ROOT_LOGGER_CATEGORY);
SingletonLogger ROOT_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), SingletonLogger.class, ROOT_LOGGER_CATEGORY);

@LogMessage(level = INFO)
@Message(id = 1, value = "Singleton deployment detected. Deployment will reset using %s policy.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static org.jboss.logging.Logger.Level.INFO;
import static org.jboss.logging.Logger.Level.WARN;

import java.lang.invoke.MethodHandles;
import java.util.Collection;

import org.jboss.logging.BasicLogger;
Expand All @@ -29,7 +30,7 @@ public interface SingletonLogger extends BasicLogger {
/**
* The root logger.
*/
SingletonLogger ROOT_LOGGER = Logger.getMessageLogger(SingletonLogger.class, ROOT_LOGGER_CATEGORY);
SingletonLogger ROOT_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), SingletonLogger.class, ROOT_LOGGER_CATEGORY);

@LogMessage(level = INFO)
@Message(id = 1, value = "This node will now operate as the singleton provider of the %s service")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

package org.wildfly.clustering.web.cache.logging;

import java.lang.invoke.MethodHandles;

import org.jboss.logging.BasicLogger;
import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageLogger;
Expand All @@ -16,7 +18,7 @@
public interface Logger extends BasicLogger {
String ROOT_LOGGER_CATEGORY = "org.wildfly.clustering.web.cache";

Logger ROOT_LOGGER = org.jboss.logging.Logger.getMessageLogger(Logger.class, ROOT_LOGGER_CATEGORY);
Logger ROOT_LOGGER = org.jboss.logging.Logger.getMessageLogger(MethodHandles.lookup(), Logger.class, ROOT_LOGGER_CATEGORY);

@Message(id = 1, value = "Session %s is not valid")
IllegalStateException invalidSession(String sessionId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import static org.jboss.logging.Logger.Level.*;

import java.lang.invoke.MethodHandles;

import org.jboss.logging.BasicLogger;
import org.jboss.logging.annotations.Cause;
import org.jboss.logging.annotations.LogMessage;
Expand All @@ -20,7 +22,7 @@
public interface Logger extends BasicLogger {
String ROOT_LOGGER_CATEGORY = "org.wildfly.clustering.web.hotrod";

Logger ROOT_LOGGER = org.jboss.logging.Logger.getMessageLogger(Logger.class, ROOT_LOGGER_CATEGORY);
Logger ROOT_LOGGER = org.jboss.logging.Logger.getMessageLogger(MethodHandles.lookup(), Logger.class, ROOT_LOGGER_CATEGORY);

@LogMessage(level = WARN)
@Message(id = 1, value = "Failed to expire session %s")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import static org.jboss.logging.Logger.Level.DEBUG;
import static org.jboss.logging.Logger.Level.WARN;

import java.lang.invoke.MethodHandles;

import org.jboss.logging.BasicLogger;
import org.jboss.logging.Logger;
import org.jboss.logging.annotations.Cause;
Expand All @@ -25,7 +27,7 @@
public interface InfinispanWebLogger extends BasicLogger {
String ROOT_LOGGER_CATEGORY = "org.wildfly.clustering.web.infinispan";

InfinispanWebLogger ROOT_LOGGER = Logger.getMessageLogger(InfinispanWebLogger.class, ROOT_LOGGER_CATEGORY);
InfinispanWebLogger ROOT_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), InfinispanWebLogger.class, ROOT_LOGGER_CATEGORY);

@LogMessage(level = WARN)
@Message(id = 1, value = "Failed to passivate attributes of session %s")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

package org.wildfly.clustering.web.undertow.logging;

import java.lang.invoke.MethodHandles;

import org.jboss.logging.BasicLogger;
import org.jboss.logging.Logger;
import org.jboss.logging.Logger.Level;
Expand All @@ -15,7 +17,7 @@
@MessageLogger(projectCode = "WFLYCLWEBUT", length = 4)
public interface UndertowClusteringLogger extends BasicLogger {

UndertowClusteringLogger ROOT_LOGGER = Logger.getMessageLogger(UndertowClusteringLogger.class, "org.wildfly.clustering.web.undertow");
UndertowClusteringLogger ROOT_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), UndertowClusteringLogger.class, "org.wildfly.clustering.web.undertow");

@Message(id = 1, value = "Session %s is invalid")
IllegalStateException sessionIsInvalid(String sessionId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import static org.jboss.logging.Logger.Level.INFO;
import static org.jboss.logging.Logger.Level.WARN;

import java.lang.invoke.MethodHandles;
import java.sql.Driver;
import java.util.Set;

Expand Down Expand Up @@ -42,42 +43,42 @@ public interface ConnectorLogger extends BasicLogger {
/**
* The root logger with a category of the default package.
*/
ConnectorLogger ROOT_LOGGER = Logger.getMessageLogger(ConnectorLogger.class, "org.jboss.as.connector");
ConnectorLogger ROOT_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), ConnectorLogger.class, "org.jboss.as.connector");

/**
* A logger with the category {@code org.jboss.as.connector.deployers.jdbc}.
*/
ConnectorLogger DEPLOYER_JDBC_LOGGER = Logger.getMessageLogger(ConnectorLogger.class, "org.jboss.as.connector.deployers.jdbc");
ConnectorLogger DEPLOYER_JDBC_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), ConnectorLogger.class, "org.jboss.as.connector.deployers.jdbc");

/**
* A logger with the category {@code org.jboss.as.deployment.connector}.
*/
ConnectorLogger DEPLOYMENT_CONNECTOR_LOGGER = Logger.getMessageLogger(ConnectorLogger.class, "org.jboss.as.connector.deployment");
ConnectorLogger DEPLOYMENT_CONNECTOR_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), ConnectorLogger.class, "org.jboss.as.connector.deployment");

/**
* A logger with the category {@code org.jboss.as.deployment.connector.registry}.
*/
ConnectorLogger DEPLOYMENT_CONNECTOR_REGISTRY_LOGGER = Logger.getMessageLogger(ConnectorLogger.class, "org.jboss.as.connector.deployment.registry");
ConnectorLogger DEPLOYMENT_CONNECTOR_REGISTRY_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), ConnectorLogger.class, "org.jboss.as.connector.deployment.registry");

/**
* A logger with the category {@code org.jboss.as.connector.deployer.dsdeployer}.
*/
ConnectorLogger DS_DEPLOYER_LOGGER = Logger.getMessageLogger(ConnectorLogger.class, "org.jboss.as.connector.deployer.dsdeployer");
ConnectorLogger DS_DEPLOYER_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), ConnectorLogger.class, "org.jboss.as.connector.deployer.dsdeployer");

/**
* A logger with the category {@code org.jboss.as.connector.services.mdr}.
*/
ConnectorLogger MDR_LOGGER = Logger.getMessageLogger(ConnectorLogger.class, "org.jboss.as.connector.services.mdr");
ConnectorLogger MDR_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), ConnectorLogger.class, "org.jboss.as.connector.services.mdr");

/**
* A logger with the category {@code org.jboss.as.connector.subsystems.datasources}.
*/
ConnectorLogger SUBSYSTEM_DATASOURCES_LOGGER = Logger.getMessageLogger(ConnectorLogger.class, "org.jboss.as.connector.subsystems.datasources");
ConnectorLogger SUBSYSTEM_DATASOURCES_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), ConnectorLogger.class, "org.jboss.as.connector.subsystems.datasources");

/**
* A logger with the category {@code org.jboss.as.connector.subsystems.resourceadapters}.
*/
ConnectorLogger SUBSYSTEM_RA_LOGGER = Logger.getMessageLogger(ConnectorLogger.class, "org.jboss.as.connector.subsystems.resourceadapters");
ConnectorLogger SUBSYSTEM_RA_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), ConnectorLogger.class, "org.jboss.as.connector.subsystems.resourceadapters");

/**
* Logs an informational message indicating the data source has been bound.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
package org.jboss.as.connector.metadata.common;

import java.lang.invoke.MethodHandles;
import java.util.Objects;

import org.jboss.as.connector.logging.ConnectorLogger;
Expand All @@ -25,7 +26,7 @@ public class CredentialImpl implements Credential {

private static final long serialVersionUID = 7990943957924515091L;

private static CommonBundle bundle = (CommonBundle) Messages.getBundle(CommonBundle.class);
private static CommonBundle bundle = Messages.getBundle(MethodHandles.lookup(), CommonBundle.class);
private final String userName;
private final String password;
private final String securityDomain;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static org.jboss.as.connector.logging.ConnectorLogger.DEPLOYMENT_CONNECTOR_LOGGER;

import java.io.File;
import java.lang.invoke.MethodHandles;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -45,7 +46,7 @@
public final class ResourceAdapterActivatorService extends AbstractResourceAdapterDeploymentService implements
Service<ResourceAdapterDeployment> {

private static final DeployersLogger DEPLOYERS_LOGGER = Logger.getMessageLogger(DeployersLogger.class, ResourceAdapterActivator.class.getName());
private static final DeployersLogger DEPLOYERS_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), DeployersLogger.class, ResourceAdapterActivator.class.getName());

private final ClassLoader cl;
private final Connector cmd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static org.jboss.as.connector.logging.ConnectorLogger.DEPLOYMENT_CONNECTOR_LOGGER;

import java.io.File;
import java.lang.invoke.MethodHandles;
import java.net.URL;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -54,7 +55,7 @@
public final class ResourceAdapterDeploymentService extends AbstractResourceAdapterDeploymentService implements
Service<ResourceAdapterDeployment> {

private static final DeployersLogger DEPLOYERS_LOGGER = Logger.getMessageLogger(DeployersLogger.class, "org.jboss.as.connector.deployers.RADeployer");
private static final DeployersLogger DEPLOYERS_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), DeployersLogger.class, "org.jboss.as.connector.deployers.RADeployer");

private final ClassLoader classLoader;
private final ConnectorXmlDescriptor connectorXmlDescriptor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static org.jboss.as.connector.logging.ConnectorLogger.DEPLOYMENT_CONNECTOR_LOGGER;

import java.io.File;
import java.lang.invoke.MethodHandles;
import java.net.URL;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -43,7 +44,7 @@
public final class ResourceAdapterXmlDeploymentService extends AbstractResourceAdapterDeploymentService implements
Service<ResourceAdapterDeployment> {

private static final DeployersLogger DEPLOYERS_LOGGER = Logger.getMessageLogger(DeployersLogger.class, "org.jboss.as.connector.deployers.RaXmlDeployer");
private static final DeployersLogger DEPLOYERS_LOGGER = Logger.getMessageLogger(MethodHandles.lookup(), DeployersLogger.class, "org.jboss.as.connector.deployers.RaXmlDeployer");

private final Module module;
private final ConnectorXmlDescriptor connectorXmlDescriptor;
Expand Down
Loading

0 comments on commit 6215886

Please sign in to comment.