I usually have a class called BaseTest that every test class extends and I
configure me logging there.


public class BaseTest {

    @BeforeClass
    public static void init(){
        BasicConfigurator.configure();
        org.apache.log4j.Logger.getRootLogger().setLevel(Level.ERROR);
    }
}

On Thu, Feb 19, 2015 at 8:08 PM, anil gupta <anilgupt...@gmail.com> wrote:

> Hi Sean,
>
> That was super helpful. Thanks for quick turnaround.
>
> ~Anil
>
> On Thu, Feb 19, 2015 at 11:52 AM, Sean Busbey <bus...@cloudera.com> wrote:
>
> > Hi Anil!
> >
> > You can control what gets logged by selectively changing log levels in
> your
> > log4j.properties file for tests. For some suggestions, check out the one
> > used in hbase-server/src/test/resources/log4j.properties [1]:
> >
> >
> > 57
> > <
> >
> https://git1-us-west.apache.org/repos/asf?p=hbase.git;a=blob;f=hbase-server/src/test/resources/log4j.properties;h=6ee91efc3b255f56a49912590025711d16f49285;hb=b18bc4b06f3eb90f592c906e78fb6461548ae627#l57
> > >
> > log4j.logger.org.apache.hadoop=WARN
> > 58
> > <
> >
> https://git1-us-west.apache.org/repos/asf?p=hbase.git;a=blob;f=hbase-server/src/test/resources/log4j.properties;h=6ee91efc3b255f56a49912590025711d16f49285;hb=b18bc4b06f3eb90f592c906e78fb6461548ae627#l58
> > >
> > log4j.logger.org.apache.zookeeper=ERROR
> > 59
> > <
> >
> https://git1-us-west.apache.org/repos/asf?p=hbase.git;a=blob;f=hbase-server/src/test/resources/log4j.properties;h=6ee91efc3b255f56a49912590025711d16f49285;hb=b18bc4b06f3eb90f592c906e78fb6461548ae627#l59
> > >
> > log4j.logger.org.apache.hadoop.hbase=DEBUG
> >
> > If you change that last one to INFO or WARN you should get substantially
> > less logging.
> >
> >
> > [1]: *http://s.apache.org/bNs <http://s.apache.org/bNs>*
> >
> >
> > On Thu, Feb 19, 2015 at 1:33 PM, anil gupta <anilgupt...@gmail.com>
> wrote:
> >
> > > Hi All,
> > >
> > > I am using HBaseTestingUtility for JUnits of my HBase code. When
> > > HBaseTestingUtility runs, it prints thousands of lines of logs on
> > > console(along with some catched execptions). More than 99% of time
> these
> > > logs are irrelevant.
> > > Is there a way to suppress these logs in HBasetestingutility? Something
> > > like silent mode?
> > >
> > >
> > > --
> > > Thanks & Regards,
> > > Anil Gupta
> > >
> >
> >
> >
> > --
> > Sean
> >
>
>
>
> --
> Thanks & Regards,
> Anil Gupta
>

Reply via email to