You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ch...@apache.org on 2016/08/15 07:09:35 UTC

[50/52] [partial] incubator-carbondata git commit: Renamed packages to org.apache.carbondata and fixed errors

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/main/java/org/apache/carbondata/common/logging/impl/AuditLevel.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/carbondata/common/logging/impl/AuditLevel.java b/common/src/main/java/org/apache/carbondata/common/logging/impl/AuditLevel.java
new file mode 100644
index 0000000..cd0d7f5
--- /dev/null
+++ b/common/src/main/java/org/apache/carbondata/common/logging/impl/AuditLevel.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.common.logging.impl;
+
+import org.apache.log4j.Level;
+
+public class AuditLevel extends Level {
+
+  public static final AuditLevel AUDIT = new AuditLevel(55000, "AUDIT", 0);
+  private static final long serialVersionUID = -209614723183147373L;
+
+  /**
+   * Constructor
+   *
+   * @param level            log level
+   * @param levelStr         log level string
+   * @param syslogEquivalent syslogEquivalent
+   */
+  protected AuditLevel(int level, String levelStr, int syslogEquivalent) {
+    super(level, levelStr, syslogEquivalent);
+  }
+
+  /**
+   * Returns custom level for debug type log message
+   *
+   * @param val          value
+   * @param defaultLevel level
+   * @return custom level
+   */
+  public static AuditLevel toLevel(int val, Level defaultLevel) {
+    return AUDIT;
+  }
+
+  /**
+   * Returns custom level for debug type log message
+   *
+   * @param sArg         sArg
+   * @param defaultLevel level
+   * @return custom level
+   */
+  public static AuditLevel toLevel(String sArg, Level defaultLevel) {
+    return AUDIT;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/main/java/org/apache/carbondata/common/logging/impl/ExtendedRollingFileAppender.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/carbondata/common/logging/impl/ExtendedRollingFileAppender.java b/common/src/main/java/org/apache/carbondata/common/logging/impl/ExtendedRollingFileAppender.java
new file mode 100644
index 0000000..85f5ff9
--- /dev/null
+++ b/common/src/main/java/org/apache/carbondata/common/logging/impl/ExtendedRollingFileAppender.java
@@ -0,0 +1,239 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.common.logging.impl;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.RollingFileAppender;
+import org.apache.log4j.helpers.CountingQuietWriter;
+import org.apache.log4j.helpers.LogLog;
+import org.apache.log4j.spi.LoggingEvent;
+
+/**
+ * Copied from log4j to remove the hard coding for the file name from it Copied
+ * form log4j and modified for renaming files
+ */
+public class ExtendedRollingFileAppender extends RollingFileAppender {
+
+  private static final String DATE_FORMAT_FOR_TRANSFER = "yyyy-MM-dd'_'HH-mm-ss";
+  protected int currentLevel = Level.FATAL_INT;
+  /**
+   * Added for DTS DTS2011122001074 Now in log file rolling(after file size
+   * exceeded the threshold) and deletion (after file count exceeded the file
+   * count threshold) it will print log message
+   */
+
+  private long nextRollover = 0;
+  private boolean cleanupInProgress = false;
+
+  /**
+   * Total number of files at any point of time should be Backup number of
+   * files + current file
+   */
+  private static void cleanLogs(final String startName, final String folderPath,
+      int maxBackupIndex) {
+    final String fileStartName = startName.toLowerCase(Locale.US);
+    // Delete the oldest file, to keep Windows happy.
+    File file = new File(folderPath);
+
+    if (file.exists()) {
+      File[] files = file.listFiles(new FileFilter() {
+
+        public boolean accept(File file) {
+          if (!file.isDirectory() && file.getName().toLowerCase(Locale.US)
+              .startsWith(fileStartName)) {
+            return true;
+          }
+          return false;
+        }
+      });
+
+      int backupFiles = files.length - 1;
+
+      if (backupFiles <= maxBackupIndex) {
+        return;
+      }
+
+      // Sort the file based on its name.
+      TreeMap<String, File> sortedMap = new TreeMap<String, File>();
+      for (File file1 : files) {
+        sortedMap.put(file1.getName(), file1);
+      }
+
+      // Remove the first log file from map. it will be <startName>.log
+      // itself which will be backed up in rollover
+      sortedMap.remove(sortedMap.firstKey());
+
+      Iterator<Entry<String, File>> it = sortedMap.entrySet().iterator();
+      Entry<String, File> temp = null;
+
+      // After clean up the files should be maxBackupIndex -1 number of
+      // files. Because one more backup file
+      // will be created after this method call is over
+      while (it.hasNext() && backupFiles > maxBackupIndex) {
+        temp = it.next();
+        File deleteFile = temp.getValue();
+        // Delete the file
+        // Fixed defect DTS2011122001074 after deletion of log file it
+        // will print the log message in ReportService.log
+        if (deleteFile.delete()) {
+          backupFiles--;
+        } else {
+          LogLog.error("Couldn't delete file :: " + deleteFile.getPath());
+        }
+      }
+    }
+  }
+
+  /**
+   * Copied from log4j to remove hardcoding of file name
+   */
+  public void rollOver() {
+    File target;
+    File file = new File(fileName);
+
+    String fileStartName = file.getName();
+    int dotIndex = fileStartName.indexOf('.');
+
+    if (dotIndex != -1) {
+      fileStartName = fileStartName.substring(0, dotIndex);
+    }
+    final String startName = fileStartName;
+    final String folderPath = file.getParent();
+
+    if (qw != null) {
+      long size = ((CountingQuietWriter) qw).getCount();
+      LogLog.debug("rolling over count=" + size);
+      // if operation fails, do not roll again until
+      // maxFileSize more bytes are written
+      nextRollover = size + maxFileSize;
+    }
+
+    LogLog.debug("maxBackupIndex=" + maxBackupIndex);
+
+    boolean renameSucceeded = true;
+
+    // If maxBackups <= 0, then there is no file renaming to be done.
+    if (maxBackupIndex > 0) {
+      DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_FOR_TRANSFER);
+
+      StringBuffer buffer = new StringBuffer();
+      String extension = "";
+      if (fileName.contains(".")) {
+        extension = fileName.substring(fileName.lastIndexOf("."));
+        buffer.append(fileName.substring(0, fileName.lastIndexOf(".")));
+      } else {
+        buffer.append(fileName);
+      }
+      buffer.append("_").append(dateFormat.format(new Date())).append(extension);
+      // Rename fileName to fileName.1
+      target = new File(buffer.toString());
+
+      this.closeFile(); // keep windows happy.
+
+      LogLog.debug("Renaming file " + file + " to " + target);
+      renameSucceeded = file.renameTo(target);
+
+      //
+      // if file rename failed, reopen file with append = true
+      //
+      if (!renameSucceeded) {
+        try {
+          this.setFile(fileName, true, bufferedIO, bufferSize);
+        } catch (InterruptedIOException e) {
+          Thread.currentThread().interrupt();
+        } catch (IOException e) {
+          LogLog.error("setFile(" + fileName + ", true) call failed.", e);
+        }
+      }
+    }
+
+    //
+    // if all renames were successful, then
+    //
+    if (renameSucceeded) {
+      try {
+        // This will also close the file. This is OK since multiple
+        // close operations are safe.
+        this.setFile(fileName, false, bufferedIO, bufferSize);
+        nextRollover = 0;
+      } catch (InterruptedIOException e) {
+        Thread.currentThread().interrupt();
+      } catch (IOException e) {
+        LogLog.error("setFile(" + fileName + ", false) call failed.", e);
+      }
+    }
+
+    // Do clean up finally
+    cleanUpLogs(startName, folderPath);
+  }
+
+  private void cleanUpLogs(final String startName, final String folderPath) {
+    if (maxBackupIndex > 0) {
+      // Clean the logs files
+      Runnable r = new Runnable() {
+
+        public void run() {
+          if (cleanupInProgress) {
+            return;
+          }
+          synchronized (ExtendedRollingFileAppender.class) {
+            cleanupInProgress = true;
+            try {
+              cleanLogs(startName, folderPath, maxBackupIndex);
+            } catch (Throwable e) {
+              // ignore any error
+              LogLog.error("Cleaning logs failed", e);
+            } finally {
+              cleanupInProgress = false;
+            }
+          }
+        }
+      };
+
+      Thread t = new Thread(r);
+      t.start();
+    }
+  }
+
+  protected void subAppend(LoggingEvent event) {
+    if (event.getLevel().toInt() <= currentLevel) {
+      super.subAppend(event);
+      if (fileName != null && qw != null) {
+        long size = ((CountingQuietWriter) qw).getCount();
+        if (size >= maxFileSize && size >= nextRollover) {
+          rollOver();
+        }
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/main/java/org/apache/carbondata/common/logging/impl/FileUtil.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/carbondata/common/logging/impl/FileUtil.java b/common/src/main/java/org/apache/carbondata/common/logging/impl/FileUtil.java
new file mode 100644
index 0000000..f5fb50e
--- /dev/null
+++ b/common/src/main/java/org/apache/carbondata/common/logging/impl/FileUtil.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.common.logging.impl;
+
+import java.io.Closeable;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Provides file Utility
+ */
+public final class FileUtil {
+
+  public static final String CARBON_PROPERTIES_FILE_PATH = "../../../conf/carbon.properties";
+  private static final Logger LOG = Logger.getLogger(FileUtil.class.getName());
+  private static Properties carbonProperties;
+
+  private FileUtil() {
+
+  }
+
+  public static Properties getCarbonProperties() {
+    if (null == carbonProperties) {
+      loadProperties();
+    }
+
+    return carbonProperties;
+  }
+
+  /**
+   * closes the stream
+   *
+   * @param stream stream to be closed.
+   */
+  public static void close(Closeable stream) {
+    if (null != stream) {
+      try {
+        stream.close();
+      } catch (IOException e) {
+        LOG.error("Exception while closing the Log stream");
+      }
+    }
+  }
+
+  private static void loadProperties() {
+    String property = System.getProperty("carbon.properties.filepath");
+    if (null == property) {
+      property = CARBON_PROPERTIES_FILE_PATH;
+    }
+    File file = new File(property);
+
+    FileInputStream fis = null;
+    try {
+      if (file.exists()) {
+        fis = new FileInputStream(file);
+
+        carbonProperties = new Properties();
+        carbonProperties.load(fis);
+      }
+    } catch (FileNotFoundException e) {
+      LOG.error("Could not find carbon properties file in the path " + property);
+    } catch (IOException e) {
+      LOG.error("Error while reading carbon properties file in the path " + property);
+    } finally {
+      if (null != fis) {
+        try {
+          fis.close();
+        } catch (IOException e) {
+          LOG.error("Error while closing the file stream for carbon.properties");
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/main/java/org/apache/carbondata/common/logging/impl/StandardLogService.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/carbondata/common/logging/impl/StandardLogService.java b/common/src/main/java/org/apache/carbondata/common/logging/impl/StandardLogService.java
new file mode 100644
index 0000000..1ad71db
--- /dev/null
+++ b/common/src/main/java/org/apache/carbondata/common/logging/impl/StandardLogService.java
@@ -0,0 +1,317 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.common.logging.impl;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Properties;
+
+import org.apache.carbondata.common.logging.LogService;
+
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.log4j.Logger;
+import org.apache.log4j.MDC;
+
+/**
+ * Default Implementation of the <code>LogService</code>
+ */
+public final class StandardLogService implements LogService {
+
+  private static final String PARTITION_ID = "[partitionID:";
+  private static final String CARBON_AUDIT_LOG_PATH = "carbon.auditlog.file.path";
+  private static final String AUDIT_LOG_DEFAULT_PATH = "logs/CarbonAudit.log";
+  private static final String CARBON_AUDIT_LOG_ROLLING_UP_SIZE = "carbon.auditlog.max.file.size";
+  private static final String AUDIT_LOG_DEFAULT_ROLLING_UP_SIZE = "10MB";
+  private static final String CARBON_AUDIT_LOG_MAX_BACKUP = "carbon.auditlog.max.backup.files";
+  private static final String AUDIT_LOG_DEFAULT_MAX_BACKUP = "10";
+  private static final String CARBON_AUDIT_LOG_LEVEL = "carbon.logging.level";
+  private static final String AUDIT_LOG_DEFAULT_LEVEL = "INFO";
+  private static boolean doLog = true;
+  private Logger logger;
+
+  /**
+   * Constructor.
+   *
+   * @param clazzName for which the Logging is required
+   */
+  public StandardLogService(String clazzName) {
+    String auditLogPath = AUDIT_LOG_DEFAULT_PATH;
+    String rollupSize = AUDIT_LOG_DEFAULT_ROLLING_UP_SIZE;
+    String maxBackup = AUDIT_LOG_DEFAULT_MAX_BACKUP;
+    String logLevel = AUDIT_LOG_DEFAULT_LEVEL;
+
+    Properties props = new Properties();
+    Properties carbonProps = FileUtil.getCarbonProperties();
+
+    if (null != carbonProps) {
+      if (null != carbonProps.getProperty(CARBON_AUDIT_LOG_PATH)) {
+        auditLogPath = carbonProps.getProperty(CARBON_AUDIT_LOG_PATH);
+      }
+
+      if (null != carbonProps.getProperty(CARBON_AUDIT_LOG_ROLLING_UP_SIZE)) {
+        rollupSize = carbonProps.getProperty(CARBON_AUDIT_LOG_ROLLING_UP_SIZE);
+      }
+
+      if (null != carbonProps.getProperty(CARBON_AUDIT_LOG_MAX_BACKUP)) {
+        maxBackup = carbonProps.getProperty(CARBON_AUDIT_LOG_MAX_BACKUP);
+      }
+
+      if (null != carbonProps.getProperty(CARBON_AUDIT_LOG_LEVEL)) {
+        logLevel = carbonProps.getProperty(CARBON_AUDIT_LOG_LEVEL);
+      }
+    }
+
+    props.setProperty("log4j.rootLogger", logLevel + ",stdout,AUDL");
+
+    props.setProperty("log4j.appender.stdout", "org.apache.log4j.ConsoleAppender");
+    props.setProperty("log4j.appender.stdout.layout.ConversionPattern", "%d %-5p [%c] %m%n");
+    props.setProperty("log4j.appender.stdout.layout", "org.apache.log4j.PatternLayout");
+    props.setProperty("log4j.appender.AUDL",
+        "AuditExtendedRollingFileAppender");
+
+    props.setProperty("log4j.appender.AUDL.File", auditLogPath);
+    props.setProperty("log4j.appender.AUDL.threshold",
+        "AUDIT#AuditLevel");
+    props.setProperty("log4j.appender.AUDL.layout.ConversionPattern",
+        "%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n");
+    props.setProperty("log4j.appender.AUDL.layout", "org.apache.log4j.PatternLayout");
+    props.setProperty("log4j.appender.AUDL.MaxFileSize", rollupSize);
+    props.setProperty("log4j.appender.AUDL.MaxBackupIndex", maxBackup);
+
+    props.setProperty("log4j.logger.com.huawei", logLevel + ",stdout");
+    props.setProperty("log4j.logger.com.huawei", logLevel + ",AUDL");
+
+    logger = Logger.getLogger(clazzName);
+
+  }
+
+  public StandardLogService() {
+    this("Carbon");
+  }
+
+  /**
+   * returns is DO Log
+   *
+   * @return the doLog
+   */
+  public static boolean isDoLog() {
+    return doLog;
+  }
+
+  /**
+   * set Do Log
+   *
+   * @param doLog the doLog to set
+   */
+  public static void setDoLog(boolean doLog) {
+    StandardLogService.doLog = doLog;
+  }
+
+  public static String getPartitionID(String tableName) {
+    return tableName.substring(tableName.lastIndexOf('_') + 1, tableName.length());
+  }
+
+  public static void setThreadName(String partitionID, String queryID) {
+    StringBuffer b = new StringBuffer(PARTITION_ID);
+    b.append(partitionID);
+    if (null != queryID) {
+      b.append(";queryID:");
+      b.append(queryID);
+    }
+    b.append("]");
+    Thread.currentThread().setName(getThreadName() + b.toString());
+  }
+
+  private static String getThreadName() {
+    String name = Thread.currentThread().getName();
+    int index = name.indexOf(PARTITION_ID);
+    if (index > -1) {
+      name = name.substring(0, index);
+    } else {
+      name = '[' + name + ']';
+    }
+    return name.trim();
+  }
+
+  public boolean isDebugEnabled() {
+    return logger.isDebugEnabled();
+  }
+
+  public boolean isWarnEnabled() {
+    return logger.isEnabledFor(org.apache.log4j.Level.WARN);
+  }
+
+  public void debug(String message) {
+    if (logger.isDebugEnabled()) {
+      logMessage(Level.DEBUG, null, message);
+    }
+  }
+
+  public void error(String message) {
+    logMessage(Level.ERROR, null, message);
+  }
+
+  public void error(Throwable throwable, String message) {
+    logMessage(Level.ERROR, throwable, message);
+  }
+
+  public void error(Throwable throwable) {
+    logMessage(Level.ERROR, throwable, "");
+  }
+
+  public void info(String message) {
+    if (logger.isInfoEnabled()) {
+      logMessage(Level.INFO, null, message);
+    }
+  }
+
+  /**
+   * Utility Method to log the the Message.
+   */
+  private void logMessage(Level logLevel, Throwable throwable, String message) {
+    if (StandardLogService.doLog) {
+      try {
+        //Append the partition id and query id if exist
+        StringBuffer buff = new StringBuffer(Thread.currentThread().getName());
+        buff.append(" ");
+        buff.append(message);
+        message = buff.toString();
+        if (Level.ERROR.toString().equalsIgnoreCase(logLevel.toString())) {
+          logErrorMessage(throwable, message);
+        } else if (Level.DEBUG.toString().equalsIgnoreCase(logLevel.toString())) {
+          logDebugMessage(throwable, message);
+        } else if (Level.INFO.toString().equalsIgnoreCase(logLevel.toString())) {
+          logInfoMessage(throwable, message);
+        } else if (Level.WARN.toString().equalsIgnoreCase(logLevel.toString())) {
+          logWarnMessage(throwable, message);
+        } else if (Level.AUDIT.toString().equalsIgnoreCase(logLevel.toString())) {
+          audit(message);
+        } else if (Level.STATISTICS == logLevel) {
+          statistic(message);
+        }
+
+      } catch (Throwable t) {
+        logger.error(t);
+      }
+    }
+  }
+
+  private void logErrorMessage(Throwable throwable, String message) {
+
+    if (null == throwable) {
+      logger.error(message);
+    } else {
+      logger.error(message, throwable);
+    }
+  }
+
+  private void logInfoMessage(Throwable throwable, String message) {
+
+    if (null == throwable) {
+      logger.info(message);
+    } else {
+      logger.info(message, throwable);
+    }
+  }
+
+  private void logDebugMessage(Throwable throwable, String message) {
+
+    if (null == throwable) {
+      logger.debug(message);
+    } else {
+      logger.debug(message, throwable);
+    }
+  }
+
+  private void logWarnMessage(Throwable throwable, String message) {
+
+    if (null == throwable) {
+      logger.warn(message);
+    } else {
+      logger.warn(message, throwable);
+    }
+  }
+
+  public boolean isInfoEnabled() {
+    return logger.isInfoEnabled();
+  }
+
+  public void warn(String message) {
+    if (isWarnEnabled()) {
+      logMessage(Level.WARN, null, message);
+    }
+  }
+
+  public void setEventProperties(String propertyName, String propertyValue) {
+    MDC.put(propertyName, propertyValue);
+  }
+
+  /**
+   * log audit log
+   *
+   * @param msg audit log message
+   */
+  @Override public void audit(String msg) {
+    String hostName = "";
+
+    try {
+      hostName = InetAddress.getLocalHost().getHostName();
+    } catch (UnknownHostException e) {
+      hostName = "localhost";
+    }
+    String username = "unknown";
+    String threadid = "unknown";
+    try {
+      threadid = Thread.currentThread().getId() + "";
+      username = UserGroupInformation.getCurrentUser().getShortUserName();
+    } catch (IOException e) {
+      username = "unknown";
+    }
+    logger.log(AuditLevel.AUDIT,
+        "[" + hostName + "]" + "[" + username + "]" + "[Thread-" + threadid + "]" + msg);
+  }
+
+  @Override public void statistic(String message) {
+    logger.log(StatisticLevel.STATISTIC, message);
+  }
+
+  /**
+   * Specifies the logging level.
+   */
+  enum Level {
+
+    NONE(0),
+    DEBUG(1),
+    INFO(2),
+    STATISTICS(3),
+    ERROR(4),
+    AUDIT(5),
+    WARN(6);
+
+    /**
+     * Constructor.
+     *
+     * @param level
+     */
+    Level(final int level) {
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/main/java/org/apache/carbondata/common/logging/impl/StatisticLevel.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/carbondata/common/logging/impl/StatisticLevel.java b/common/src/main/java/org/apache/carbondata/common/logging/impl/StatisticLevel.java
new file mode 100644
index 0000000..163db51
--- /dev/null
+++ b/common/src/main/java/org/apache/carbondata/common/logging/impl/StatisticLevel.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.carbondata.common.logging.impl;
+
+import org.apache.log4j.Level;
+
+/**
+ * Extended log level class to log the statistic details
+ */
+public class StatisticLevel extends Level {
+
+  public static final StatisticLevel STATISTIC = new StatisticLevel(55000, "STATISTIC", 0);
+
+  private static final long serialVersionUID = -209614723183147373L;
+
+  /**
+   * Constructor
+   *
+   * @param level            log level
+   * @param levelStr         log level string
+   * @param syslogEquivalent syslogEquivalent
+   */
+  protected StatisticLevel(int level, String levelStr, int syslogEquivalent) {
+    super(level, levelStr, syslogEquivalent);
+  }
+
+  /**
+   * Returns custom level for debug type log message
+   *
+   * @param val          value
+   * @param defaultLevel level
+   * @return custom level
+   */
+  public static StatisticLevel toLevel(int val, Level defaultLevel) {
+    return STATISTIC;
+  }
+
+  /**
+   * Returns custom level for debug type log message
+   *
+   * @param sArg         sArg
+   * @param defaultLevel level
+   * @return custom level
+   */
+  public static StatisticLevel toLevel(String sArg, Level defaultLevel) {
+    return STATISTIC;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/main/java/org/carbondata/common/CarbonIterator.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/carbondata/common/CarbonIterator.java b/common/src/main/java/org/carbondata/common/CarbonIterator.java
deleted file mode 100644
index 2ac2ff3..0000000
--- a/common/src/main/java/org/carbondata/common/CarbonIterator.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.carbondata.common;
-
-import java.util.Iterator;
-
-/**
- * CarbonIterator adds default implement for remove. This is required for Java 7.
- * @param <E>
- */
-public abstract class CarbonIterator<E> implements Iterator<E> {
-
-  @Override public abstract boolean hasNext();
-
-  @Override public abstract E next();
-
-  @Override public void remove() {
-    throw new UnsupportedOperationException("remove");
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/main/java/org/carbondata/common/logging/LogService.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/carbondata/common/logging/LogService.java b/common/src/main/java/org/carbondata/common/logging/LogService.java
deleted file mode 100644
index 1dcff57..0000000
--- a/common/src/main/java/org/carbondata/common/logging/LogService.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.carbondata.common.logging;
-
-/**
- * for Log Services
- */
-public interface LogService {
-
-  void debug(String message);
-
-  void info(String message);
-
-  void warn(String message);
-
-  void error(String message);
-
-  void error(Throwable throwable);
-
-  void error(Throwable throwable, String message);
-
-  void audit(String message);
-
-  /**
-   * Below method will be used to log the statistic information
-   *
-   * @param message statistic message
-   */
-  void statistic(String message);
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/main/java/org/carbondata/common/logging/LogServiceFactory.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/carbondata/common/logging/LogServiceFactory.java b/common/src/main/java/org/carbondata/common/logging/LogServiceFactory.java
deleted file mode 100644
index 471f80c..0000000
--- a/common/src/main/java/org/carbondata/common/logging/LogServiceFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.carbondata.common.logging;
-
-import org.carbondata.common.logging.impl.StandardLogService;
-
-/**
- * Log Service factory
- */
-public final class LogServiceFactory {
-  private LogServiceFactory() {
-
-  }
-
-  /**
-   * return Logger Service.
-   *
-   * @param className provides class name
-   * @return LogService
-   */
-  public static LogService getLogService(final String className) {
-    return new StandardLogService(className);
-  }
-
-  public static LogService getLogService() {
-    return new StandardLogService();
-  }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/main/java/org/carbondata/common/logging/impl/AuditExtendedRollingFileAppender.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/carbondata/common/logging/impl/AuditExtendedRollingFileAppender.java b/common/src/main/java/org/carbondata/common/logging/impl/AuditExtendedRollingFileAppender.java
deleted file mode 100644
index eafd677..0000000
--- a/common/src/main/java/org/carbondata/common/logging/impl/AuditExtendedRollingFileAppender.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.carbondata.common.logging.impl;
-
-import org.apache.log4j.spi.LoggingEvent;
-
-/**
- * Copied form log4j and modified for renaming files and restriction only for
- * audit logging
- */
-public class AuditExtendedRollingFileAppender extends ExtendedRollingFileAppender {
-
-  /**g
-   * Call RollingFileAppender method to append the log...
-   *
-   * @see org.apache.log4j.RollingFileAppender#subAppend(LoggingEvent)
-   */
-  protected void subAppend(LoggingEvent event) {
-    if (event.getLevel().toInt() == AuditLevel.AUDIT.toInt()) {
-      currentLevel = AuditLevel.AUDIT.toInt();
-      super.subAppend(event);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/main/java/org/carbondata/common/logging/impl/AuditLevel.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/carbondata/common/logging/impl/AuditLevel.java b/common/src/main/java/org/carbondata/common/logging/impl/AuditLevel.java
deleted file mode 100644
index f15f8cf..0000000
--- a/common/src/main/java/org/carbondata/common/logging/impl/AuditLevel.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.carbondata.common.logging.impl;
-
-import org.apache.log4j.Level;
-
-public class AuditLevel extends Level {
-
-  public static final AuditLevel AUDIT = new AuditLevel(55000, "AUDIT", 0);
-  private static final long serialVersionUID = -209614723183147373L;
-
-  /**
-   * Constructor
-   *
-   * @param level            log level
-   * @param levelStr         log level string
-   * @param syslogEquivalent syslogEquivalent
-   */
-  protected AuditLevel(int level, String levelStr, int syslogEquivalent) {
-    super(level, levelStr, syslogEquivalent);
-  }
-
-  /**
-   * Returns custom level for debug type log message
-   *
-   * @param val          value
-   * @param defaultLevel level
-   * @return custom level
-   */
-  public static AuditLevel toLevel(int val, Level defaultLevel) {
-    return AUDIT;
-  }
-
-  /**
-   * Returns custom level for debug type log message
-   *
-   * @param sArg         sArg
-   * @param defaultLevel level
-   * @return custom level
-   */
-  public static AuditLevel toLevel(String sArg, Level defaultLevel) {
-    return AUDIT;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/main/java/org/carbondata/common/logging/impl/ExtendedRollingFileAppender.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/carbondata/common/logging/impl/ExtendedRollingFileAppender.java b/common/src/main/java/org/carbondata/common/logging/impl/ExtendedRollingFileAppender.java
deleted file mode 100644
index 46afe9b..0000000
--- a/common/src/main/java/org/carbondata/common/logging/impl/ExtendedRollingFileAppender.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.carbondata.common.logging.impl;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.io.InterruptedIOException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map.Entry;
-import java.util.TreeMap;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.RollingFileAppender;
-import org.apache.log4j.helpers.CountingQuietWriter;
-import org.apache.log4j.helpers.LogLog;
-import org.apache.log4j.spi.LoggingEvent;
-
-/**
- * Copied from log4j to remove the hard coding for the file name from it Copied
- * form log4j and modified for renaming files
- */
-public class ExtendedRollingFileAppender extends RollingFileAppender {
-
-  private static final String DATE_FORMAT_FOR_TRANSFER = "yyyy-MM-dd'_'HH-mm-ss";
-  protected int currentLevel = Level.FATAL_INT;
-  /**
-   * Added for DTS DTS2011122001074 Now in log file rolling(after file size
-   * exceeded the threshold) and deletion (after file count exceeded the file
-   * count threshold) it will print log message
-   */
-
-  private long nextRollover = 0;
-  private boolean cleanupInProgress = false;
-
-  /**
-   * Total number of files at any point of time should be Backup number of
-   * files + current file
-   */
-  private static void cleanLogs(final String startName, final String folderPath,
-      int maxBackupIndex) {
-    final String fileStartName = startName.toLowerCase(Locale.US);
-    // Delete the oldest file, to keep Windows happy.
-    File file = new File(folderPath);
-
-    if (file.exists()) {
-      File[] files = file.listFiles(new FileFilter() {
-
-        public boolean accept(File file) {
-          if (!file.isDirectory() && file.getName().toLowerCase(Locale.US)
-              .startsWith(fileStartName)) {
-            return true;
-          }
-          return false;
-        }
-      });
-
-      int backupFiles = files.length - 1;
-
-      if (backupFiles <= maxBackupIndex) {
-        return;
-      }
-
-      // Sort the file based on its name.
-      TreeMap<String, File> sortedMap = new TreeMap<String, File>();
-      for (File file1 : files) {
-        sortedMap.put(file1.getName(), file1);
-      }
-
-      // Remove the first log file from map. it will be <startName>.log
-      // itself which will be backed up in rollover
-      sortedMap.remove(sortedMap.firstKey());
-
-      Iterator<Entry<String, File>> it = sortedMap.entrySet().iterator();
-      Entry<String, File> temp = null;
-
-      // After clean up the files should be maxBackupIndex -1 number of
-      // files. Because one more backup file
-      // will be created after this method call is over
-      while (it.hasNext() && backupFiles > maxBackupIndex) {
-        temp = it.next();
-        File deleteFile = temp.getValue();
-        // Delete the file
-        // Fixed defect DTS2011122001074 after deletion of log file it
-        // will print the log message in ReportService.log
-        if (deleteFile.delete()) {
-          backupFiles--;
-        } else {
-          LogLog.error("Couldn't delete file :: " + deleteFile.getPath());
-        }
-      }
-    }
-  }
-
-  /**
-   * Copied from log4j to remove hardcoding of file name
-   */
-  public void rollOver() {
-    File target;
-    File file = new File(fileName);
-
-    String fileStartName = file.getName();
-    int dotIndex = fileStartName.indexOf('.');
-
-    if (dotIndex != -1) {
-      fileStartName = fileStartName.substring(0, dotIndex);
-    }
-    final String startName = fileStartName;
-    final String folderPath = file.getParent();
-
-    if (qw != null) {
-      long size = ((CountingQuietWriter) qw).getCount();
-      LogLog.debug("rolling over count=" + size);
-      // if operation fails, do not roll again until
-      // maxFileSize more bytes are written
-      nextRollover = size + maxFileSize;
-    }
-
-    LogLog.debug("maxBackupIndex=" + maxBackupIndex);
-
-    boolean renameSucceeded = true;
-
-    // If maxBackups <= 0, then there is no file renaming to be done.
-    if (maxBackupIndex > 0) {
-      DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_FOR_TRANSFER);
-
-      StringBuffer buffer = new StringBuffer();
-      String extension = "";
-      if (fileName.contains(".")) {
-        extension = fileName.substring(fileName.lastIndexOf("."));
-        buffer.append(fileName.substring(0, fileName.lastIndexOf(".")));
-      } else {
-        buffer.append(fileName);
-      }
-      buffer.append("_").append(dateFormat.format(new Date())).append(extension);
-      // Rename fileName to fileName.1
-      target = new File(buffer.toString());
-
-      this.closeFile(); // keep windows happy.
-
-      LogLog.debug("Renaming file " + file + " to " + target);
-      renameSucceeded = file.renameTo(target);
-
-      //
-      // if file rename failed, reopen file with append = true
-      //
-      if (!renameSucceeded) {
-        try {
-          this.setFile(fileName, true, bufferedIO, bufferSize);
-        } catch (InterruptedIOException e) {
-          Thread.currentThread().interrupt();
-        } catch (IOException e) {
-          LogLog.error("setFile(" + fileName + ", true) call failed.", e);
-        }
-      }
-    }
-
-    //
-    // if all renames were successful, then
-    //
-    if (renameSucceeded) {
-      try {
-        // This will also close the file. This is OK since multiple
-        // close operations are safe.
-        this.setFile(fileName, false, bufferedIO, bufferSize);
-        nextRollover = 0;
-      } catch (InterruptedIOException e) {
-        Thread.currentThread().interrupt();
-      } catch (IOException e) {
-        LogLog.error("setFile(" + fileName + ", false) call failed.", e);
-      }
-    }
-
-    // Do clean up finally
-    cleanUpLogs(startName, folderPath);
-  }
-
-  private void cleanUpLogs(final String startName, final String folderPath) {
-    if (maxBackupIndex > 0) {
-      // Clean the logs files
-      Runnable r = new Runnable() {
-
-        public void run() {
-          if (cleanupInProgress) {
-            return;
-          }
-          synchronized (ExtendedRollingFileAppender.class) {
-            cleanupInProgress = true;
-            try {
-              cleanLogs(startName, folderPath, maxBackupIndex);
-            } catch (Throwable e) {
-              // ignore any error
-              LogLog.error("Cleaning logs failed", e);
-            } finally {
-              cleanupInProgress = false;
-            }
-          }
-        }
-      };
-
-      Thread t = new Thread(r);
-      t.start();
-    }
-  }
-
-  protected void subAppend(LoggingEvent event) {
-    if (event.getLevel().toInt() <= currentLevel) {
-      super.subAppend(event);
-      if (fileName != null && qw != null) {
-        long size = ((CountingQuietWriter) qw).getCount();
-        if (size >= maxFileSize && size >= nextRollover) {
-          rollOver();
-        }
-      }
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/main/java/org/carbondata/common/logging/impl/FileUtil.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/carbondata/common/logging/impl/FileUtil.java b/common/src/main/java/org/carbondata/common/logging/impl/FileUtil.java
deleted file mode 100644
index 62ee4ac..0000000
--- a/common/src/main/java/org/carbondata/common/logging/impl/FileUtil.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.carbondata.common.logging.impl;
-
-import java.io.Closeable;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Properties;
-
-import org.apache.log4j.Logger;
-
-/**
- * Provides file Utility
- */
-public final class FileUtil {
-
-  public static final String CARBON_PROPERTIES_FILE_PATH = "../../../conf/carbon.properties";
-  private static final Logger LOG = Logger.getLogger(FileUtil.class.getName());
-  private static Properties carbonProperties;
-
-  private FileUtil() {
-
-  }
-
-  public static Properties getCarbonProperties() {
-    if (null == carbonProperties) {
-      loadProperties();
-    }
-
-    return carbonProperties;
-  }
-
-  /**
-   * closes the stream
-   *
-   * @param stream stream to be closed.
-   */
-  public static void close(Closeable stream) {
-    if (null != stream) {
-      try {
-        stream.close();
-      } catch (IOException e) {
-        LOG.error("Exception while closing the Log stream");
-      }
-    }
-  }
-
-  private static void loadProperties() {
-    String property = System.getProperty("carbon.properties.filepath");
-    if (null == property) {
-      property = CARBON_PROPERTIES_FILE_PATH;
-    }
-    File file = new File(property);
-
-    FileInputStream fis = null;
-    try {
-      if (file.exists()) {
-        fis = new FileInputStream(file);
-
-        carbonProperties = new Properties();
-        carbonProperties.load(fis);
-      }
-    } catch (FileNotFoundException e) {
-      LOG.error("Could not find carbon properties file in the path " + property);
-    } catch (IOException e) {
-      LOG.error("Error while reading carbon properties file in the path " + property);
-    } finally {
-      if (null != fis) {
-        try {
-          fis.close();
-        } catch (IOException e) {
-          LOG.error("Error while closing the file stream for carbon.properties");
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/main/java/org/carbondata/common/logging/impl/StandardLogService.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/carbondata/common/logging/impl/StandardLogService.java b/common/src/main/java/org/carbondata/common/logging/impl/StandardLogService.java
deleted file mode 100644
index dbc25f5..0000000
--- a/common/src/main/java/org/carbondata/common/logging/impl/StandardLogService.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.carbondata.common.logging.impl;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Properties;
-
-import org.carbondata.common.logging.LogService;
-
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.log4j.Logger;
-import org.apache.log4j.MDC;
-
-/**
- * Default Implementation of the <code>LogService</code>
- */
-public final class StandardLogService implements LogService {
-
-  private static final String PARTITION_ID = "[partitionID:";
-  private static final String CARBON_AUDIT_LOG_PATH = "carbon.auditlog.file.path";
-  private static final String AUDIT_LOG_DEFAULT_PATH = "logs/CarbonAudit.log";
-  private static final String CARBON_AUDIT_LOG_ROLLING_UP_SIZE = "carbon.auditlog.max.file.size";
-  private static final String AUDIT_LOG_DEFAULT_ROLLING_UP_SIZE = "10MB";
-  private static final String CARBON_AUDIT_LOG_MAX_BACKUP = "carbon.auditlog.max.backup.files";
-  private static final String AUDIT_LOG_DEFAULT_MAX_BACKUP = "10";
-  private static final String CARBON_AUDIT_LOG_LEVEL = "carbon.logging.level";
-  private static final String AUDIT_LOG_DEFAULT_LEVEL = "INFO";
-  private static boolean doLog = true;
-  private Logger logger;
-
-  /**
-   * Constructor.
-   *
-   * @param clazzName for which the Logging is required
-   */
-  public StandardLogService(String clazzName) {
-    String auditLogPath = AUDIT_LOG_DEFAULT_PATH;
-    String rollupSize = AUDIT_LOG_DEFAULT_ROLLING_UP_SIZE;
-    String maxBackup = AUDIT_LOG_DEFAULT_MAX_BACKUP;
-    String logLevel = AUDIT_LOG_DEFAULT_LEVEL;
-
-    Properties props = new Properties();
-    Properties carbonProps = FileUtil.getCarbonProperties();
-
-    if (null != carbonProps) {
-      if (null != carbonProps.getProperty(CARBON_AUDIT_LOG_PATH)) {
-        auditLogPath = carbonProps.getProperty(CARBON_AUDIT_LOG_PATH);
-      }
-
-      if (null != carbonProps.getProperty(CARBON_AUDIT_LOG_ROLLING_UP_SIZE)) {
-        rollupSize = carbonProps.getProperty(CARBON_AUDIT_LOG_ROLLING_UP_SIZE);
-      }
-
-      if (null != carbonProps.getProperty(CARBON_AUDIT_LOG_MAX_BACKUP)) {
-        maxBackup = carbonProps.getProperty(CARBON_AUDIT_LOG_MAX_BACKUP);
-      }
-
-      if (null != carbonProps.getProperty(CARBON_AUDIT_LOG_LEVEL)) {
-        logLevel = carbonProps.getProperty(CARBON_AUDIT_LOG_LEVEL);
-      }
-    }
-
-    props.setProperty("log4j.rootLogger", logLevel + ",stdout,AUDL");
-
-    props.setProperty("log4j.appender.stdout", "org.apache.log4j.ConsoleAppender");
-    props.setProperty("log4j.appender.stdout.layout.ConversionPattern", "%d %-5p [%c] %m%n");
-    props.setProperty("log4j.appender.stdout.layout", "org.apache.log4j.PatternLayout");
-    props.setProperty("log4j.appender.AUDL",
-        "org.carbondata.common.logging.impl.AuditExtendedRollingFileAppender");
-
-    props.setProperty("log4j.appender.AUDL.File", auditLogPath);
-    props.setProperty("log4j.appender.AUDL.threshold",
-        "AUDIT#org.carbondata.common.logging.impl.AuditLevel");
-    props.setProperty("log4j.appender.AUDL.layout.ConversionPattern",
-        "%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n");
-    props.setProperty("log4j.appender.AUDL.layout", "org.apache.log4j.PatternLayout");
-    props.setProperty("log4j.appender.AUDL.MaxFileSize", rollupSize);
-    props.setProperty("log4j.appender.AUDL.MaxBackupIndex", maxBackup);
-
-    props.setProperty("log4j.logger.com.huawei", logLevel + ",stdout");
-    props.setProperty("log4j.logger.com.huawei", logLevel + ",AUDL");
-
-    logger = Logger.getLogger(clazzName);
-
-  }
-
-  public StandardLogService() {
-    this("Carbon");
-  }
-
-  /**
-   * returns is DO Log
-   *
-   * @return the doLog
-   */
-  public static boolean isDoLog() {
-    return doLog;
-  }
-
-  /**
-   * set Do Log
-   *
-   * @param doLog the doLog to set
-   */
-  public static void setDoLog(boolean doLog) {
-    StandardLogService.doLog = doLog;
-  }
-
-  public static String getPartitionID(String tableName) {
-    return tableName.substring(tableName.lastIndexOf('_') + 1, tableName.length());
-  }
-
-  public static void setThreadName(String partitionID, String queryID) {
-    StringBuffer b = new StringBuffer(PARTITION_ID);
-    b.append(partitionID);
-    if (null != queryID) {
-      b.append(";queryID:");
-      b.append(queryID);
-    }
-    b.append("]");
-    Thread.currentThread().setName(getThreadName() + b.toString());
-  }
-
-  private static String getThreadName() {
-    String name = Thread.currentThread().getName();
-    int index = name.indexOf(PARTITION_ID);
-    if (index > -1) {
-      name = name.substring(0, index);
-    } else {
-      name = '[' + name + ']';
-    }
-    return name.trim();
-  }
-
-  public boolean isDebugEnabled() {
-    return logger.isDebugEnabled();
-  }
-
-  public boolean isWarnEnabled() {
-    return logger.isEnabledFor(org.apache.log4j.Level.WARN);
-  }
-
-  public void debug(String message) {
-    if (logger.isDebugEnabled()) {
-      logMessage(Level.DEBUG, null, message);
-    }
-  }
-
-  public void error(String message) {
-    logMessage(Level.ERROR, null, message);
-  }
-
-  public void error(Throwable throwable, String message) {
-    logMessage(Level.ERROR, throwable, message);
-  }
-
-  public void error(Throwable throwable) {
-    logMessage(Level.ERROR, throwable, "");
-  }
-
-  public void info(String message) {
-    if (logger.isInfoEnabled()) {
-      logMessage(Level.INFO, null, message);
-    }
-  }
-
-  /**
-   * Utility Method to log the the Message.
-   */
-  private void logMessage(Level logLevel, Throwable throwable, String message) {
-    if (StandardLogService.doLog) {
-      try {
-        //Append the partition id and query id if exist
-        StringBuffer buff = new StringBuffer(Thread.currentThread().getName());
-        buff.append(" ");
-        buff.append(message);
-        message = buff.toString();
-        if (Level.ERROR.toString().equalsIgnoreCase(logLevel.toString())) {
-          logErrorMessage(throwable, message);
-        } else if (Level.DEBUG.toString().equalsIgnoreCase(logLevel.toString())) {
-          logDebugMessage(throwable, message);
-        } else if (Level.INFO.toString().equalsIgnoreCase(logLevel.toString())) {
-          logInfoMessage(throwable, message);
-        } else if (Level.WARN.toString().equalsIgnoreCase(logLevel.toString())) {
-          logWarnMessage(throwable, message);
-        } else if (Level.AUDIT.toString().equalsIgnoreCase(logLevel.toString())) {
-          audit(message);
-        } else if (Level.STATISTICS == logLevel) {
-          statistic(message);
-        }
-
-      } catch (Throwable t) {
-        logger.error(t);
-      }
-    }
-  }
-
-  private void logErrorMessage(Throwable throwable, String message) {
-
-    if (null == throwable) {
-      logger.error(message);
-    } else {
-      logger.error(message, throwable);
-    }
-  }
-
-  private void logInfoMessage(Throwable throwable, String message) {
-
-    if (null == throwable) {
-      logger.info(message);
-    } else {
-      logger.info(message, throwable);
-    }
-  }
-
-  private void logDebugMessage(Throwable throwable, String message) {
-
-    if (null == throwable) {
-      logger.debug(message);
-    } else {
-      logger.debug(message, throwable);
-    }
-  }
-
-  private void logWarnMessage(Throwable throwable, String message) {
-
-    if (null == throwable) {
-      logger.warn(message);
-    } else {
-      logger.warn(message, throwable);
-    }
-  }
-
-  public boolean isInfoEnabled() {
-    return logger.isInfoEnabled();
-  }
-
-  public void warn(String message) {
-    if (isWarnEnabled()) {
-      logMessage(Level.WARN, null, message);
-    }
-  }
-
-  public void setEventProperties(String propertyName, String propertyValue) {
-    MDC.put(propertyName, propertyValue);
-  }
-
-  /**
-   * log audit log
-   *
-   * @param msg audit log message
-   */
-  @Override public void audit(String msg) {
-    String hostName = "";
-
-    try {
-      hostName = InetAddress.getLocalHost().getHostName();
-    } catch (UnknownHostException e) {
-      hostName = "localhost";
-    }
-    String username = "unknown";
-    String threadid = "unknown";
-    try {
-      threadid = Thread.currentThread().getId() + "";
-      username = UserGroupInformation.getCurrentUser().getShortUserName();
-    } catch (IOException e) {
-      username = "unknown";
-    }
-    logger.log(AuditLevel.AUDIT,
-        "[" + hostName + "]" + "[" + username + "]" + "[Thread-" + threadid + "]" + msg);
-  }
-
-  @Override public void statistic(String message) {
-    logger.log(StatisticLevel.STATISTIC, message);
-  }
-
-  /**
-   * Specifies the logging level.
-   */
-  enum Level {
-
-    NONE(0),
-    DEBUG(1),
-    INFO(2),
-    STATISTICS(3),
-    ERROR(4),
-    AUDIT(5),
-    WARN(6);
-
-    /**
-     * Constructor.
-     *
-     * @param level
-     */
-    Level(final int level) {
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/main/java/org/carbondata/common/logging/impl/StatisticLevel.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/carbondata/common/logging/impl/StatisticLevel.java b/common/src/main/java/org/carbondata/common/logging/impl/StatisticLevel.java
deleted file mode 100644
index 211d055..0000000
--- a/common/src/main/java/org/carbondata/common/logging/impl/StatisticLevel.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.carbondata.common.logging.impl;
-
-import org.apache.log4j.Level;
-
-/**
- * Extended log level class to log the statistic details
- */
-public class StatisticLevel extends Level {
-
-  public static final StatisticLevel STATISTIC = new StatisticLevel(55000, "STATISTIC", 0);
-
-  private static final long serialVersionUID = -209614723183147373L;
-
-  /**
-   * Constructor
-   *
-   * @param level            log level
-   * @param levelStr         log level string
-   * @param syslogEquivalent syslogEquivalent
-   */
-  protected StatisticLevel(int level, String levelStr, int syslogEquivalent) {
-    super(level, levelStr, syslogEquivalent);
-  }
-
-  /**
-   * Returns custom level for debug type log message
-   *
-   * @param val          value
-   * @param defaultLevel level
-   * @return custom level
-   */
-  public static StatisticLevel toLevel(int val, Level defaultLevel) {
-    return STATISTIC;
-  }
-
-  /**
-   * Returns custom level for debug type log message
-   *
-   * @param sArg         sArg
-   * @param defaultLevel level
-   * @return custom level
-   */
-  public static StatisticLevel toLevel(String sArg, Level defaultLevel) {
-    return STATISTIC;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/test/java/log4j.properties
----------------------------------------------------------------------
diff --git a/common/src/test/java/log4j.properties b/common/src/test/java/log4j.properties
index 8d966f0..3d35725 100644
--- a/common/src/test/java/log4j.properties
+++ b/common/src/test/java/log4j.properties
@@ -16,9 +16,9 @@
 # limitations under the License.
 #
 log4j.logger.com.huawei=INFO,R5
-log4j.appender.R5=org.carbondata.common.logging.impl.AuditExtendedRollingFileAppender
+log4j.appender.R5=org.apache.carbondata.common.logging.impl.AuditExtendedRollingFileAppender
 log4j.appender.R5.File=./unibiaudit.log
-log4j.appender.R5.threshold=AUDIT#org.carbondata.common.logging.AuditLevel
+log4j.appender.R5.threshold=AUDIT#org.apache.carbondata.common.logging.AuditLevel
 log4j.appender.R5.layout=org.apache.log4j.PatternLayout
 log4j.appender.R5.layout.ConversionPattern=%d [%t] %p [%c] %X{CLIENT_IP} %X{USER_NAME} %X{MODULE} %X{OPERATRION}- %m%n
 

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/test/java/org/apache/carbondata/common/logging/LogServiceFactoryTest_UT.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/carbondata/common/logging/LogServiceFactoryTest_UT.java b/common/src/test/java/org/apache/carbondata/common/logging/LogServiceFactoryTest_UT.java
new file mode 100644
index 0000000..66248c7
--- /dev/null
+++ b/common/src/test/java/org/apache/carbondata/common/logging/LogServiceFactoryTest_UT.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.common.logging;
+
+import org.apache.carbondata.common.logging.impl.StandardLogService;
+
+import junit.framework.TestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class LogServiceFactoryTest_UT extends TestCase {
+
+  @Before public void setUp() throws Exception {
+  }
+
+  @After public void tearDown() throws Exception {
+  }
+
+  @Test public void testGetLogService() {
+    LogService logger = LogServiceFactory.getLogService("sampleclass");
+    assertTrue(logger instanceof StandardLogService);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/test/java/org/apache/carbondata/common/logging/ft/LoggingServiceTest_FT.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/carbondata/common/logging/ft/LoggingServiceTest_FT.java b/common/src/test/java/org/apache/carbondata/common/logging/ft/LoggingServiceTest_FT.java
new file mode 100644
index 0000000..fadb0b8
--- /dev/null
+++ b/common/src/test/java/org/apache/carbondata/common/logging/ft/LoggingServiceTest_FT.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.common.logging.ft;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+
+import junit.framework.TestCase;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.MDC;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class LoggingServiceTest_FT extends TestCase {
+
+  private static LogService logger =
+      LogServiceFactory.getLogService(LoggingServiceTest_FT.class.getName());
+
+  @Before public void setUp() throws Exception {
+    MDC.put("MODULE", "Function Test");
+    MDC.put("USER_NAME", "testuser");
+    MDC.put("CLIENT_IP", "127.0.0.1");
+    MDC.put("OPERATRION", "log");
+  }
+
+  @Test public void testIsAuditFileCreated() {
+    File f = new File("./unibiaudit.log");
+    Assert.assertFalse(f.exists());
+  }
+
+  @Test public void testAudit() {
+
+    String expectedAuditLine =
+        "[main] AUDIT [com.huawei.iweb.platform.logging.ft.LoggingServiceTest_FT] 127.0.0.1 "
+            + "testuser Function Test log- audit message created";
+    logger.audit("audit message created");
+
+    LogManager.shutdown();
+
+    try {
+      FileInputStream fstream = new FileInputStream("./unibiaudit.log");
+      BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
+      String actualAuditLine = null;
+      String strLine = null;
+      while ((strLine = br.readLine()) != null) {
+        actualAuditLine = strLine;
+      }
+
+      System.out.println(actualAuditLine);
+
+      if (actualAuditLine != null) {
+        int index = actualAuditLine.indexOf("[main]");
+        actualAuditLine = actualAuditLine.substring(index);
+        Assert.assertEquals(expectedAuditLine, actualAuditLine);
+      } else {
+        Assert.assertTrue(false);
+      }
+    } catch (FileNotFoundException e) {
+      e.printStackTrace();
+      Assert.assertTrue(!false);
+    } catch (IOException e) {
+      e.printStackTrace();
+      Assert.assertTrue(false);
+    }
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/test/java/org/apache/carbondata/common/logging/impl/AuditExtendedRollingFileAppenderTest_UT.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/carbondata/common/logging/impl/AuditExtendedRollingFileAppenderTest_UT.java b/common/src/test/java/org/apache/carbondata/common/logging/impl/AuditExtendedRollingFileAppenderTest_UT.java
new file mode 100644
index 0000000..4032ddb
--- /dev/null
+++ b/common/src/test/java/org/apache/carbondata/common/logging/impl/AuditExtendedRollingFileAppenderTest_UT.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.common.logging.impl;
+
+import junit.framework.Assert;
+import mockit.Deencapsulation;
+import org.apache.log4j.Logger;
+import org.apache.log4j.spi.LoggingEvent;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AuditExtendedRollingFileAppenderTest_UT {
+
+  private AuditExtendedRollingFileAppender rAppender = null;
+
+  @Before public void setUp() throws Exception {
+    rAppender = new AuditExtendedRollingFileAppender();
+    Deencapsulation.setField(rAppender, "fileName", "audit.log");
+    Deencapsulation.setField(rAppender, "maxBackupIndex", 1);
+    Deencapsulation.setField(rAppender, "maxFileSize", 1000L);
+
+  }
+
+  @After public void tearDown() throws Exception {
+
+  }
+
+  @Test public void testRollOver() {
+    rAppender.rollOver();
+    rAppender.rollOver();
+    rAppender.rollOver();
+    Assert.assertTrue(true);
+  }
+
+  @Test public void testCleanLogs() {
+    final String startName = "audit";
+    final String folderPath = "./";
+    int maxBackupIndex = 1;
+
+    Deencapsulation.invoke(rAppender, "cleanLogs", startName, folderPath, maxBackupIndex);
+    Assert.assertTrue(true);
+  }
+
+  @Test public void testSubAppendLoggingEvent() {
+    Logger logger = Logger.getLogger(this.getClass());
+    LoggingEvent event = new LoggingEvent(null, logger, 0L, AuditLevel.AUDIT, null, null);
+
+    Deencapsulation.setField(rAppender, "qw", null);
+    try {
+      rAppender.subAppend(event);
+    } catch (Exception e) {
+      //
+    }
+    Assert.assertTrue(true);
+  }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/test/java/org/apache/carbondata/common/logging/impl/AuditLevelTest_UT.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/carbondata/common/logging/impl/AuditLevelTest_UT.java b/common/src/test/java/org/apache/carbondata/common/logging/impl/AuditLevelTest_UT.java
new file mode 100644
index 0000000..4c285a7
--- /dev/null
+++ b/common/src/test/java/org/apache/carbondata/common/logging/impl/AuditLevelTest_UT.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.common.logging.impl;
+
+import junit.framework.TestCase;
+import org.apache.log4j.Level;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AuditLevelTest_UT extends TestCase {
+
+  @Before public void setUp() throws Exception {
+  }
+
+  @After public void tearDown() throws Exception {
+  }
+
+  @Test public void testAuditLevel() {
+    assertEquals(AuditLevel.AUDIT.toInt(), 55000);
+  }
+
+  @Test public void testToLevelIntLevel() {
+    assertSame(AuditLevel.AUDIT, AuditLevel.toLevel(55000, Level.DEBUG));
+  }
+
+  @Test public void testToLevelStringLevel() {
+    assertSame(AuditLevel.AUDIT, AuditLevel.toLevel("AUDIT", Level.DEBUG));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/test/java/org/apache/carbondata/common/logging/impl/ExtendedRollingFileAppenderTest_UT.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/carbondata/common/logging/impl/ExtendedRollingFileAppenderTest_UT.java b/common/src/test/java/org/apache/carbondata/common/logging/impl/ExtendedRollingFileAppenderTest_UT.java
new file mode 100644
index 0000000..006db9c
--- /dev/null
+++ b/common/src/test/java/org/apache/carbondata/common/logging/impl/ExtendedRollingFileAppenderTest_UT.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.common.logging.impl;
+
+import junit.framework.Assert;
+import mockit.Deencapsulation;
+import org.apache.log4j.Logger;
+import org.apache.log4j.spi.LoggingEvent;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ExtendedRollingFileAppenderTest_UT {
+
+  private ExtendedRollingFileAppender rAppender = null;
+
+  @Before public void setUp() throws Exception {
+    rAppender = new ExtendedRollingFileAppender();
+    Deencapsulation.setField(rAppender, "fileName", "dummy.log");
+    Deencapsulation.setField(rAppender, "maxBackupIndex", 1);
+    Deencapsulation.setField(rAppender, "maxFileSize", 1000L);
+  }
+
+  @After public void tearDown() throws Exception {
+  }
+
+  @Test public void testRollOver() {
+    rAppender.rollOver();
+    rAppender.rollOver();
+    rAppender.rollOver();
+    Assert.assertTrue(true);
+  }
+
+  @Test public void testCleanLogs() {
+    final String startName = "dummy";
+    final String folderPath = "./";
+    int maxBackupIndex = 1;
+
+    Deencapsulation.invoke(rAppender, "cleanLogs", startName, folderPath, maxBackupIndex);
+  }
+
+  @Test public void testSubAppendLoggingEvent() {
+    Logger logger = Logger.getLogger(this.getClass());
+    LoggingEvent event = new LoggingEvent(null, logger, 0L, AuditLevel.DEBUG, null, null);
+
+    try {
+      rAppender.subAppend(event);
+    } catch (Exception e) {
+      //
+    }
+    Assert.assertTrue(true);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/test/java/org/apache/carbondata/common/logging/impl/FileUtilTest_UT.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/carbondata/common/logging/impl/FileUtilTest_UT.java b/common/src/test/java/org/apache/carbondata/common/logging/impl/FileUtilTest_UT.java
new file mode 100644
index 0000000..495b216
--- /dev/null
+++ b/common/src/test/java/org/apache/carbondata/common/logging/impl/FileUtilTest_UT.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.common.logging.impl;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+
+import junit.framework.TestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class FileUtilTest_UT extends TestCase {
+
+  /**
+   * @throws Exception
+   */
+  @Before public void setUp() throws Exception {
+    File f = new File("myfile.txt");
+    if (!f.exists()) {
+      f.createNewFile();
+    }
+  }
+
+  /**
+   * @throws Exception
+   */
+  @After public void tearDown() throws Exception {
+    File f = new File("myfile.txt");
+    if (f.exists()) {
+      f.delete();
+    }
+  }
+
+  @Test public void testClose() {
+    try {
+      FileInputStream in = new FileInputStream(new File("myfile.txt"));
+      FileUtil.close(in);
+      assertTrue(true);
+    } catch (FileNotFoundException e) {
+      assertTrue(false);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/test/java/org/apache/carbondata/common/logging/impl/StandardLogServiceTest_UT.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/carbondata/common/logging/impl/StandardLogServiceTest_UT.java b/common/src/test/java/org/apache/carbondata/common/logging/impl/StandardLogServiceTest_UT.java
new file mode 100644
index 0000000..0ad4bd7
--- /dev/null
+++ b/common/src/test/java/org/apache/carbondata/common/logging/impl/StandardLogServiceTest_UT.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.common.logging.impl;
+
+import junit.framework.TestCase;
+import mockit.Mock;
+import mockit.MockUp;
+import org.apache.log4j.Category;
+import org.apache.log4j.Priority;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class StandardLogServiceTest_UT extends TestCase {
+
+  private StandardLogService logService = null;
+
+  /**
+   * @throws Exception
+   */
+  @Before public void setUp() throws Exception {
+
+    new MockUp<Category>() {
+      @SuppressWarnings("unused")
+      @Mock public boolean isDebugEnabled() {
+        return true;
+      }
+
+      @SuppressWarnings("unused")
+      @Mock public boolean isEnabledFor(Priority level) {
+        return true;
+      }
+
+      @SuppressWarnings("unused")
+      @Mock public boolean isInfoEnabled() {
+        return true;
+      }
+    };
+
+    logService = new StandardLogService(this.getClass().getName());
+  }
+
+  /**
+   * @throws Exception
+   * @Author k00742797
+   * @Description : tearDown
+   */
+  @After public void tearDown() throws Exception {
+  }
+
+  @Test public void testStandardLogService() {
+    if (logService != null && logService instanceof StandardLogService) {
+      Assert.assertTrue(true);
+    } else {
+      Assert.assertTrue(false);
+    }
+  }
+
+  @Test public void testIsDebugEnabled() {
+    Assert.assertEquals(true, logService.isDebugEnabled());
+  }
+
+  @Test public void testIsWarnEnabled() {
+    Assert.assertEquals(true, logService.isWarnEnabled());
+  }
+
+  @Test public void testSecureLogEventObjectArray() {
+    Assert.assertTrue(true);
+  }
+
+  @Test public void testAuditLogEventObjectArray() {
+    logService.audit("testing");
+    Assert.assertTrue(true);
+  }
+
+  @Test public void testDebugLogEventObjectArray() {
+    logService.debug("testing");
+    Assert.assertTrue(true);
+  }
+
+  @Test public void testErrorLogEventObjectArray() {
+    logService.error("testing");
+    Assert.assertTrue(true);
+  }
+
+  @Test public void testErrorLogEventThrowableObjectArray() {
+    Exception exception = new Exception("test");
+    logService.error(exception);
+    Assert.assertTrue(true);
+  }
+
+  @Test public void testErrorLogEventThrowableMessage() {
+    Exception exception = new Exception("test");
+    logService.error(exception, "additional message");
+    Assert.assertTrue(true);
+  }
+
+  @Test public void testInfoLogEventObjectArray() {
+    logService.info("testing");
+    Assert.assertTrue(true);
+  }
+
+  @Test public void testIsInfoEnabled() {
+    Assert.assertEquals(true, logService.isInfoEnabled());
+  }
+
+  @Test public void testDeleteLogs() {
+    Assert.assertTrue(true);
+  }
+
+  @Test public void testFlushLogs() {
+    Assert.assertTrue(true);
+  }
+
+  @Test public void testSetEventProperties() {
+    logService.setEventProperties("CLIENT_IP", "127.0.0.1");
+    Assert.assertTrue(true);
+  }
+
+  @Test public void testIsDoLog() {
+    StandardLogService.setDoLog(true);
+    Assert.assertEquals(true, StandardLogService.isDoLog());
+
+    StandardLogService.setDoLog(false);
+    Assert.assertEquals(false, StandardLogService.isDoLog());
+
+  }
+
+  @Test public void testSetDoLog() {
+    StandardLogService.setDoLog(true);
+    Assert.assertEquals(true, StandardLogService.isDoLog());
+  }
+
+  @Test public void testAuditString() {
+    logService.audit("audit message");
+    Assert.assertTrue(true);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/cd6a4ff3/common/src/test/java/org/carbondata/common/logging/LogServiceFactoryTest_UT.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/carbondata/common/logging/LogServiceFactoryTest_UT.java b/common/src/test/java/org/carbondata/common/logging/LogServiceFactoryTest_UT.java
deleted file mode 100644
index f76b910..0000000
--- a/common/src/test/java/org/carbondata/common/logging/LogServiceFactoryTest_UT.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.carbondata.common.logging;
-
-import org.carbondata.common.logging.impl.StandardLogService;
-
-import junit.framework.TestCase;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class LogServiceFactoryTest_UT extends TestCase {
-
-  @Before public void setUp() throws Exception {
-  }
-
-  @After public void tearDown() throws Exception {
-  }
-
-  @Test public void testGetLogService() {
-    LogService logger = LogServiceFactory.getLogService("sampleclass");
-    assertTrue(logger instanceof StandardLogService);
-  }
-
-}