如何配置scalatest以显示所有日志记录消息

时间:2014-08-09 08:41:24

标签: scalatest

我在DEBUG级别为控制台appender和文件追加器设置了log4j。但是只显示了Scalatest摘要。

正在运行的测试是在srce / catalyst模块中的项目下进行的。这是sql / catalyst / src / test / resources / log4j.properties

log4j.rootLogger=DEBUG, CA, FA

#Console Appender
log4j.appender.CA=org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern=%d{HH:mm:ss.SSS} %p %c: %m%n
log4j.appender.CA.Threshold =DEBUG 
log4j.appender.CA.target=System.err

#File Appender
log4j.appender.FA=org.apache.log4j.FileAppender
log4j.appender.FA.append=false
log4j.appender.FA.file=target/unit-tests.log
log4j.appender.FA.layout=org.apache.log4j.PatternLayout
log4j.appender.FA.layout.ConversionPattern=%d{HH:mm:ss.SSS} %p %c{1}: %m%n

# Set the logger level of File Appender to WARN
log4j.appender.FA.Threshold = INFO

# Some packages are noisy for no good reason.
log4j.additivity.org.apache.hadoop.hive.serde2.lazy.LazyStruct=false
log4j.logger.org.apache.hadoop.hive.serde2.lazy.LazyStruct=OFF

log4j.additivity.org.apache.hadoop.hive.metastore.RetryingHMSHandler=false
log4j.logger.org.apache.hadoop.hive.metastore.RetryingHMSHandler=OFF

log4j.additivity.hive.ql.metadata.Hive=false
log4j.logger.hive.ql.metadata.Hive=OFF

# Parquet related logging
log4j.logger.parquet.hadoop=WARN
log4j.logger.org.apache.spark.sql.parquet=INFO

1 个答案:

答案 0 :(得分:1)

答案似乎是:

 -DforkMode=never

否则不会显示日志记录语句。我在尝试修复另一个问题时发现了这个答案 - 断点没有得到尊重。使用上述选项打开单线程模式可以解决这两个问题。