我想在自动化脚本中同时使用WebDriverEventListner
和Log4j
。
我想为所有WebDriverEventListner
操作创建一个日志,为Log4j
操作创建不同的日志。
我有两个属性文件如下:
# for Log4j actions - userDefinedLog.properties
# Define the root logger
log4j.rootLogger=INFO, CONSOLE, HTML
# Define the appender
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.HTML=org.apache.log4j.FileAppender
#Define the file location
log4j.appender.HTML.File=./target/Log/userDefinedLog.html
#Define the layout and pattern
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.appender.HTML.layout=org.apache.log4j.HTMLLayout
log4j.appender.HTML.layout.Title=User Defined Log
log4j.appender.HTML.layout.LocationInfo=true
log4j.appender.FA.append=false
#for WebDriverEventListner actions - webDriverEventListner.properties
# Define the root logger
log4j.rootLogger=INFO, CONSOLE, HTML
# Define the appender
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.HTML=org.apache.log4j.FileAppender
#Define the file location
log4j.appender.HTML.File=./target/Log/eventListener.html
#Define the layout and pattern
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.appender.HTML.layout=org.apache.log4j.HTMLLayout
log4j.appender.HTML.layout.Title=WebDriver Event Listener Log
log4j.appender.HTML.layout.LocationInfo=true
log4j.appender.FA.append=false
现在我必须单独指定或启动这些属性文件到Log4j
和WebDriverEventListner
。
请帮我解决这个问题。