Switching to raw SLF4J on internals

This commit is contained in:
Viktor Klang 2010-11-24 13:42:41 +01:00
parent 69a46daf3d
commit a02bd52047
5 changed files with 53 additions and 53 deletions

View file

@ -24,10 +24,10 @@ class AkkaLoader extends Logging {
def boot(withBanner: Boolean, b : Bootable): Unit = synchronized {
if (!hasBooted) {
if (withBanner) printBanner
log.info("Starting Akka...")
log.slf4j.info("Starting Akka...")
b.onLoad
Thread.currentThread.setContextClassLoader(getClass.getClassLoader)
log.info("Akka started successfully")
log.slf4j.info("Akka started successfully")
hasBooted = true
_bundles = Some(b)
}
@ -38,40 +38,40 @@ class AkkaLoader extends Logging {
*/
def shutdown = synchronized {
if (hasBooted) {
log.info("Shutting down Akka...")
log.slf4j.info("Shutting down Akka...")
_bundles.foreach(_.onUnload)
_bundles = None
Actor.shutdownHook.run
log.info("Akka succesfully shut down")
log.slf4j.info("Akka succesfully shut down")
}
}
private def printBanner = {
log.info("==================================================")
log.info(" t")
log.info(" t t t")
log.info(" t t tt t")
log.info(" tt t t tt t")
log.info(" t ttttttt t ttt t")
log.info(" t tt ttt t ttt t")
log.info(" t t ttt t ttt t t")
log.info(" tt t ttt ttt ttt t")
log.info(" t t ttt ttt t tt t")
log.info(" t ttt ttt t t")
log.info(" tt ttt ttt t")
log.info(" ttt ttt")
log.info(" tttttttt ttt ttt ttt ttt tttttttt")
log.info(" ttt tt ttt ttt ttt ttt ttt ttt")
log.info(" ttt ttt ttt ttt ttt ttt ttt ttt")
log.info(" ttt ttt ttt ttt ttt tt ttt ttt")
log.info(" tttt ttttttttt tttttttt tttt")
log.info(" ttttttttt ttt ttt ttt ttt ttttttttt")
log.info(" ttt ttt ttt ttt ttt ttt ttt ttt")
log.info(" ttt ttt ttt ttt ttt ttt ttt ttt")
log.info(" ttt tt ttt ttt ttt ttt ttt ttt")
log.info(" tttttttt ttt ttt ttt ttt tttttttt")
log.info("==================================================")
log.info(" Running version %s", Config.VERSION)
log.info("==================================================")
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 %s", Config.VERSION)
log.slf4j.info("==================================================")
}
}

View file

@ -35,7 +35,7 @@ trait EmbeddedAppServer extends Bootable with Logging {
abstract override def onLoad = {
super.onLoad
if (isRestEnabled) {
log.info("Attempting to start Akka HTTP service")
log.slf4j.info("Attempting to start Akka HTTP service")
System.setProperty("jetty.port", REST_PORT.toString)
System.setProperty("jetty.host", REST_HOSTNAME)
@ -60,14 +60,14 @@ trait EmbeddedAppServer extends Bootable with Logging {
s.start()
s
}
log.info("Akka HTTP service started")
log.slf4j.info("Akka HTTP service started")
}
}
abstract override def onUnload = {
super.onUnload
server foreach { t =>
log.info("Shutting down REST service (Jersey)")
log.slf4j.info("Shutting down REST service (Jersey)")
t.stop()
}
}

View file

@ -117,16 +117,16 @@ trait Mist extends Logging {
val server = context.getServerInfo
val (major, minor) = (context.getMajorVersion, context.getMinorVersion)
log.info("Initializing Akka HTTP on "+server+" with Servlet API "+major+"."+minor)
log.slf4j.info("Initializing Akka HTTP on {} with Servlet API {}.{}",Array(server, major, minor))
_factory = if (major >= 3) {
log.info("Supporting Java asynchronous contexts.")
log.slf4j.info("Supporting Java asynchronous contexts.")
Some(Servlet30ContextMethodFactory)
} else if (server.toLowerCase startsWith JettyServer) {
log.info("Supporting Jetty asynchronous continuations.")
log.slf4j.info("Supporting Jetty asynchronous continuations.")
Some(JettyContinuationMethodFactory)
} else {
log.error("No asynchronous request handling can be supported.")
log.slf4j.error("No asynchronous request handling can be supported.")
None
}
}
@ -184,7 +184,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.warn("Unknown http method: %s",unknown)
case unknown => log.slf4j.warn("Unknown http method: {}",unknown)
}
chain.doFilter(req,res)
case _ => chain.doFilter(req,res)
@ -269,7 +269,7 @@ trait Endpoint { this: Actor =>
*/
protected def _na(uri: String, req: RequestMethod) = {
req.NotFound("No endpoint available for [" + uri + "]")
log.debug("No endpoint available for [" + uri + "]")
log.slf4j.debug("No endpoint available for [{}]", uri)
}
}
@ -299,7 +299,7 @@ class RootEndpoint extends Actor with Endpoint {
def recv: Receive = {
case NoneAvailable(uri, req) => _na(uri, req)
case unknown => log.error("Unexpected message sent to root endpoint. [" + unknown + "]")
case unknown => log.slf4j.error("Unexpected message sent to root endpoint. [{}]", unknown)
}
/**
@ -386,7 +386,7 @@ trait RequestMethod extends Logging
case Some(pipe) => {
try {
if (!suspended) {
log.warning("Attempt to complete an expired connection.")
log.slf4j.warn("Attempt to complete an expired connection.")
false
}
else {
@ -396,13 +396,13 @@ trait RequestMethod extends Logging
}
} catch {
case io =>
log.error(io, "Failed to write data to connection on resume - the client probably disconnected")
log.slf4j.error("Failed to write data to connection on resume - the client probably disconnected", io)
false
}
}
case None =>
log.error("Attempt to complete request with no context.")
log.slf4j.error("Attempt to complete request with no context.")
false
}
@ -411,7 +411,7 @@ trait RequestMethod extends Logging
case Some(pipe) => {
try {
if (!suspended) {
log.warning("Attempt to complete an expired connection.")
log.slf4j.warn("Attempt to complete an expired connection.")
}
else {
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to write data to connection on resume")
@ -419,15 +419,15 @@ trait RequestMethod extends Logging
}
}
catch {
case io: IOException => log.error(io, "Request completed with internal error.")
case io: IOException => log.slf4j.error("Request completed with internal error.", io)
}
finally {
log.error(t, "Request completed with internal error.")
log.slf4j.error("Request completed with internal error.", t)
}
}
case None =>
log.error(t, "Attempt to complete request with no context")
log.slf4j.error("Attempt to complete request with no context", t)
}
}

View file

@ -91,7 +91,7 @@ class AkkaSecurityFilterFactory extends ResourceFilterFactory with Logging {
throw new WebApplicationException(r.asInstanceOf[Response])
case None => throw new WebApplicationException(408)
case unknown => {
log.warning("Authenticator replied with unexpected result [%s]", unknown);
log.slf4j.warn("Authenticator replied with unexpected result [%s]", unknown);
throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR)
}
}
@ -258,7 +258,7 @@ trait DigestAuthenticationActor extends AuthenticationActor[DigestCredentials] w
val ts = System.currentTimeMillis
nonceMap.filter(tuple => (ts - tuple._2) < nonceValidityPeriod)
case unknown =>
log.error("Don't know what to do with: ", unknown)
log.slf4j.error("Don't know what to do with: ", unknown)
}
//Schedule the invalidation of nonces
@ -371,7 +371,7 @@ trait SpnegoAuthenticationActor extends AuthenticationActor[SpnegoCredentials] w
Some(UserInfo(user, null, rolesFor(user)))
} catch {
case e: PrivilegedActionException => {
log.error(e, "Action not allowed")
log.slf4j.error("Action not allowed", e)
return None
}
}

View file

@ -36,7 +36,7 @@ trait Servlet30Context extends AsyncListener with akka.util.Logging
}
catch {
case ex: IllegalStateException =>
log.info("Cannot update timeout - already returned to container")
log.slf4j.info("Cannot update timeout - already returned to container")
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.warning("Error occured...")
case t => log.warning(t, "Error occured")
case null => log.slf4j.warn("Error occured...")
case t => log.slf4j.warn("Error occured", t)
}
def onStartAsync(e: AsyncEvent) {}
def onTimeout(e: AsyncEvent) = {