Skip to content

Commit

Permalink
WFLY-1360 Improve log message when registering a handler
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas committed May 24, 2013
1 parent d297290 commit c797d30
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public LocationService(String locationPath) {

@Override
public void start(StartContext context) throws StartException {
UndertowLogger.ROOT_LOGGER.infof("registering handler %s under path '%s'", httpHandler, locationPath);
UndertowLogger.ROOT_LOGGER.registeringHandler( httpHandler.getValue(), locationPath);
host.getValue().registerHandler(locationPath, configureHandler());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@

package org.wildfly.extension.undertow;

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

import java.net.InetSocketAddress;

import io.undertow.server.HttpHandler;
import org.jboss.as.clustering.web.OutgoingDistributableSessionData;
import org.wildfly.extension.undertow.session.ClusteredSession;
import org.jboss.jandex.ClassInfo;
import org.jboss.logging.BasicLogger;
import org.jboss.logging.Logger;
import org.jboss.logging.annotations.Cause;
import org.jboss.logging.annotations.LogMessage;
import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageLogger;
import org.wildfly.extension.undertow.session.ClusteredSession;

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

/**
* <p/>
Expand Down Expand Up @@ -258,4 +258,12 @@ public interface UndertowLogger extends BasicLogger {
@LogMessage(level = WARN)
@Message(id = 17526, value = "Could not create redirect URI.")
void invalidRedirectURI(@Cause Throwable cause);

@LogMessage(level = INFO)
@Message(id = 17527, value = "Creating file handler for path %s")
void creatingFileHandler(String path);

@LogMessage(level = INFO)
@Message(id = 17528, value="registering handler %s under path '%s'")
void registeringHandler(HttpHandler value, String locationPath);
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.util.Arrays;
import java.util.Collection;

import io.undertow.UndertowLogger;
import io.undertow.server.HttpHandler;
import io.undertow.server.handlers.resource.FileResourceManager;
import io.undertow.server.handlers.resource.ResourceHandler;
Expand All @@ -39,6 +38,7 @@
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;
import org.wildfly.extension.undertow.Constants;
import org.wildfly.extension.undertow.UndertowLogger;

/**
* @author <a href="mailto:tomaz.cerar@redhat.com">Tomaz Cerar</a> (c) 2013 Red Hat Inc.
Expand Down Expand Up @@ -78,7 +78,7 @@ public Collection<AttributeDefinition> getAttributes() {
public HttpHandler createHandler(final OperationContext context, ModelNode model) throws OperationFailedException {
String path = PATH.resolveModelAttribute(context, model).asString();
boolean directoryListing = DIRECTORY_LISTING.resolveModelAttribute(context, model).asBoolean();
UndertowLogger.ROOT_LOGGER.infof("Creating file handler for path %s", path);
UndertowLogger.ROOT_LOGGER.creatingFileHandler(path);
FileResourceManager resourceManager = new FileResourceManager(Paths.get(path));
ResourceHandler handler = new ResourceHandler();
handler.setResourceManager(resourceManager);
Expand Down

0 comments on commit c797d30

Please sign in to comment.