diff --git a/pom.xml b/pom.xml index 41d73ad2..426cc7ba 100644 --- a/pom.xml +++ b/pom.xml @@ -78,7 +78,7 @@ ch.qos.logback logback-classic - 1.1.7 + 1.2.3 javax.servlet diff --git a/src/main/scala/bootstrap/liftweb/Boot.scala b/src/main/scala/bootstrap/liftweb/Boot.scala index 1431a277..fe172918 100755 --- a/src/main/scala/bootstrap/liftweb/Boot.scala +++ b/src/main/scala/bootstrap/liftweb/Boot.scala @@ -38,16 +38,13 @@ import common._ import http._ import sitemap._ import Loc._ -import mapper._ import Helpers._ -import json.JsonDSL._ import net.liftmodules.widgets.tablesorter.TableSorter import java.io.FileInputStream import java.io.File -import code.lib.{OAuthClient, ObpGet, ObpJson, ObpAPI} -import ObpJson._ -import code.snippet._ -import code.util.MyExceptionLogger + +import code.lib.{OAuthClient, ObpJson} +import code.util.{Helper, MyExceptionLogger} /** * A class that's instantiated early and run. It allows the application @@ -56,6 +53,9 @@ import code.util.MyExceptionLogger class Boot extends Loggable{ def boot { + MDC.clear() + MDC.put( ("host", Helper.getHostname()) ) + val runningMode = Props.mode match { case Props.RunModes.Production => "Production mode" case Props.RunModes.Staging => "Staging mode" diff --git a/src/main/scala/code/util/Helper.scala b/src/main/scala/code/util/Helper.scala index fc88bee5..ba3e64c1 100644 --- a/src/main/scala/code/util/Helper.scala +++ b/src/main/scala/code/util/Helper.scala @@ -3,6 +3,7 @@ package code.util import code.lib.ObpAPI._ import code.lib.ObpJson.AccountJson import net.liftweb.common.Full +import net.liftweb.util.Props object Helper { @@ -43,7 +44,15 @@ Returns a string which can be used for the title of the account } - + def getHostname(): String = { + Props.get("hostname", "") match { + case s: String if s.nonEmpty => s.split(":").lift(1) match { + case Some(s) => s.replaceAll("\\/", "").replaceAll("\\.", "-") + case None => "unknown" + } + case _ => "unknown" + } + } }