Return-Path: X-Original-To: apmail-pig-commits-archive@www.apache.org Delivered-To: apmail-pig-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8F137D4A2 for ; Fri, 21 Sep 2012 21:36:04 +0000 (UTC) Received: (qmail 1775 invoked by uid 500); 21 Sep 2012 21:36:04 -0000 Delivered-To: apmail-pig-commits-archive@pig.apache.org Received: (qmail 1745 invoked by uid 500); 21 Sep 2012 21:36:04 -0000 Mailing-List: contact commits-help@pig.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pig.apache.org Delivered-To: mailing list commits@pig.apache.org Received: (qmail 1733 invoked by uid 99); 21 Sep 2012 21:36:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Sep 2012 21:36:04 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Sep 2012 21:36:01 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 6BBEE238890D for ; Fri, 21 Sep 2012 21:35:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@pig.apache.org From: jcoveney@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120921213517.6BBEE238890D@eris.apache.org> 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")); + } }