I am using listener which is shown below to log in for testgag tests only in the console The listener wants to print the log and go to the full log shawl fulllog file. The full logs are going on the full log file, but getting both the full log and the listener class log in the console is getting both.
Listener Category:
SimpleListener applies to the public class ITestListener {Private Static Logger m_log = Logger.getLogger (SimpleListener.class); Finish on public zero (ITestContext itestcontext) {m_log.info (called "onFinish ()"); } Start at Public Zero (ITestContext itestcontext) {m_log.info (called "onStart ()"); }} My log4j property file:
log4j.rootLogger = INFO, FullLogAppender, ConsoleAppender log4j.logger.TestLog = information, BreakPointAppender #Console log Apader Log4j.appender.ConsoleAppender.layout = org.apache.log4j.PatternLayout log4j.appender.ConsoleAppender = org.apache.log4j.ConsoleAppender log 4j.appender.ConsoleAppender.layout.ConversionPattern =% d {ABSOLUTE}% 5p% c {1 }:% L -% m% n log4j.appender.ConsoleAppender.Target = System.out # full log Apader log4j.appender.FullLogAppender.layout = org.apache.log4j.PatternLayout log 4 j.appender.FullLogAppender.File = mfgLogs / FullLogs / FullLog.log log4j.appender.FullLogAppender = org.apache.log4j.RollingFileAppender log4j.appender.FullLogAppender.layout.ConversionPattern =% d% -5p% c% x-% M% N log4j.appender.FullLogAppender.Append = false December 12 12:41:11 2012 expected results in the console:
11: 29: 33,159 information simple Listnr: 15 - Onstart () 11: 29: 50,372 information simple Listnr: 31 - Rntast. ... 11: 30: 23,6 37 Information Simple Listener: 23 - Failed 11: 30: 24,402 Information Simple Listener: 12 - Onfinish () < Div class = "post-text" itemprop = "text"
Add a logger to your listener
log4j.logger.xxxx.SimpleListener = INFO, ConsoleAppender Xxxx SimpleListener is fully qualified for your audience Rg will be named;
-
If you do not want the listener's log to appear in the full log file, then set the additivity for the false
log4j.additivity. Xxxx.SimpleListener = false
No comments:
Post a Comment