Skip to content

Commit

Permalink
Reduced logging and other improvements to console output (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
kedarbcs16 committed May 3, 2018
1 parent 64228e9 commit 0335899
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 132 deletions.
12 changes: 10 additions & 2 deletions conf/log4j.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Root logger option
log4j.rootLogger=INFO, file, stdout
log4j.rootLogger=ERROR, file, stdout
log4j.logger.DrillTestLogger=INFO, Drill
# Direct log messages to ./drill.log.timestamp file
log4j.appender.file = org.apache.log4j.rolling.RollingFileAppender
log4j.appender.file.rollingPolicy = org.apache.log4j.rolling.TimeBasedRollingPolicy
Expand All @@ -14,5 +14,13 @@ log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%m%n

# Direct log messages to stdout
log4j.appender.Drill=org.apache.log4j.ConsoleAppender
log4j.appender.Drill.Target=System.out
log4j.appender.Drill.layout=org.apache.log4j.PatternLayout
log4j.appender.Drill.layout.ConversionPattern=%m%n

log4j.additivity.DrillTestLogger=false

log4j.logger.org.apache.curator=WARN
log4j.logger.org.apache.zookeeper=WARN
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
import java.util.Queue;

public class ConnectionPool implements AutoCloseable {
private static final Logger LOG = Logger.getLogger(ConnectionPool.class);

private static final Logger LOG = Logger.getLogger("DrillTestLogger");
private final Map<String, Queue<Connection>> connections;
private Properties connectionProperties;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
*/

public class DBMetaData {
private static final Logger LOG = Logger.getLogger(DBMetaData.class);
private DatabaseMetaData md = null;
private static final Logger LOG = Logger.getLogger("DrillTestLogger");
private DatabaseMetaData md = null;
public DBMetaData(DatabaseMetaData md) {
this.md = md;
}
Expand Down Expand Up @@ -93,4 +93,4 @@ public String toString() {
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import java.util.concurrent.atomic.AtomicBoolean;

public class DrillTestJdbc implements DrillTest {
private static final Logger LOG = Logger.getLogger(DrillTestJdbc.class);
private static final Logger LOG = Logger.getLogger("DrillTestLogger");
private static final String LINE_BREAK = "------------------------------------------------------------------------";

private ConnectionPool connectionPool;
Expand All @@ -63,6 +63,7 @@ public class DrillTestJdbc implements DrillTest {
private Random rand = new Random();
private Statement statement = null;
private AtomicBoolean doneProcessingResultSet = new AtomicBoolean(false);
public static final CmdParam cmdParam = new CmdParam();
private int id;
private int totalCases;
private String queryID;
Expand Down Expand Up @@ -162,10 +163,8 @@ public void run() {
LOG.info("[" + testStatus + "] (" + stopwatch + ") " + modeler.queryFilename + " (ConnectionID: " + connection.hashCode() + ")");
}

if((++countTestsCompleted %100==0 && countTestsCompleted <= totalCases) || (countTestsCompleted == totalCases)){
LOG.info(LINE_BREAK);
LOG.info("Execution completed for " + countTestsCompleted + " (out of " + totalCases + ") tests");
LOG.info(LINE_BREAK);
if((++countTestsCompleted %100==0 && countTestsCompleted <= (totalCases*TestDriver.cmdParam.iterations*TestDriver.cmdParam.clones))||(countTestsCompleted>=totalCases && countTestsCompleted%totalCases==0)){
LOG.info(LINE_BREAK+"\nExecution completed for " + countTestsCompleted + " (out of " + (totalCases*TestDriver.cmdParam.iterations*TestDriver.cmdParam.clones) + ") tests\n"+LINE_BREAK);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
import java.util.concurrent.atomic.AtomicBoolean;

public class DrillTestOdbc implements DrillTest{
private static final Logger LOG = Logger.getLogger(DrillTestOdbc.class);

private static final Logger LOG = Logger.getLogger("DrillTestLogger");
private String query = null;
private String outputFilename;
private volatile TestStatus testStatus = TestStatus.PENDING;
Expand All @@ -56,7 +55,6 @@ public class DrillTestOdbc implements DrillTest{
private Thread thread;
private int id;
private int totalCases;

private static volatile int noOfCasesCompleted;

public DrillTestOdbc(DrillTestCase modeler, int id, int totalCases) {
Expand Down Expand Up @@ -153,12 +151,10 @@ public void run() {

LOG.info(testStatus + " (" + stopwatch + ") " + modeler.script + " " +
modeler.queryFilename);
if(++noOfCasesCompleted%100==0 && noOfCasesCompleted <= totalCases){
LOG.info("----------------------------------------------------------------------------------------------------------------");

LOG.info("Execution completed for "+(noOfCasesCompleted)+" out of "+
(totalCases)+" tests");
LOG.info("----------------------------------------------------------------------------------------------------------------\n");
if((++noOfCasesCompleted%100==0 && noOfCasesCompleted <= (totalCases*TestDriver.cmdParam.iterations*TestDriver.cmdParam.clones))||(noOfCasesCompleted>=totalCases && noOfCasesCompleted%totalCases==0)){
LOG.info("----------------------------------------------------------------------------------------------------------------\nExecution completed for "+(noOfCasesCompleted)+" out of "+
(totalCases*TestDriver.cmdParam.iterations*TestDriver.cmdParam.clones)+" tests\n----------------------------------------------------------------------------------------------------------------");

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
import java.util.concurrent.atomic.AtomicBoolean;

public class DrillTestScript implements DrillTest {
private static final Logger LOG = Logger.getLogger(DrillTestScript.class);

private static final Logger LOG = Logger.getLogger("DrillTestLogger");
private String query;
private String outputFilename;
private volatile TestStatus testStatus = TestStatus.PENDING;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
public enum ShellRunner implements Closeable {
INSTANCE;

private static final Logger LOG = LoggerFactory.getLogger(ShellRunner.class);
private ExecutorService executors = Executors.newCachedThreadPool();
private static final Logger LOG = LoggerFactory.getLogger("DrillTestLogger");
private ExecutorService executors = Executors.newCachedThreadPool();

public CmdConsOut execCmd(String cmd) {
Preconditions.checkArgument(!Strings.isNullOrEmpty(cmd), "cmd is invalid");
Expand Down
Loading

0 comments on commit 0335899

Please sign in to comment.