You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Chen Bekor <ch...@gmail.com> on 2016/04/14 19:28:46 UTC
printing datastream to the log - instead of stdout
hi,
the .print() method will print a dataset / datastream to the stdout.
how can I print the stream to the standard logger (logback/log4j)?
I'm using flink scala - so scala example code is much appreciated.
p.s - I noticed that there's a PrintFunction that I can implement but it
feels like I'm reinventing the wheel for something that should be very
elementary.
thanks!!
Chen.
Re: printing datastream to the log - instead of stdout
Posted by Christian Kreutzfeldt <mn...@gmail.com>.
Hi Chen
I haven't tried the following code out but it should be as easy as:
stream.addSink(new SinkFunction<String>() {
private final Logger LOG = LogManager.getLogger("loggerName");
public void invoke(String value) throws Exception {
Log.info(value);
}
});
It's JAVA but I think it suffice to geht the basic idea. It assumes that
the stream
carries string entities.
Best
Christian
2016-04-14 19:28 GMT+02:00 Chen Bekor <ch...@gmail.com>:
> hi,
>
> the .print() method will print a dataset / datastream to the stdout.
>
> how can I print the stream to the standard logger (logback/log4j)?
>
> I'm using flink scala - so scala example code is much appreciated.
>
> p.s - I noticed that there's a PrintFunction that I can implement but it
> feels like I'm reinventing the wheel for something that should be very
> elementary.
>
> thanks!!
>
> Chen.
>