Removed logging

This commit is contained in:
Jonas Bonér 2011-02-28 22:54:32 +01:00
parent 359a63c2fb
commit 9354f0790c
51 changed files with 154 additions and 556 deletions

View file

@ -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

View file

@ -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() }
}
}

View file

@ -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
}

View file

@ -4,7 +4,6 @@
package akka.http
import akka.util.Logging
import akka.actor.{ActorRegistry, ActorRef, Actor}
import javax.servlet.http.{HttpServletResponse, HttpServletRequest}
@ -63,7 +62,7 @@ import Types._
/**
*
*/
trait Mist extends Logging {
trait Mist {
import javax.servlet.{ServletContext}
import MistSettings._
@ -118,16 +117,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 +179,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 +264,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 +293,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 +312,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 +379,6 @@ trait RequestMethod extends Logging
case Some(pipe) => {
try {
if (!suspended) {
log.slf4j.warn("Attempt to complete an expired connection.")
false
}
else {
@ -397,13 +388,11 @@ trait RequestMethod extends Logging
}
} catch {
case io =>
log.slf4j.error("Failed to write data to connection on resume - the client probably disconnected", io)
false
}
}
case None =>
log.slf4j.error("Attempt to complete request with no context.")
false
}
@ -411,24 +400,16 @@ 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 => {}
}
}
case None =>
log.slf4j.error("Attempt to complete request with no context", t)
case None => {}
}
}

View file

@ -11,8 +11,7 @@ import Types._
/**
* @author Garrick Evans
*/
trait Servlet30Context extends AsyncListener with akka.util.Logging
{
trait Servlet30Context extends AsyncListener {
import javax.servlet.http.HttpServletResponse
import MistSettings._
@ -36,7 +35,6 @@ trait Servlet30Context extends AsyncListener with akka.util.Logging
}
catch {
case ex: IllegalStateException =>
log.slf4j.info("Cannot update timeout - already returned to container")
false
}
}
@ -46,8 +44,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) = {

View file

@ -25,7 +25,6 @@ package akka.security
import akka.actor.{Scheduler, Actor, ActorRef, ActorRegistry, IllegalActorStateException}
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 +68,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 +90,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 +242,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 +255,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 +342,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,7 +368,6 @@ 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
}
}

View file

@ -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("==================================================")
}
}

View file

@ -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}