Skip to content
Snippets Groups Projects
Commit a2715ccd authored by fireflyc's avatar fireflyc Committed by Matei Zaharia
Browse files

replace println to log4j

Our program needs to receive a large amount of data and run for a long
time.
We set the log level to WARN but "Storing iterator" "received single"
as such message written to the log file. (over yarn)

Author: fireflyc <fireflyc@126.com>

Closes #1372 from fireflyc/fix-replace-stdout-log and squashes the following commits:

e684140 [fireflyc] 'info' modified into the 'debug'
fa22a38 [fireflyc] replace println to log4j
parent 184aa1c6
No related branches found
No related tags found
No related merge requests found
...@@ -68,13 +68,13 @@ object ActorSupervisorStrategy { ...@@ -68,13 +68,13 @@ object ActorSupervisorStrategy {
* should be same. * should be same.
*/ */
@DeveloperApi @DeveloperApi
trait ActorHelper { trait ActorHelper extends Logging{
self: Actor => // to ensure that this can be added to Actor classes only self: Actor => // to ensure that this can be added to Actor classes only
/** Store an iterator of received data as a data block into Spark's memory. */ /** Store an iterator of received data as a data block into Spark's memory. */
def store[T](iter: Iterator[T]) { def store[T](iter: Iterator[T]) {
println("Storing iterator") logDebug("Storing iterator")
context.parent ! IteratorData(iter) context.parent ! IteratorData(iter)
} }
...@@ -84,6 +84,7 @@ trait ActorHelper { ...@@ -84,6 +84,7 @@ trait ActorHelper {
* that Spark is configured to use. * that Spark is configured to use.
*/ */
def store(bytes: ByteBuffer) { def store(bytes: ByteBuffer) {
logDebug("Storing Bytes")
context.parent ! ByteBufferData(bytes) context.parent ! ByteBufferData(bytes)
} }
...@@ -93,7 +94,7 @@ trait ActorHelper { ...@@ -93,7 +94,7 @@ trait ActorHelper {
* being pushed into Spark's memory. * being pushed into Spark's memory.
*/ */
def store[T](item: T) { def store[T](item: T) {
println("Storing item") logDebug("Storing item")
context.parent ! SingleItemData(item) context.parent ! SingleItemData(item)
} }
} }
...@@ -157,15 +158,16 @@ private[streaming] class ActorReceiver[T: ClassTag]( ...@@ -157,15 +158,16 @@ private[streaming] class ActorReceiver[T: ClassTag](
def receive = { def receive = {
case IteratorData(iterator) => case IteratorData(iterator) =>
println("received iterator") logDebug("received iterator")
store(iterator.asInstanceOf[Iterator[T]]) store(iterator.asInstanceOf[Iterator[T]])
case SingleItemData(msg) => case SingleItemData(msg) =>
println("received single") logDebug("received single")
store(msg.asInstanceOf[T]) store(msg.asInstanceOf[T])
n.incrementAndGet n.incrementAndGet
case ByteBufferData(bytes) => case ByteBufferData(bytes) =>
logDebug("received bytes")
store(bytes) store(bytes)
case props: Props => case props: Props =>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment