Permalink
Browse files

switched to log4j logging to enable trace level

  • Loading branch information...
1 parent f318562 commit 2ba73669b49412faf959a99979e3152412fb997a @ykulbak committed Jun 2, 2010
View
@@ -127,6 +127,21 @@
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.15</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.sun.jdmk</groupId>
+ <artifactId>jmxtools</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.jmx</groupId>
+ <artifactId>jmxri</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<!-- Test dependencies -->
<dependency>
@@ -19,8 +19,7 @@
*/
package org.apache.hadoop.hbase;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.log4j.Logger;
import javax.management.InstanceAlreadyExistsException;
import javax.management.InstanceNotFoundException;
@@ -34,7 +33,7 @@
* Utilities for JMX.
*/
public final class JmxHelper {
- static final Log LOG = LogFactory.getLog(JmxHelper.class);
+ static final Logger LOG = Logger.getLogger(JmxHelper.class);
private JmxHelper() {
@@ -19,8 +19,6 @@
*/
package org.apache.hadoop.hbase.regionserver;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.client.idx.exp.And;
import org.apache.hadoop.hbase.client.idx.exp.Comparison;
import org.apache.hadoop.hbase.client.idx.exp.Expression;
@@ -29,12 +27,14 @@
import org.apache.hadoop.hbase.regionserver.idx.support.sets.IntSet;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.ClassSize;
+import org.apache.log4j.Logger;
+
/**
* Evaluates an {@link Expression}.
*/
public class IdxExpressionEvaluator implements HeapSize {
- private static final Log LOG = LogFactory.getLog(IdxExpressionEvaluator.class);
+ private static final Logger LOG = Logger.getLogger(IdxExpressionEvaluator.class);
/**
* Evaluates the expression using the provided search context.
@@ -19,8 +19,6 @@
*/
package org.apache.hadoop.hbase.regionserver;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.DoNotRetryIOException;
@@ -37,6 +35,7 @@
import org.apache.hadoop.hbase.util.Pair;
import org.apache.hadoop.metrics.util.MBeanUtil;
import org.apache.hadoop.util.Progressable;
+import org.apache.log4j.Logger;
import java.io.IOException;
import java.util.ArrayList;
@@ -51,7 +50,7 @@
* filter expression.
*/
public class IdxRegion extends HRegion {
- static final Log LOG = LogFactory.getLog(IdxRegion.class);
+ static final Logger LOG = Logger.getLogger(IdxRegion.class);
private static final int INDEX_BUILD_TIME_HISTORY_SIZE = 10;
@@ -20,8 +20,6 @@
package org.apache.hadoop.hbase.regionserver;
import org.apache.commons.lang.time.StopWatch;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.NotServingRegionException;
@@ -34,6 +32,7 @@
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.ClassSize;
import org.apache.hadoop.hbase.util.Pair;
+import org.apache.log4j.Logger;
import java.io.IOException;
import java.util.ArrayList;
@@ -49,7 +48,7 @@
* Manages the indexes for a single region.
*/
public class IdxRegionIndexManager implements HeapSize {
- private static final Log LOG = LogFactory.getLog(IdxRegionIndexManager.class);
+ private static final Logger LOG = Logger.getLogger(IdxRegionIndexManager.class);
static final long FIXED_SIZE =
ClassSize.align(ClassSize.OBJECT + 3 * ClassSize.REFERENCE +
@@ -19,8 +19,6 @@
*/
package org.apache.hadoop.hbase.regionserver;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.client.idx.IdxColumnDescriptor;
@@ -49,7 +47,6 @@
*/
public class IdxRegionMBeanImpl extends StandardMBean
implements IdxRegionMBean {
- static final Log LOG = LogFactory.getLog(IdxRegionMBeanImpl.class);
private static final HashMap<String, String> ATTRIBUTE_DESCRIPTIONS =
new HashMap<String, String>() {{
@@ -20,8 +20,6 @@
package org.apache.hadoop.hbase.regionserver;
import junit.framework.Assert;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.DoNotRetryIOException;
@@ -50,6 +48,7 @@
import org.apache.hadoop.hbase.filter.ValueFilter;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.Pair;
+import org.apache.log4j.Logger;
import javax.management.Attribute;
import javax.management.MBeanAttributeInfo;
@@ -69,7 +68,7 @@
* Tests the indexed region implemention.
*/
public class TestIdxRegion extends HBaseTestCase {
- static final Log LOG = LogFactory.getLog(TestIdxRegion.class);
+ static final Logger LOG = Logger.getLogger(TestIdxRegion.class);
IdxRegion region = null;
@@ -19,15 +19,15 @@
*/
package org.apache.hadoop.hbase.regionserver.idx.support.sets;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.util.ClassSize;
+import org.apache.log4j.Logger;
+
/**
* Tests the {@link SparseBitSet} implementation.
*/
public class TestSparseBitSet extends IntSetBaseTestCase {
- private static final Log LOG = LogFactory.getLog(TestSparseBitSet.class);
+ private static final Logger LOG = Logger.getLogger(TestSparseBitSet.class);
@Override
protected IntSetBase newSet(int max, int... sortedElements) {
@@ -53,7 +53,7 @@ public void testHeapSize() {
assertEquals(oneBitHeapSize, bitSet.heapSize());
bitSet.addNext(1000);
- assertEquals(SparseBitSet.FIXED_SIZE+ 2*(oneBitHeapSize - SparseBitSet.FIXED_SIZE), bitSet.heapSize());
+ assertEquals(SparseBitSet.FIXED_SIZE + 2 * (oneBitHeapSize - SparseBitSet.FIXED_SIZE), bitSet.heapSize());
LOG.info("Sparse BitSet with two entries heap size: " + bitSet.heapSize());
}
@@ -0,0 +1,24 @@
+# Define some default values that can be overridden by system properties
+hbase.root.logger=INFO,console
+
+# Define the root logger to the system property "hbase.root.logger".
+log4j.rootLogger=${hbase.root.logger}
+
+# Logging Threshold
+log4j.threshhold=ALL
+#
+# console
+# Add "console" to rootlogger above if you want to use this
+#
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.target=System.err
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%d %-5p [%t] %C{2}(%L): %m%n
+
+# Custom Logging levels
+
+#log4j.logger.org.apache.hadoop.fs.FSNamesystem=DEBUG
+
+log4j.logger.org.apache.hadoop=WARN
+log4j.logger.org.apache.zookeeper=ERROR
+log4j.logger.org.apache.hadoop.hbase=INFO

0 comments on commit 2ba7366

Please sign in to comment.