diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index 973ed73..ca912c3 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -12,4 +12,8 @@ + + + + \ No newline at end of file diff --git a/src/main/scala/com/jdrews/logstation/LogStation.scala b/src/main/scala/com/jdrews/logstation/LogStation.scala index d7ed63a..927b0d2 100644 --- a/src/main/scala/com/jdrews/logstation/LogStation.scala +++ b/src/main/scala/com/jdrews/logstation/LogStation.scala @@ -43,11 +43,11 @@ object LogStation extends App { //filter through each config of syntax and convert into map syntaxes.foreach(syntax => { val matchList: java.util.ArrayList[String] = syntax.getValue().unwrapped().asInstanceOf[java.util.ArrayList[String]] - logger.info(matchList.toString) + logger.debug(matchList.toString) syntaxList(matchList.get(0)) = matchList.get(1).r }) } - logger.info(s"syntaxList: $syntaxList") + logger.debug(s"syntaxList: $syntaxList") val maxLogLinesPerLog = { if (conf.hasPath("logstation.maxLogLinesPerLog")) { @@ -130,6 +130,7 @@ object LogStation extends App { bw.write(DefaultConfigHolder.defaultConfig) bw.close() println("Please setup your logstation.conf located here: " + file.getAbsolutePath()) + println("Then relaunch and logstation will be located at: http://127.0.0.1:" + webServerPort) System.exit(0) } } diff --git a/src/main/scala/com/jdrews/logstation/config/BridgeActor.scala b/src/main/scala/com/jdrews/logstation/config/BridgeActor.scala index 500dcf3..5da71e8 100644 --- a/src/main/scala/com/jdrews/logstation/config/BridgeActor.scala +++ b/src/main/scala/com/jdrews/logstation/config/BridgeActor.scala @@ -20,34 +20,34 @@ class BridgeActor extends Actor with ActorLogging { private var msgs = new FixedList[Any](bufferLength) def receive = { case lift: LiftActor => - log.info(s"received LiftActor: $lift") + log.debug(s"received LiftActor: $lift") target = Some(lift) // send LogStationWebServer the maxLogLinesPerLog lift ! MaxLogLinesPerLog(maxLogLinesPerLog) if (msgs.nonEmpty) { - log.info("sending out buffered msgs") + log.debug("sending out buffered msgs") msgs.foreach{ m => - log.info(s"passing the following to $lift: $m") + log.debug(s"passing the following to $lift: $m") lift ! m } - log.info("done") + log.debug("done") } case mll: MaxLogLinesPerLog => - log.info(s"received maxLogLinesPerLog: $mll") + log.debug(s"received maxLogLinesPerLog: $mll") maxLogLinesPerLog = mll.myVal case bl: BufferLength => - log.info(s"received bufferLength: $bl") + log.debug(s"received bufferLength: $bl") bufferLength = bl.myVal // rebuild msgs list with new buffer length msgs = new FixedList[Any](bufferLength) case msg => if (target.isEmpty) { - log.info(s"buffering this message since target is empty... $msg") + log.debug(s"buffering this message since target is empty... $msg") msgs.append(msg) } else { - log.info(s"passing the following to $target: $msg") + log.debug(s"passing the following to $target: $msg") target.foreach(_ ! msg) } } diff --git a/src/main/scala/com/jdrews/logstation/tailer/LogTailerActor.scala b/src/main/scala/com/jdrews/logstation/tailer/LogTailerActor.scala index 67896d4..7ce2e7d 100644 --- a/src/main/scala/com/jdrews/logstation/tailer/LogTailerActor.scala +++ b/src/main/scala/com/jdrews/logstation/tailer/LogTailerActor.scala @@ -36,7 +36,7 @@ class LogTailerActor extends Actor with ActorLogging { if (!Thread.currentThread().isInterrupted) { val l = r.readLine if (l != null) { - log.info(s"read line: $l") +// log.info(s"read line: $l") // pass to colorizer if it's up, otherwise skip it and go straight to bridge colorizer.getOrElse(bridge) ! new LogMessage(XmlEscapers.xmlAttributeEscaper().escape(l), XmlEscapers.xmlAttributeEscaper().escape(logFile)) } @@ -52,7 +52,7 @@ class LogTailerActor extends Actor with ActorLogging { while (!Thread.currentThread().isInterrupted) { val l = r.readLine if (l != null) { - log.info(s"read line: $l") +// log.info(s"read line: $l") // pass to colorizer if it's up, otherwise skip it and go straight to bridge colorizer.getOrElse(bridge) ! new LogMessage(l, logFile) } @@ -64,7 +64,7 @@ class LogTailerActor extends Actor with ActorLogging { def receive = { case LogThisFile(logFile) => - log.info(s"About to begin logging $logFile") + log.debug(s"About to begin logging $logFile") // calculate bytes to skip to get to last N bytes of file val file: File = new File(logFile) val readLastNBytes = 100 @@ -84,9 +84,9 @@ class LogTailerActor extends Actor with ActorLogging { readerThreads += readerThread case cref: ActorRef => // load up the colorizer - log.warning(s"got the colorzier! $cref") + log.debug(s"got the colorzier! $cref") colorizer = Some(cref) - log.info(s"the colorizer.getOrElse -> ${colorizer.getOrElse("nada hombre!")}") + log.debug(s"the colorizer.getOrElse -> ${colorizer.getOrElse("nada hombre!")}") case ServiceShutdown => log.info("shutting down read thread") readerThreads.foreach(thread => thread.interrupt()) diff --git a/src/main/scala/com/jdrews/logstation/utils/LogStationColorizer.scala b/src/main/scala/com/jdrews/logstation/utils/LogStationColorizer.scala index 2f60200..6d4debf 100644 --- a/src/main/scala/com/jdrews/logstation/utils/LogStationColorizer.scala +++ b/src/main/scala/com/jdrews/logstation/utils/LogStationColorizer.scala @@ -20,7 +20,7 @@ class LogStationColorizer extends Actor with ActorLogging { private val bridge = BridgeController.getBridgeActor def receive = { case syntax: scala.collection.mutable.Map[String, Regex] => - log.info(s"Got config $syntax}") + log.debug(s"Got config $syntax}") // load up the syntaxes syntaxList = syntax @@ -33,7 +33,7 @@ class LogStationColorizer extends Actor with ActorLogging { syntaxList.foreach(syntax => // get the first syntax regex, and find the first one to match the log message if (syntax._2.findFirstIn(lm.logMessage).isDefined) { - log.info(s"got a match! ${syntax._1}") + // log.debug(s"got a match! ${syntax._1}") // wrap log message in new colors msg = s"${lm.logMessage}" loop.break diff --git a/src/main/scala/com/jdrews/logstation/webserver/EmbeddedWebapp.scala b/src/main/scala/com/jdrews/logstation/webserver/EmbeddedWebapp.scala index 21c432f..37ec7e8 100644 --- a/src/main/scala/com/jdrews/logstation/webserver/EmbeddedWebapp.scala +++ b/src/main/scala/com/jdrews/logstation/webserver/EmbeddedWebapp.scala @@ -25,7 +25,7 @@ class EmbeddedWebapp(val port: Int = 8884, val contextPath: String = "/") { val context = new WebAppContext() context.setContextPath(contextPath) val warUrlString = this.getClass.getClassLoader.getResource("webapp").toExternalForm() - logger.info(s"warUrlString: $warUrlString") + logger.debug(s"warUrlString: $warUrlString") context.setWar(warUrlString) server.setHandler(context) diff --git a/src/main/scala/com/jdrews/logstation/webserver/comet/LogStationPage.scala b/src/main/scala/com/jdrews/logstation/webserver/comet/LogStationPage.scala index 86989b4..8f77b74 100644 --- a/src/main/scala/com/jdrews/logstation/webserver/comet/LogStationPage.scala +++ b/src/main/scala/com/jdrews/logstation/webserver/comet/LogStationPage.scala @@ -19,20 +19,20 @@ class LogStationPage extends CometActor with CometListener with Loggable { override def lowPriority = { case lm: LogMessage => - logger.info(s"got LogMessage: $lm") + logger.debug(s"got LogMessage: $lm") partialUpdate(JsFunc("addOrAppendLogMessage", lm.logFile, lm.logMessage).cmd) case nlp: NewListenerPackage => - logger.info(s"received a new listener package: $nlp") + logger.debug(s"received a new listener package: $nlp") partialUpdate(JsFunc("updateMaxLogLinesPerLog", nlp.maxLogLinesPerLog).cmd) nlp.msgs.foreach{ lm => - logger.info(s"passing the following up: $lm") + logger.debug(s"passing the following up: $lm") partialUpdate(JsFunc("addOrAppendLogMessage", lm.logFile, lm.logMessage).cmd) } case mll: Int => partialUpdate(JsFunc("updateMaxLogLinesPerLog", mll).cmd) maxLogLinesPerLog = mll case something => - logger.info(s"in LogStationPage: got something, not sure what it is: $something") + logger.warn(s"in LogStationPage: got something, not sure what it is: $something") } diff --git a/src/main/scala/com/jdrews/logstation/webserver/comet/LogStationWebServer.scala b/src/main/scala/com/jdrews/logstation/webserver/comet/LogStationWebServer.scala index 03d4f29..2b6e5bd 100644 --- a/src/main/scala/com/jdrews/logstation/webserver/comet/LogStationWebServer.scala +++ b/src/main/scala/com/jdrews/logstation/webserver/comet/LogStationWebServer.scala @@ -22,7 +22,7 @@ object LogStationWebServer extends LiftActor with ListenerManager with Loggable private var bufferLength = 17 private var msgs = new FixedList[LogMessage](bufferLength) - logger.info("at the front of LogStationWebServer...") + logger.debug("at the front of LogStationWebServer...") // A bridge between the Lift and Akka actor libraries private lazy val bridge: ActorRef = BridgeController.getBridgeActor @@ -49,22 +49,22 @@ object LogStationWebServer extends LiftActor with ListenerManager with Loggable */ override def lowPriority = { case lm: LogMessage => - logger.info(s"got log message $lm") + logger.debug(s"got log message $lm") // update client sendListenersMessage(lm) // store a copy in fixed list so we have something to send new clients msgs.append(lm) case mll: MaxLogLinesPerLog => - logger.info(s"received maxLogLinesPerLog: $mll") + logger.debug(s"received maxLogLinesPerLog: $mll") maxLogLinesPerLog = mll.myVal sendListenersMessage(maxLogLinesPerLog) case bl: BufferLength => - logger.info(s"received bufferLength: $bl") + logger.debug(s"received bufferLength: $bl") bufferLength = bl.myVal // rebuild msgs list with new buffer length msgs = new FixedList[LogMessage](bufferLength) case something => - logger.info(s"in LogStationWebServer: got something, not sure what it is: $something") + logger.warn(s"in LogStationWebServer: got something, not sure what it is: $something") // case ServiceShutdown => // log.info("Received ServiceShutdown. Shutting down...") diff --git a/test/logGenerator.scala b/test/logGenerator.scala index d575861..b194057 100644 --- a/test/logGenerator.scala +++ b/test/logGenerator.scala @@ -77,7 +77,7 @@ object LoremIpsum { val A = Array("ERROR", "WARN", "INFO", "DEBUG", "TRACE") Random.shuffle(A.toList).head -val file = new File("logfile2.log") +val file = new File("logfile3.log") val bw = new BufferedWriter(new FileWriter(file)) var i = 0 do {