YARN-2569. Added the log handling APIs for the long running services. Contributed by Xuan Gong.

(cherry picked from commit 5338ac416ab8ab3e7e0a7bfb4a53151fc457f673)