pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jcove...@apache.org
Subject svn commit: r1388692 - in /pig/trunk: CHANGES.txt src/org/apache/pig/impl/PigContext.java test/org/apache/pig/test/TestGrunt.java
Date Fri, 21 Sep 2012 21:35:17 GMT
Author: jcoveney
Date: Fri Sep 21 21:35:16 2012
New Revision: 1388692

URL: http://svn.apache.org/viewvc?rev=1388692&view=rev
Log:
PIG-2833: org.apache.pig.pigunit.pig.PigServer does not initialize set default log level of
pigContext (cheolsoo via jcoveney)

Modified:
    pig/trunk/CHANGES.txt
    pig/trunk/src/org/apache/pig/impl/PigContext.java
    pig/trunk/test/org/apache/pig/test/TestGrunt.java

Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1388692&r1=1388691&r2=1388692&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Fri Sep 21 21:35:16 2012
@@ -281,6 +281,8 @@ OPTIMIZATIONS
 
 BUG FIXES
 
+PIG-2833: org.apache.pig.pigunit.pig.PigServer does not initialize set default log level
of pigContext (cheolsoo via jcoveney)
+
 PIG-2744: Handle Pig command line with XML special characters (lulynn_2008 via daijy)
 
 PIG-2637: Command-line option -e throws TokenMgrError exception (lulynn_2008 via daijy)

Modified: pig/trunk/src/org/apache/pig/impl/PigContext.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/impl/PigContext.java?rev=1388692&r1=1388691&r2=1388692&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/impl/PigContext.java (original)
+++ pig/trunk/src/org/apache/pig/impl/PigContext.java Fri Sep 21 21:35:16 2012
@@ -117,7 +117,7 @@ public class PigContext implements Seria
 
     private Properties log4jProperties = new Properties();
 
-    private Level defaultLogLevel;
+    private Level defaultLogLevel = Level.INFO;
 
     public int defaultParallel = -1;
 

Modified: pig/trunk/test/org/apache/pig/test/TestGrunt.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestGrunt.java?rev=1388692&r1=1388691&r2=1388692&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestGrunt.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestGrunt.java Fri Sep 21 21:35:16 2012
@@ -41,6 +41,7 @@ import junit.framework.Assert;
 
 import org.apache.log4j.Appender;
 import org.apache.log4j.FileAppender;
+import org.apache.log4j.Level;
 import org.apache.log4j.PatternLayout;
 import org.apache.pig.ExecType;
 import org.apache.pig.PigException;
@@ -1371,4 +1372,26 @@ public class TestGrunt {
             Util.checkMessageInException(e, errMsg);
         }
     }
+
+    @Test
+    public void testDebugOn() throws Throwable {
+
+        String strCmd = "set debug on\n";
+        PigContext pc = new PigServer(ExecType.LOCAL).getPigContext();
+        InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(strCmd.getBytes()));
+        new Grunt(new BufferedReader(reader), pc).exec();
+
+        assertEquals(Level.DEBUG.toString(),  pc.getLog4jProperties().getProperty("log4j.logger.org.apache.pig"));
+    }
+
+    @Test
+    public void testDebugOff() throws Throwable {
+
+        String strCmd = "set debug off\n";
+        PigContext pc = new PigServer(ExecType.LOCAL).getPigContext();
+        InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(strCmd.getBytes()));
+        new Grunt(new BufferedReader(reader), pc).exec();
+
+        assertEquals(Level.INFO.toString(),  pc.getLog4jProperties().getProperty("log4j.logger.org.apache.pig"));
+    }
 }



Mime
View raw message