Skip to content

Commit b3c61a6

Browse files
committed
fix gearpump#510, add log directory for UI server.
1 parent 3ac1dd9 commit b3c61a6

File tree

6 files changed

+26
-3
lines changed

6 files changed

+26
-3
lines changed

conf/log4j.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ gearpump.worker.log.file=gearpump-worker-${HOSTNAME}.log
3232
# Log file name for local daemon process
3333
gearpump.local.log.file=gearpump-local-${HOSTNAME}.log
3434

35+
# Log file name for UI daemon process
36+
gearpump.ui.log.file=gearpump-ui-${HOSTNAME}.log
37+
3538
# The username of an application submitter, will be overwritten by GearPump at runtime.
3639
gearpump.username=user
3740
# The application logger setting

core/src/main/scala/org/apache/gearpump/util/LogUtil.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import scala.util.Try
1313
object LogUtil {
1414
object ProcessType extends Enumeration {
1515
type ProcessType = Value
16-
val MASTER, WORKER, LOCAL, APPLICATION = Value
16+
val MASTER, WORKER, LOCAL, APPLICATION, UI = Value
1717
}
1818

1919
def getLogger[T](clazz : Class[T], context : String = null, master : Any = null, worker : Any = null, executor : Any = null, task : Any = null, app : Any = null) : Logger = {

services/dashboard/scripts/app-02.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ angular.module('app-02', ['adf', 'app.widgets.visdag'])
3939
type: "visdag",
4040
config: {
4141
},
42-
title: "DAG"
42+
title: "DAG(Click AppId on the left to show the DAG)"
4343
}
4444
]
4545
}]

services/src/main/scala/org/apache/gearpump/cluster/main/Services.scala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,22 @@
1919
package org.apache.gearpump.cluster.main
2020

2121
import akka.actor.{ActorSystem, Props}
22+
import org.apache.gearpump.cluster.main.Local._
2223
import org.apache.gearpump.cluster.master.MasterProxy
2324
import org.apache.gearpump.cluster.{ClusterConfig, UserConfig}
2425
import org.apache.gearpump.services.{RestServices,WebSocketServices}
2526
import org.apache.gearpump.util.Constants._
26-
import org.apache.gearpump.util.Util
27+
import org.apache.gearpump.util.LogUtil.ProcessType
28+
import org.apache.gearpump.util.{LogUtil, Util}
29+
import org.slf4j.Logger
2730

2831
object Services extends App with ArgumentsParser {
32+
val systemConfig = ClusterConfig.load.master.withFallback(ClusterConfig.load.worker)
33+
34+
private val LOG: Logger = {
35+
LogUtil.loadConfiguration(systemConfig, ProcessType.UI)
36+
LogUtil.getLogger(getClass)
37+
}
2938

3039
override val options: Array[(String, CLIOption[Any])] = Array(
3140
"master" -> CLIOption[String]("<host1:port1,host2:port2,host3:port3>", required = true))

services/src/main/scala/org/apache/gearpump/services/RestServices.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package org.apache.gearpump.services
2020

2121
import akka.actor.{Actor, ActorRef, ActorSystem, Props}
2222
import akka.io.IO
23+
import org.apache.gearpump.services.WebSocketServices._
2324
import org.apache.gearpump.util.LogUtil
2425
import spray.can._
2526
import spray.routing.RoutingSettings
@@ -41,12 +42,17 @@ class RestServicesActor(masters: ActorRef, sys:ActorSystem) extends Actor with R
4142
}
4243

4344
object RestServices {
45+
private val LOG = LogUtil.getLogger(getClass)
46+
4447
def start(master:ActorRef)(implicit system:ActorSystem) {
4548
implicit val executionContext = system.dispatcher
4649
val services = system.actorOf(Props(classOf[RestServicesActor], master, system), "rest-services")
4750
val config = system.settings.config
4851
val port = config.getInt("gearpump.services.http")
4952
val host = config.getString("gearpump.services.host")
5053
IO(Http) ! Http.Bind(services, interface = host, port = port)
54+
55+
LOG.info(s"Please browser http://$host:$port to see the web UI")
56+
println(s"Please browser http://$host:$port to see the web UI")
5157
}
5258
}

services/src/main/scala/org/apache/gearpump/services/WebSocketServices.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ package org.apache.gearpump.services
2121
import akka.actor._
2222
import akka.io.IO
2323
import org.apache.gearpump.cluster.ClusterConfig
24+
import org.apache.gearpump.cluster.main.Local._
25+
import org.apache.gearpump.util.LogUtil
26+
import org.apache.gearpump.util.LogUtil.ProcessType
27+
import org.slf4j.Logger
2428
import spray.can.Http
2529
import spray.can.server.UHttp
2630

@@ -35,6 +39,7 @@ class WebSocketServices(masters: ActorRef) extends Actor with ActorLogging {
3539
}
3640

3741
object WebSocketServices {
42+
3843
def start(master:ActorRef) {
3944
implicit val system = ActorSystem("ws-services" , ClusterConfig.load.application)
4045
implicit val executionContext = system.dispatcher

0 commit comments

Comments
 (0)