@@ -31,12 +31,13 @@ import java.util
3131import com .google .api .client .http .HttpStatusCodes
3232import com .sun .net .httpserver .{HttpExchange , HttpServer }
3333import org .apache .hadoop .conf .Configuration
34+ import org .apache .logging .log4j .scala .Logging
3435import org .apache .spark .sql .DataFrame
3536import org .json4s ._
3637import org .json4s .jackson .{JsonMethods , Serialization }
3738import sourcecode .Enclosing
3839
39- final class Py4JQueryDriver (backend : Backend ) extends Closeable {
40+ final class Py4JQueryDriver (backend : Backend ) extends Closeable with Logging {
4041
4142 private [this ] val flags : HailFeatureFlags = HailFeatureFlags .fromEnv()
4243 private [this ] val hcl = new HailClassLoader (getClass.getClassLoader)
@@ -77,7 +78,7 @@ final class Py4JQueryDriver(backend: Backend) extends Closeable {
7778 localTmpdir = tmp
7879 backend match {
7980 case s : SparkBackend if tmp != " file://" + s.sc.getConf.get(" spark.local.dir" , " " ) =>
80- log .warn(
81+ logger .warn(
8182 " Cannot modify Spark's local directory at runtime. " +
8283 " Please stop and re-initialize hail with 'spark.local.dir' " +
8384 " in your Spark configuration."
@@ -234,7 +235,7 @@ final class Py4JQueryDriver(backend: Backend) extends Closeable {
234235 def pyReadMultipleMatrixTables (jsonQuery : String ): util.List [MatrixIR ] =
235236 withExecuteContext(selfContainedExecution = false ) { ctx =>
236237 implicit val fmts : Formats = DefaultFormats
237- log .info(" pyReadMultipleMatrixTables: got query" )
238+ logger .info(" pyReadMultipleMatrixTables: got query" )
238239
239240 val kvs = JsonMethods .parse(jsonQuery).extract[Map [String , JValue ]]
240241 val paths = kvs(" paths" ).extract[IndexedSeq [String ]]
@@ -246,12 +247,12 @@ final class Py4JQueryDriver(backend: Backend) extends Closeable {
246247 val opts = NativeReaderOptions (intervalObjects, intervalPointType)
247248 val matrixReaders : util.List [MatrixIR ] =
248249 paths.map { p =>
249- log .info(s " creating MatrixRead node for $p" )
250+ logger .info(s " creating MatrixRead node for $p" )
250251 val mnr = MatrixNativeReader (ctx.fs, p, Some (opts))
251252 MatrixRead (mnr.fullMatrixTypeWithoutUIDs, false , false , mnr): MatrixIR
252253 }.asJava
253254
254- log .info(" pyReadMultipleMatrixTables: returning N matrix tables" )
255+ logger .info(" pyReadMultipleMatrixTables: returning N matrix tables" )
255256 matrixReaders
256257 }._1
257258
@@ -293,10 +294,10 @@ final class Py4JQueryDriver(backend: Backend) extends Closeable {
293294
294295 def pyGrepPrint (regex : String , files : Seq [String ], maxLines : Int ): Unit =
295296 fileAndLineCounts(regex, files, maxLines).foreach { case (file, lines) =>
296- info(s " $file: ${lines.length} ${plural(lines.length, " match" , " matches" )}: " )
297+ logger. info(s " $file: ${lines.length} ${plural(lines.length, " match" , " matches" )}: " )
297298 lines.map(_.value).foreach { line =>
298299 val (screen, logged) = line.truncatable().strings
299- log .info(" \t " + logged)
300+ logger .info(" \t " + logged)
300301 println(s " \t $screen" )
301302 }
302303 }
0 commit comments