Thanks Daniel. I did not see an exception either. Is log generation with PigServer something that we could add in Pig 0.9.1? Debugging would be a lot easier while converting existing if scripts to java and otherwise.
Sent from my iPhone On Dec 5, 2011, at 6:43 PM, Daniel Dai <[email protected]> wrote: > There is no log if you embed PigServer in code, however, you will see > exception. > > Daniel > > On Mon, Dec 5, 2011 at 2:58 PM, Prashant Kommireddi > <[email protected]>wrote: > >> FYI, I am aware the error is that I am using registerQuery and not >> registerJar. Would just like to know where the error logs can be found. >> >> Thanks, >> Prashant Kommireddi >> >> On Mon, Dec 5, 2011 at 2:21 PM, Prashant Kommireddi <[email protected] >>> wrote: >> >>> I am embedding Pig Latin in Java, and want to check the error logs. Where >>> can I find them? >>> The program below runs fine if I don't use the line >> *pigServer.registerQuery("REGISTER >>> '" +lib+ "';"); >>> >>> But fails when I use this line and I can't find the logs in the directory >>> I ran this from. >>> >>> * >>> import java.io.IOException; >>> >>> import org.apache.hadoop.conf.Configuration; >>> import org.apache.hadoop.fs.FileSystem; >>> import org.apache.hadoop.fs.Path; >>> import org.apache.pig.PigServer; >>> >>> public class idmapreduce { >>> public static void main(String[] args) { >>> try { >>> PigServer pigServer = new PigServer("mapreduce"); >>> runIdQuery(pigServer, "passwd", >>> >> "/home/pkommireddi/dev/apps/gridforce/main/pigassist/dist/pigassist.jar"); >>> } catch (Exception e) {} >>> } >>> >>> public static void runIdQuery(PigServer pigServer, String inputFile, >>> String lib) throws IOException { >>> Configuration conf = new Configuration(); >>> FileSystem fs = FileSystem.get(conf); >>> >>> Path output = new Path("idout"); >>> fs.delete(output, true); >>> >>> *pigServer.registerQuery("REGISTER '" +lib+ "';");* >>> pigServer.registerQuery("A = load '" + inputFile + "' using >>> PigStorage(':');"); >>> pigServer.registerQuery("B = foreach A generate $0 as id;"); >>> pigServer.store("B", "idout"); >>> >>> } >>> } >>> >>> >>> Thanks, >>> Prashant Kommireddi >>> >>
