0

i am using below Rscript as a mapper on hadoop streaming. i want to see log info\warn etc on console of tasktracker or any other place of log that oozie does however its not coming any reason . My oozie job is successfully completed

Script

#! /usr/bin/env Rscript

library(methods)
library(utils)
library(devtools)
library(corpcor)
library(getopt)
library(logging)
library(HadoopStreaming)

main <- function() {
   paste("A", 1:50, sep = "")
   input <- file("stdin", open = "r")
   loginfo("CUSTOM ERROR")

   targets <- read.table(file="meta_reference1.csv", sep=";")
   print("############################################")
   print(target)
   close(input)

}

Updated Rscript for testing purpose

#! /usr/bin/env Rscript

library(methods)
library(utils)
library(devtools)
library(corpcor)
library(getopt)
library(logging)
library(HadoopStreaming)

main <- function() {
  write("prints to stderr", stderr())
  write("prints to stdout", stdout())   
}

No log appeared .. please suggest

Karn_way
  • 1,005
  • 3
  • 19
  • 42
  • Oops it was my mistake ... i had not given call to main function so it was not working . i just given call main() and it worked – Karn_way Jan 09 '14 at 11:24

1 Answers1

0

Try using write instead of print, worked for me.

write("prints to stderr", stderr())

write("prints to stdout", stdout())
Aziz Shaikh
  • 16,245
  • 11
  • 62
  • 79
Bedasa
  • 31
  • 1
  • i am getting as below . This is not working for me stdout logs stderr logs /bin/sh: module: line 1: syntax error: unexpected end of file /bin/sh: error importing function definition for `module' is it because above error its not working .. ? any guess – Karn_way Jan 09 '14 at 09:09
  • please post your whole script, in case it is possible – Bedasa Jan 09 '14 at 09:14
  • Now just to check the write on cluster i am using below script #! /usr/bin/env Rscript library(methods) library(utils) library(devtools) library(corpcor) library(getopt) library(logging) library(HadoopStreaming) main <- function() { write("Testing print statements for R script #########################", stdout()); } – Karn_way Jan 09 '14 at 09:27
  • sorry it looks formating is disturbed in the pasted script above – Karn_way Jan 09 '14 at 09:29
  • Oops it was my mistake ... i had not given call to main function so it was not working . i just given call main() and it worked – Karn_way Jan 09 '14 at 11:25