YARN-2468. Enhanced NodeManager to support log handling APIs (YARN-2569) for use by long running services. Contributed by Xuan Gong.

(cherry picked from commit 34cdcaad71cad76c0874a4e5266b4074009d2ffc)