diff --git a/akka-http/src/main/scala/akka/http/DefaultAkkaLoader.scala b/akka-http/src/main/scala/akka/http/DefaultAkkaLoader.scala index b7c09afde8..35a9918bc1 100644 --- a/akka-http/src/main/scala/akka/http/DefaultAkkaLoader.scala +++ b/akka-http/src/main/scala/akka/http/DefaultAkkaLoader.scala @@ -5,7 +5,7 @@ package akka.http import akka.config.Config -import akka.util.{Logging, Bootable} +import akka.util.{Bootable} import akka.remote.BootableRemoteActorService import akka.actor.BootableActorLoaderService import akka.servlet.AkkaLoader diff --git a/akka-http/src/main/scala/akka/http/EmbeddedAppServer.scala b/akka-http/src/main/scala/akka/http/EmbeddedAppServer.scala index d881459817..6ca38736f7 100644 --- a/akka-http/src/main/scala/akka/http/EmbeddedAppServer.scala +++ b/akka-http/src/main/scala/akka/http/EmbeddedAppServer.scala @@ -9,7 +9,7 @@ import javax.servlet.ServletConfig import java.io.File import akka.actor.BootableActorLoaderService -import akka.util.{Bootable, Logging} +import akka.util.Bootable import org.eclipse.jetty.xml.XmlConfiguration import org.eclipse.jetty.server.{Handler, Server} @@ -20,7 +20,7 @@ import akka.AkkaException /** * Handles the Akka Comet Support (load/unload) */ -trait EmbeddedAppServer extends Bootable with Logging { +trait EmbeddedAppServer extends Bootable { self: BootableActorLoaderService => import akka.config.Config._ @@ -39,7 +39,6 @@ trait EmbeddedAppServer extends Bootable with Logging { abstract override def onLoad = { super.onLoad if (isRestEnabled) { - log.slf4j.info("Attempting to start Akka HTTP service") val configuration = new XmlConfiguration(findJettyConfigXML.getOrElse(error("microkernel-server.xml not found!"))) @@ -64,15 +63,11 @@ trait EmbeddedAppServer extends Bootable with Logging { s.start() s } - log.slf4j.info("Akka HTTP service started") } } abstract override def onUnload = { super.onUnload - server foreach { t => - log.slf4j.info("Shutting down REST service (Jersey)") - t.stop() - } + server foreach { _.stop() } } } diff --git a/akka-http/src/main/scala/akka/http/JettyContinuation.scala b/akka-http/src/main/scala/akka/http/JettyContinuation.scala index c1c96f485c..9c02cf03ff 100644 --- a/akka-http/src/main/scala/akka/http/JettyContinuation.scala +++ b/akka-http/src/main/scala/akka/http/JettyContinuation.scala @@ -14,8 +14,7 @@ import Types._ /** * @author Garrick Evans */ -trait JettyContinuation extends ContinuationListener with akka.util.Logging -{ +trait JettyContinuation extends ContinuationListener { import javax.servlet.http.HttpServletResponse import MistSettings._ @@ -79,7 +78,6 @@ trait JettyContinuation extends ContinuationListener with akka.util.Logging // unexpected continution state(s) - log and do nothing // case _ => { - log.slf4j.warn("Received continuation in unexpected state: "+continuation.isInitial+" "+continuation.isSuspended+" "+continuation.isExpired+" "+continuation.isResumed) //continuation.cancel None } diff --git a/akka-http/src/main/scala/akka/http/Mist.scala b/akka-http/src/main/scala/akka/http/Mist.scala index dcad75456c..53a6d8f6d0 100644 --- a/akka-http/src/main/scala/akka/http/Mist.scala +++ b/akka-http/src/main/scala/akka/http/Mist.scala @@ -4,8 +4,8 @@ package akka.http -import akka.util.Logging import akka.actor.{ActorRegistry, ActorRef, Actor} +import akka.actor.{EventHandler} import javax.servlet.http.{HttpServletResponse, HttpServletRequest} import javax.servlet.http.HttpServlet @@ -63,7 +63,7 @@ import Types._ /** * */ -trait Mist extends Logging { +trait Mist { import javax.servlet.{ServletContext} import MistSettings._ @@ -118,16 +118,11 @@ trait Mist extends Logging { val server = context.getServerInfo val (major, minor) = (context.getMajorVersion, context.getMinorVersion) - log.slf4j.info("Initializing Akka HTTP on {} with Servlet API {}.{}",Array[AnyRef](server, major: java.lang.Integer, minor: java.lang.Integer)) - _factory = if (major >= 3) { - log.slf4j.info("Supporting Java asynchronous contexts.") Some(Servlet30ContextMethodFactory) } else if (server.toLowerCase startsWith JettyServer) { - log.slf4j.info("Supporting Jetty asynchronous continuations.") Some(JettyContinuationMethodFactory) } else { - log.slf4j.error("No asynchronous request handling can be supported.") None } } @@ -185,7 +180,7 @@ class AkkaMistFilter extends Filter with Mist { case "POST" => mistify(hreq, hres)(_factory.get.Post) case "PUT" => mistify(hreq, hres)(_factory.get.Put) case "TRACE" => mistify(hreq, hres)(_factory.get.Trace) - case unknown => log.slf4j.warn("Unknown http method: {}",unknown) + case unknown => {} } chain.doFilter(req,res) case _ => chain.doFilter(req,res) @@ -270,7 +265,6 @@ trait Endpoint { this: Actor => */ protected def _na(uri: String, req: RequestMethod) = { req.NotFound("No endpoint available for [" + uri + "]") - log.slf4j.debug("No endpoint available for [{}]", uri) } } @@ -300,7 +294,7 @@ class RootEndpoint extends Actor with Endpoint { def recv: Receive = { case NoneAvailable(uri, req) => _na(uri, req) - case unknown => log.slf4j.error("Unexpected message sent to root endpoint. [{}]", unknown) + case unknown => {} } /** @@ -319,8 +313,7 @@ class RootEndpoint extends Actor with Endpoint { * * @author Garrick Evans */ -trait RequestMethod extends Logging -{ +trait RequestMethod { import java.io.IOException import javax.servlet.http.{HttpServletResponse, HttpServletRequest} @@ -387,7 +380,6 @@ trait RequestMethod extends Logging case Some(pipe) => { try { if (!suspended) { - log.slf4j.warn("Attempt to complete an expired connection.") false } else { @@ -396,14 +388,13 @@ trait RequestMethod extends Logging true } } catch { - case io => - log.slf4j.error("Failed to write data to connection on resume - the client probably disconnected", io) + case io: Exception => + EventHandler notifyListeners EventHandler.Error(io, this) false } } case None => - log.slf4j.error("Attempt to complete request with no context.") false } @@ -411,24 +402,17 @@ trait RequestMethod extends Logging context match { case Some(pipe) => { try { - if (!suspended) { - log.slf4j.warn("Attempt to complete an expired connection.") - } - else { + if (suspended) { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to write data to connection on resume") pipe.complete } - } - catch { - case io: IOException => log.slf4j.error("Request completed with internal error.", io) - } - finally { - log.slf4j.error("Request completed with internal error.", t) + } catch { + case io: IOException => + EventHandler notifyListeners EventHandler.Error(io, this) } } - case None => - log.slf4j.error("Attempt to complete request with no context", t) + case None => {} } } diff --git a/akka-http/src/main/scala/akka/http/Servlet30Context.scala b/akka-http/src/main/scala/akka/http/Servlet30Context.scala index 974ece230d..1caeeb83ef 100644 --- a/akka-http/src/main/scala/akka/http/Servlet30Context.scala +++ b/akka-http/src/main/scala/akka/http/Servlet30Context.scala @@ -7,12 +7,12 @@ package akka.http import javax.servlet. {AsyncContext, AsyncListener, AsyncEvent}; import Types._ +import akka.actor.{EventHandler} /** * @author Garrick Evans */ -trait Servlet30Context extends AsyncListener with akka.util.Logging -{ +trait Servlet30Context extends AsyncListener { import javax.servlet.http.HttpServletResponse import MistSettings._ @@ -36,7 +36,7 @@ trait Servlet30Context extends AsyncListener with akka.util.Logging } catch { case ex: IllegalStateException => - log.slf4j.info("Cannot update timeout - already returned to container") + EventHandler notifyListeners EventHandler.Error(ex, this) false } } @@ -46,8 +46,8 @@ trait Servlet30Context extends AsyncListener with akka.util.Logging // def onComplete(e: AsyncEvent) {} def onError(e: AsyncEvent) = e.getThrowable match { - case null => log.slf4j.warn("Error occured...") - case t => log.slf4j.warn("Error occured", t) + case null => {} + case t => {} } def onStartAsync(e: AsyncEvent) {} def onTimeout(e: AsyncEvent) = { diff --git a/akka-http/src/main/scala/akka/security/Security.scala b/akka-http/src/main/scala/akka/security/Security.scala index 553984a22e..6105c5265e 100644 --- a/akka-http/src/main/scala/akka/security/Security.scala +++ b/akka-http/src/main/scala/akka/security/Security.scala @@ -23,9 +23,9 @@ package akka.security import akka.actor.{Scheduler, Actor, ActorRef, ActorRegistry, IllegalActorStateException} +import akka.actor.{EventHandler} import akka.actor.Actor._ import akka.config.Config -import akka.util.Logging import com.sun.jersey.api.model.AbstractMethod import com.sun.jersey.spi.container.{ResourceFilterFactory, ContainerRequest, ContainerRequestFilter, ContainerResponse, ContainerResponseFilter, ResourceFilter} @@ -69,9 +69,9 @@ case class SpnegoCredentials(token: Array[Byte]) extends Credentials /** * Jersey Filter for invocation intercept and authorization/authentication */ -class AkkaSecurityFilterFactory extends ResourceFilterFactory with Logging { +class AkkaSecurityFilterFactory extends ResourceFilterFactory { class Filter(actor: ActorRef, rolesAllowed: Option[List[String]]) - extends ResourceFilter with ContainerRequestFilter with Logging { + extends ResourceFilter with ContainerRequestFilter { override def getRequestFilter: ContainerRequestFilter = this @@ -91,7 +91,6 @@ class AkkaSecurityFilterFactory extends ResourceFilterFactory with Logging { throw new WebApplicationException(r.asInstanceOf[Response]) case None => throw new WebApplicationException(408) case unknown => { - log.slf4j.warn("Authenticator replied with unexpected result [{}]", unknown) throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR) } } @@ -244,7 +243,7 @@ trait BasicAuthenticationActor extends AuthenticationActor[BasicCredentials] { * class to create an authenticator. Don't forget to set the authenticator FQN in the * rest-part of the akka config */ -trait DigestAuthenticationActor extends AuthenticationActor[DigestCredentials] with Logging { +trait DigestAuthenticationActor extends AuthenticationActor[DigestCredentials] { import LiftUtils._ private object InvalidateNonces @@ -257,8 +256,7 @@ trait DigestAuthenticationActor extends AuthenticationActor[DigestCredentials] w case InvalidateNonces => val ts = System.currentTimeMillis nonceMap.filter(tuple => (ts - tuple._2) < nonceValidityPeriod) - case unknown => - log.slf4j.error("Don't know what to do with: ", unknown) + case unknown => {} } //Schedule the invalidation of nonces @@ -345,7 +343,7 @@ import org.ietf.jgss.GSSContext import org.ietf.jgss.GSSCredential import org.ietf.jgss.GSSManager -trait SpnegoAuthenticationActor extends AuthenticationActor[SpnegoCredentials] with Logging { +trait SpnegoAuthenticationActor extends AuthenticationActor[SpnegoCredentials] { override def unauthorized = Response.status(401).header("WWW-Authenticate", "Negotiate").build @@ -371,8 +369,8 @@ trait SpnegoAuthenticationActor extends AuthenticationActor[SpnegoCredentials] w Some(UserInfo(user, null, rolesFor(user))) } catch { case e: PrivilegedActionException => { - log.slf4j.error("Action not allowed", e) - return None + EventHandler notifyListeners EventHandler.Error(e, this) + None } } } diff --git a/akka-http/src/main/scala/akka/servlet/AkkaLoader.scala b/akka-http/src/main/scala/akka/servlet/AkkaLoader.scala index 6aef44d733..db689c9dac 100644 --- a/akka-http/src/main/scala/akka/servlet/AkkaLoader.scala +++ b/akka-http/src/main/scala/akka/servlet/AkkaLoader.scala @@ -6,12 +6,12 @@ package akka.servlet import akka.config.Config import akka.actor.Actor -import akka.util. {Switch, Logging, Bootable} +import akka.util. {Switch, Bootable} /* * This class is responsible for booting up a stack of bundles and then shutting them down */ -class AkkaLoader extends Logging { +class AkkaLoader { private val hasBooted = new Switch(false) @volatile private var _bundles: Option[Bootable] = None @@ -23,50 +23,50 @@ class AkkaLoader extends Logging { */ def boot(withBanner: Boolean, b : Bootable): Unit = hasBooted switchOn { if (withBanner) printBanner - log.slf4j.info("Starting Akka...") + println("Starting Akka...") b.onLoad Thread.currentThread.setContextClassLoader(getClass.getClassLoader) _bundles = Some(b) - log.slf4j.info("Akka started successfully") + println("Akka started successfully") } /* * Shutdown, well, shuts down the bundles used in boot */ def shutdown: Unit = hasBooted switchOff { - log.slf4j.info("Shutting down Akka...") + println("Shutting down Akka...") _bundles.foreach(_.onUnload) _bundles = None Actor.shutdownHook.run - log.slf4j.info("Akka succesfully shut down") + println("Akka succesfully shut down") } private def printBanner = { - log.slf4j.info("==================================================") - log.slf4j.info(" t") - log.slf4j.info(" t t t") - log.slf4j.info(" t t tt t") - log.slf4j.info(" tt t t tt t") - log.slf4j.info(" t ttttttt t ttt t") - log.slf4j.info(" t tt ttt t ttt t") - log.slf4j.info(" t t ttt t ttt t t") - log.slf4j.info(" tt t ttt ttt ttt t") - log.slf4j.info(" t t ttt ttt t tt t") - log.slf4j.info(" t ttt ttt t t") - log.slf4j.info(" tt ttt ttt t") - log.slf4j.info(" ttt ttt") - log.slf4j.info(" tttttttt ttt ttt ttt ttt tttttttt") - log.slf4j.info(" ttt tt ttt ttt ttt ttt ttt ttt") - log.slf4j.info(" ttt ttt ttt ttt ttt ttt ttt ttt") - log.slf4j.info(" ttt ttt ttt ttt ttt tt ttt ttt") - log.slf4j.info(" tttt ttttttttt tttttttt tttt") - log.slf4j.info(" ttttttttt ttt ttt ttt ttt ttttttttt") - log.slf4j.info(" ttt ttt ttt ttt ttt ttt ttt ttt") - log.slf4j.info(" ttt ttt ttt ttt ttt ttt ttt ttt") - log.slf4j.info(" ttt tt ttt ttt ttt ttt ttt ttt") - log.slf4j.info(" tttttttt ttt ttt ttt ttt tttttttt") - log.slf4j.info("==================================================") - log.slf4j.info(" Running version {}", Config.VERSION) - log.slf4j.info("==================================================") + println("==================================================") + println(" t") + println(" t t t") + println(" t t tt t") + println(" tt t t tt t") + println(" t ttttttt t ttt t") + println(" t tt ttt t ttt t") + println(" t t ttt t ttt t t") + println(" tt t ttt ttt ttt t") + println(" t t ttt ttt t tt t") + println(" t ttt ttt t t") + println(" tt ttt ttt t") + println(" ttt ttt") + println(" tttttttt ttt ttt ttt ttt tttttttt") + println(" ttt tt ttt ttt ttt ttt ttt ttt") + println(" ttt ttt ttt ttt ttt ttt ttt ttt") + println(" ttt ttt ttt ttt ttt tt ttt ttt") + println(" tttt ttttttttt tttttttt tttt") + println(" ttttttttt ttt ttt ttt ttt ttttttttt") + println(" ttt ttt ttt ttt ttt ttt ttt ttt") + println(" ttt ttt ttt ttt ttt ttt ttt ttt") + println(" ttt tt ttt ttt ttt ttt ttt ttt") + println(" tttttttt ttt ttt ttt ttt tttttttt") + println("==================================================") + println(" Running version {}", Config.VERSION) + println("==================================================") } } diff --git a/akka-http/src/main/scala/akka/servlet/Initializer.scala b/akka-http/src/main/scala/akka/servlet/Initializer.scala index cef7463f59..75b036d635 100644 --- a/akka-http/src/main/scala/akka/servlet/Initializer.scala +++ b/akka-http/src/main/scala/akka/servlet/Initializer.scala @@ -7,7 +7,7 @@ package akka.servlet import akka.remote.BootableRemoteActorService import akka.actor.BootableActorLoaderService import akka.config.Config -import akka.util.{Logging, Bootable} +import akka.util.Bootable import javax.servlet.{ServletContextListener, ServletContextEvent}