<HTML xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<HEAD><!-- Template generated by Exclaimer Mail Disclaimers on 06:11:31 Friday, 22 April 2016 -->
<STYLE type=text/css>P.ImprintUniqueID {
        MARGIN: 0cm 0cm 0pt
}
LI.ImprintUniqueID {
        MARGIN: 0cm 0cm 0pt
}
DIV.ImprintUniqueID {
        MARGIN: 0cm 0cm 0pt
}
TABLE.ImprintUniqueIDTable {
        MARGIN: 0cm 0cm 0pt
}
DIV.Section1 {
        page: Section1
}
</STYLE>

<!-- Template generated by Exclaimer Mail Disclaimers on 06:11:31 Friday, 22 April 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">P.ImprintUniqueID {
        MARGIN: 0cm 0cm 0pt
}
LI.ImprintUniqueID {
        MARGIN: 0cm 0cm 0pt
}
DIV.ImprintUniqueID {
        MARGIN: 0cm 0cm 0pt
}
TABLE.ImprintUniqueIDTable {
        MARGIN: 0cm 0cm 0pt
}
DIV.Section1 {
        page: Section1
}
</style>
<meta name="Generator" content="Microsoft Word 15 (filtered medium)" />
<style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Segoe UI";
        panose-1:2 11 5 2 4 2 4 2 2 3;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</HEAD>

<BODY lang="EN-US" link="#0563C1" vlink="#954F72">
<P class=ImprintUniqueID>
<p class="ImprintUniqueID"></p>
<div class="WordSection1">
<p class="MsoNormal"><span style=font-size:12.0pt>Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:12.0pt>Could you please help me on migrating from log4j to logback. I am using a layout and appender.<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:12.0pt>What I was trying to do is create a different log file for each thread.<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:12.0pt>I really appreciate any help from anyone.<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:12.0pt>Thank you so much in advance.<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:12.0pt>Below is my codes:<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style=font-size:12.0pt>Log4j version of the layout:<o:p></o:p></span></b></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>package</span></b><span style=font-size:12.0pt;color:black> com.selenium.reporting;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>import</span></b><span style=font-size:12.0pt;color:black> java.io.*;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>import</span></b><span style=font-size:12.0pt;color:black> java.nio.file.Paths;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>import</span></b><span style=font-size:12.0pt;color:black> java.text.SimpleDateFormat;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>import</span></b><span style=font-size:12.0pt;color:black> java.util.Date;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>import</span></b><span style=font-size:12.0pt;color:black> java.util.concurrent.ConcurrentHashMap;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>import</span></b><span style=font-size:12.0pt;color:black> org.apache.log4j.Level;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>import</span></b><span style=font-size:12.0pt;color:black> org.apache.log4j.Logger;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>import</span></b><span style=font-size:12.0pt;color:black> org.apache.log4j.PatternLayout;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>import</span></b><span style=font-size:12.0pt;color:black> org.apache.log4j.spi.LoggingEvent;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>import</span></b><span style=font-size:12.0pt;color:black> org.apache.log4j.spi.ThrowableInformation;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>import</span></b><span style=font-size:12.0pt;color:black> org.apache.commons.lang3.StringEscapeUtils;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>public</span></b><span style=font-size:12.0pt;color:black>
</span><b><span style=font-size:12.0pt;color:#7F0055>class</span></b><span style=font-size:12.0pt;color:black> ReportNGTestLayout
</span><b><span style=font-size:12.0pt;color:#7F0055>extends</span></b><span style=font-size:12.0pt;color:black> PatternLayout {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><b><span style=font-size:12.0pt;color:#7F0055>public</span></b><span style=font-size:12.0pt;color:black> ConcurrentHashMap<String, String>
</span><span style=font-size:12.0pt;color:#0000C0>threadTestName</span><span style=font-size:12.0pt;color:black> =
</span><b><span style=font-size:12.0pt;color:#7F0055>new</span></b><span style=font-size:12.0pt;color:black> ConcurrentHashMap<String, String>();</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><b><span style=font-size:12.0pt;color:#7F0055>public</span></b><span style=font-size:12.0pt;color:black>
</span><b><span style=font-size:12.0pt;color:#7F0055>int</span></b><span style=font-size:12.0pt;color:black>
</span><span style=font-size:12.0pt;color:#0000C0>consoleLevel</span><span style=font-size:12.0pt;color:black> = Level.</span><i><span style=font-size:12.0pt;color:#0000C0>DEBUG_INT</span></i><span style=font-size:12.0pt;color:black>;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><b><span style=font-size:12.0pt;color:#7F0055>public</span></b><span style=font-size:12.0pt;color:black> String
</span><span style=font-size:12.0pt;color:#0000C0>reportParentFolder</span><span style=font-size:12.0pt;color:black> =
</span><span style=font-size:12.0pt;color:#2A00FF>"test-output"</span><span style=font-size:12.0pt;color:black>;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><b><span style=font-size:12.0pt;color:#7F0055>public</span></b><span style=font-size:12.0pt;color:black> String
</span><span style=font-size:12.0pt;color:#0000C0>executionDate</span><span style=font-size:12.0pt;color:black>;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><span style=font-size:12.0pt;color:#646464>@Override</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><b><span style=font-size:12.0pt;color:#7F0055>public</span></b><span style=font-size:12.0pt;color:black> String format(LoggingEvent event) {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                        String logline =
</span><span style=font-size:12.0pt;color:#2A00FF>""</span><span style=font-size:12.0pt;color:black>;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                        String logFileName;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                        String logPrefix;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                        String consolePrefix;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                       
</span><span style=font-size:12.0pt;color:#3F7F5F>// Get test name by thread id</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                        String testName =
</span><span style=font-size:12.0pt;color:#0000C0>threadTestName</span><span style=font-size:12.0pt;color:black>.get(Long.<i>toString</i>(Thread.<i>currentThread</i>().getId()));</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                        String curThreadName = Thread.<i>currentThread</i>().getName();</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                       
</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                       
</span><b><span style=font-size:12.0pt;color:#7F0055>if</span></b><span style=font-size:12.0pt;color:black> (testName ==
</span><b><span style=font-size:12.0pt;color:#7F0055>null</span></b><span style=font-size:12.0pt;color:black>) {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                   
</span><span style=font-size:12.0pt;color:#3F7F5F>// log to a file by thread name, if no test name</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    consolePrefix = logPrefix =
</span><span style=font-size:12.0pt;color:#2A00FF>" "</span><span style=font-size:12.0pt;color:black> + curThreadName +
</span><span style=font-size:12.0pt;color:#2A00FF>" : "</span><span style=font-size:12.0pt;color:black>;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    logFileName = Paths.<i>get</i>(</span><span style=font-size:12.0pt;color:#0000C0>reportParentFolder</span><span style=font-size:12.0pt;color:black>,
</span><span style=font-size:12.0pt;color:#2A00FF>"main.log"</span><span style=font-size:12.0pt;color:black>).toString();</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                        }
</span><b><span style=font-size:12.0pt;color:#7F0055>else</span></b><span style=font-size:12.0pt;color:black> {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                   
</span><span style=font-size:12.0pt;color:#3F7F5F>// log to <test name>.log file</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    logFileName = Paths.<i>get</i>(</span><span style=font-size:12.0pt;color:#0000C0>reportParentFolder</span><span style=font-size:12.0pt;color:black>,
</span><span style=font-size:12.0pt;color:#2A00FF>"DetailReport"</span><span style=font-size:12.0pt;color:black>,
</span><span style=font-size:12.0pt;color:#2A00FF>"Attachments"</span><span style=font-size:12.0pt;color:black>, testName +
</span><span style=font-size:12.0pt;color:#2A00FF>".log"</span><span style=font-size:12.0pt;color:black>).toString();</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    logPrefix =
</span><span style=font-size:12.0pt;color:#2A00FF>" : "</span><span style=font-size:12.0pt;color:black>;                                  
</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                   
</span><b><span style=font-size:12.0pt;color:#7F0055>if</span></b><span style=font-size:12.0pt;color:black> (!curThreadName.contains(</span><span style=font-size:12.0pt;color:#2A00FF>"pool"</span><span style=font-size:12.0pt;color:black>) && !curThreadName.equalsIgnoreCase(</span><span style=font-size:12.0pt;color:#2A00FF>"TestNG"</span><span style=font-size:12.0pt;color:black>))</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                logPrefix = logPrefix +
</span><span style=font-size:12.0pt;color:#2A00FF>"["</span><span style=font-size:12.0pt;color:black> + curThreadName +
</span><span style=font-size:12.0pt;color:#2A00FF>"] "</span><span style=font-size:12.0pt;color:black>;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    consolePrefix = testName + logPrefix;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                        }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                   
</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                       
</span><span style=font-size:12.0pt;color:#3F7F5F>// Console output</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                       
</span><b><span style=font-size:12.0pt;color:#7F0055>if</span></b><span style=font-size:12.0pt;color:black> (event.getLevel().toInt() >=
</span><span style=font-size:12.0pt;color:#0000C0>consoleLevel</span><span style=font-size:12.0pt;color:black>) {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                   
</span><b><span style=font-size:12.0pt;color:#7F0055>if</span></b><span style=font-size:12.0pt;color:black> (event.getLevel().toInt() >
</span><span style=font-size:12.0pt;color:#0000C0>consoleLevel</span><span style=font-size:12.0pt;color:black>)</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                consolePrefix += event.getLevel() +
</span><span style=font-size:12.0pt;color:#2A00FF>" : "</span><span style=font-size:12.0pt;color:black>;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    String consoleMessage =
</span><b><span style=font-size:12.0pt;color:#7F0055>new</span></b><span style=font-size:12.0pt;color:black> SimpleDateFormat(</span><span style=font-size:12.0pt;color:#2A00FF>"HH:mm:ss.SSS "</span><span style=font-size:12.0pt;color:black>).format(</span><b><span style=font-size:12.0pt;color:#7F0055>new</span></b><span style=font-size:12.0pt;color:black>
 Date(event.</span><span style=font-size:12.0pt;color:#0000C0>timeStamp</span><span style=font-size:12.0pt;color:black>))</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                            + consolePrefix + event.getMessage();</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                   
</span><b><span style=font-size:12.0pt;color:#7F0055>if</span></b><span style=font-size:12.0pt;color:black> (event.getLevel().toInt() >= Level.</span><i><span style=font-size:12.0pt;color:#0000C0>INFO_INT</span></i><span style=font-size:12.0pt;color:black>)</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                consoleMessage =
</span><span style=font-size:12.0pt;color:#2A00FF>"\n"</span><span style=font-size:12.0pt;color:black> + consoleMessage;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    System.</span><i><span style=font-size:12.0pt;color:#0000C0>out</span></i><span style=font-size:12.0pt;color:black>.println(consoleMessage);</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                        }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                       
</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                       
</span><b><span style=font-size:12.0pt;color:#7F0055>if</span></b><span style=font-size:12.0pt;color:black> (!</span><span style=font-size:12.0pt;color:#0000C0>reportParentFolder</span><span style=font-size:12.0pt;color:black>.isEmpty()){</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                   
</span><span style=font-size:12.0pt;color:#3F7F5F>// Create log file if needed</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    File logFile =
</span><b><span style=font-size:12.0pt;color:#7F0055>new</span></b><span style=font-size:12.0pt;color:black> File(logFileName);</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                   
</span><b><span style=font-size:12.0pt;color:#7F0055>if</span></b><span style=font-size:12.0pt;color:black> (!logFile.exists()){</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                               
</span><b><span style=font-size:12.0pt;color:#7F0055>try</span></b><span style=font-size:12.0pt;color:black> {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                            File parentFolder =
</span><b><span style=font-size:12.0pt;color:#7F0055>new</span></b><span style=font-size:12.0pt;color:black> File(logFile.getParent());</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                            parentFolder.mkdirs();</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                            logFile.createNewFile();</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                }
</span><b><span style=font-size:12.0pt;color:#7F0055>catch</span></b><span style=font-size:12.0pt;color:black> (IOException e) {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                           
</span><span style=font-size:12.0pt;color:#3F7F5F>// </span><b><span style=font-size:12.0pt;color:#7F9FBF>TODO</span></b><span style=font-size:12.0pt;color:#3F7F5F> Auto-generated catch block</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                            e.printStackTrace();</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                   
</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                   
</span><span style=font-size:12.0pt;color:#3F7F5F>// Append to log file</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                   
</span><b><span style=font-size:12.0pt;color:#7F0055>try</span></b><span style=font-size:12.0pt;color:black>(PrintWriter out =
</span><b><span style=font-size:12.0pt;color:#7F0055>new</span></b><span style=font-size:12.0pt;color:black> PrintWriter(</span><b><span style=font-size:12.0pt;color:#7F0055>new</span></b><span style=font-size:12.0pt;color:black> BufferedWriter(</span><b><span style=font-size:12.0pt;color:#7F0055>new</span></b><span style=font-size:12.0pt;color:black>
 FileWriter(logFile, </span><b><span style=font-size:12.0pt;color:#7F0055>true</span></b><span style=font-size:12.0pt;color:black>)))) {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                        out.println(</span><b><span style=font-size:12.0pt;color:#7F0055>new</span></b><span style=font-size:12.0pt;color:black>
 SimpleDateFormat(</span><span style=font-size:12.0pt;color:#2A00FF>"yyyy-MM-dd HH:mm:ss.SSS"</span><span style=font-size:12.0pt;color:black>)</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                                                                .format(</span><b><span style=font-size:12.0pt;color:#7F0055>new</span></b><span style=font-size:12.0pt;color:black>
 Date(event.</span><span style=font-size:12.0pt;color:#0000C0>timeStamp</span><span style=font-size:12.0pt;color:black>)) +</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                                       
</span><span style=font-size:12.0pt;color:#2A00FF>" ["</span><span style=font-size:12.0pt;color:black> + event.getLevel() +
</span><span style=font-size:12.0pt;color:#2A00FF>"]"</span><span style=font-size:12.0pt;color:black> +</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                                        logPrefix +</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                                        event.getMessage());</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    }
</span><b><span style=font-size:12.0pt;color:#7F0055>catch</span></b><span style=font-size:12.0pt;color:black> (IOException e) {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                        e.printStackTrace();</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                        }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                       
</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                       
</span><span style=font-size:12.0pt;color:#3F7F5F>// Append to old report if INFO message</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                       
</span><b><span style=font-size:12.0pt;color:#7F0055>if</span></b><span style=font-size:12.0pt;color:black> (event.getLevel().toInt() == Level.</span><i><span style=font-size:12.0pt;color:#0000C0>INFO_INT</span></i><span style=font-size:12.0pt;color:black>)
 {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                   
</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    String newMsg = StringEscapeUtils.<i>escapeHtml3</i>(event.getMessage()</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                            .toString());</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    Throwable t =
</span><b><span style=font-size:12.0pt;color:#7F0055>null</span></b><span style=font-size:12.0pt;color:black>;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    ThrowableInformation ti = event.getThrowableInformation();</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                   
</span><b><span style=font-size:12.0pt;color:#7F0055>if</span></b><span style=font-size:12.0pt;color:black> (ti !=
</span><b><span style=font-size:12.0pt;color:#7F0055>null</span></b><span style=font-size:12.0pt;color:black>) {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                t = ti.getThrowable();</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    LoggingEvent encodedEvent =
</span><b><span style=font-size:12.0pt;color:#7F0055>new</span></b><span style=font-size:12.0pt;color:black> LoggingEvent(</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                            event.</span><span style=font-size:12.0pt;color:#0000C0>fqnOfCategoryClass</span><span style=font-size:12.0pt;color:black>,
 Logger.<i>getLogger</i>(event</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                                                    .getLoggerName()), event.</span><span style=font-size:12.0pt;color:#0000C0>timeStamp</span><span style=font-size:12.0pt;color:black>,</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                            event.getLevel(), newMsg, t);</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    String baseFmt =
</span><b><span style=font-size:12.0pt;color:#7F0055>super</span></b><span style=font-size:12.0pt;color:black>.format(encodedEvent).replace(</span><span style=font-size:12.0pt;color:#2A00FF>"@{{"</span><span style=font-size:12.0pt;color:black>,
</span><span style=font-size:12.0pt;color:#2A00FF>"<"</span><span style=font-size:12.0pt;color:black>)</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                            .replace(</span><span style=font-size:12.0pt;color:#2A00FF>"@}}"</span><span style=font-size:12.0pt;color:black>,
</span><span style=font-size:12.0pt;color:#2A00FF>">"</span><span style=font-size:12.0pt;color:black>);</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    logline =
</span><span style=font-size:12.0pt;color:#2A00FF>"<div class=step"</span><span style=font-size:12.0pt;color:black> +
</span><span style=font-size:12.0pt;color:#2A00FF>"event.level.toString()"</span><span style=font-size:12.0pt;color:black> +
</span><span style=font-size:12.0pt;color:#2A00FF>">"</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                            + baseFmt +
</span><span style=font-size:12.0pt;color:#2A00FF>"</div><br/>"</span><span style=font-size:12.0pt;color:black>;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                   
</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                        }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                       
</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                       
</span><b><span style=font-size:12.0pt;color:#7F0055>return</span></b><span style=font-size:12.0pt;color:black> logline;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>            }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>}</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style=font-size:12.0pt>Logback version of the layout:<o:p></o:p></span></b></p>
<p class="MsoNormal"><span style=font-size:12.0pt>It is the same as the Log4j version but the only difference is I am  extending
</span><span style=font-size:12.0pt;color:black>ch.qos.logback.classic.PatternLayout and I use ILoggingEvent in the format instead of LoggingEvent.
<o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:10.0pt;font-family:Consolas;color:black>      
</span><span style=font-size:10.0pt;font-family:Consolas;color:#3F7F5F>//@Override</span><span style=font-size:10.0pt;font-family:Consolas><o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:10.0pt;font-family:Consolas;color:black>      
</span><b><span style=font-size:10.0pt;font-family:Consolas;color:#7F0055>public</span></b><span style=font-size:10.0pt;font-family:Consolas;color:black> String format(ILoggingEvent
</span><span style=font-size:10.0pt;font-family:Consolas;color:#6A3E3E>event</span><span style=font-size:10.0pt;font-family:Consolas;color:black>) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal"><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style=font-size:12.0pt>Log4j version of the appender:<o:p></o:p></span></b></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>package</span></b><span style=font-size:12.0pt;color:black> com.selenium.reporting;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>import</span></b><span style=font-size:12.0pt;color:black> org.apache.log4j.AppenderSkeleton;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>import</span></b><span style=font-size:12.0pt;color:black> org.apache.log4j.spi.LoggingEvent;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>import</span></b><span style=font-size:12.0pt;color:black> org.testng.Reporter;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>public</span></b><span style=font-size:12.0pt;color:black>
</span><b><span style=font-size:12.0pt;color:#7F0055>class</span></b><span style=font-size:12.0pt;color:black> TestNGAppender
</span><b><span style=font-size:12.0pt;color:#7F0055>extends</span></b><span style=font-size:12.0pt;color:black> AppenderSkeleton {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><b><span style=font-size:12.0pt;color:#7F0055>public</span></b><span style=font-size:12.0pt;color:black> TestNGAppender(String name) {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                       
</span><b><span style=font-size:12.0pt;color:#7F0055>super</span></b><span style=font-size:12.0pt;color:black>();</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                        setName(name);</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>            }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><span style=font-size:12.0pt;color:#646464>@Override</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><b><span style=font-size:12.0pt;color:#7F0055>protected</span></b><span style=font-size:12.0pt;color:black>
</span><b><span style=font-size:12.0pt;color:#7F0055>void</span></b><span style=font-size:12.0pt;color:black> append(LoggingEvent event) {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                        String logMessage =
</span><span style=font-size:12.0pt;color:#0000C0>layout</span><span style=font-size:12.0pt;color:black>.format(event);</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                       
</span><b><span style=font-size:12.0pt;color:#7F0055>if</span></b><span style=font-size:12.0pt;color:black> (!logMessage.isEmpty()) {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    Reporter.<i>log</i>(logMessage);</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    String[] thorwableCrap = event.getThrowableStrRep();</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                   
</span><b><span style=font-size:12.0pt;color:#7F0055>if</span></b><span style=font-size:12.0pt;color:black> (thorwableCrap !=
</span><b><span style=font-size:12.0pt;color:#7F0055>null</span></b><span style=font-size:12.0pt;color:black>) {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                                Reporter.<i>log</i>(thorwableCrap.toString());</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                        }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>            }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>   
</span><span style=font-size:12.0pt;color:#646464>@Override</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>   
</span><b><span style=font-size:12.0pt;color:#7F0055>public</span></b><span style=font-size:12.0pt;color:black>
</span><b><span style=font-size:12.0pt;color:#7F0055>void</span></b><span style=font-size:12.0pt;color:black> close() {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>    }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>   
</span><span style=font-size:12.0pt;color:#646464>@Override</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>   
</span><b><span style=font-size:12.0pt;color:#7F0055>public</span></b><span style=font-size:12.0pt;color:black>
</span><b><span style=font-size:12.0pt;color:#7F0055>boolean</span></b><span style=font-size:12.0pt;color:black> requiresLayout() {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>       
</span><b><span style=font-size:12.0pt;color:#7F0055>return</span></b><span style=font-size:12.0pt;color:black>
</span><b><span style=font-size:12.0pt;color:#7F0055>true</span></b><span style=font-size:12.0pt;color:black>;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>    }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>}</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal"><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style=font-size:12.0pt>Logback version of the appender:<o:p></o:p></span></b></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>package</span></b><span style=font-size:12.0pt;color:black> com.selenium.reporting;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>import</span></b><span style=font-size:12.0pt;color:black> org.testng.Reporter;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>import</span></b><span style=font-size:12.0pt;color:black> ch.qos.logback.classic.spi.ILoggingEvent;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>import</span></b><span style=font-size:12.0pt;color:black> ch.qos.logback.core.AppenderBase;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:#7F0055>public</span></b><span style=font-size:12.0pt;color:black>
</span><b><span style=font-size:12.0pt;color:#7F0055>class</span></b><span style=font-size:12.0pt;color:black> TestNGAppender
</span><b><span style=font-size:12.0pt;color:#7F0055>extends</span></b><span style=font-size:12.0pt;color:black> AppenderBase<ILoggingEvent> {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><b><span style=font-size:12.0pt;color:#7F0055>public</span></b><span style=font-size:12.0pt;color:black> TestNGAppender(String
</span><span style=font-size:12.0pt;color:#6A3E3E>name</span><span style=font-size:12.0pt;color:black>) {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                       
</span><b><span style=font-size:12.0pt;color:#7F0055>super</span></b><span style=font-size:12.0pt;color:black>();</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                        setName(</span><span style=font-size:12.0pt;color:#6A3E3E>name</span><span style=font-size:12.0pt;color:black>);</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>            }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><span style=font-size:12.0pt;color:#3F7F5F>//@Override</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><b><span style=font-size:12.0pt;color:#7F0055>protected</span></b><span style=font-size:12.0pt;color:black>
</span><b><span style=font-size:12.0pt;color:#7F0055>void</span></b><span style=font-size:12.0pt;color:black> append(ILoggingEvent
</span><span style=font-size:12.0pt;color:#6A3E3E>event</span><span style=font-size:12.0pt;color:black>) {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                        String
</span><span style=font-size:12.0pt;color:#6A3E3E>logMessage</span><span style=font-size:12.0pt;color:black> =
</span><b><span style=font-size:12.0pt;color:#7F0055>this</span></b><span style=font-size:12.0pt;color:black>.<u>layout</u>.format(</span><span style=font-size:12.0pt;color:#6A3E3E>event</span><span style=font-size:12.0pt;color:black>);  =</span><span style=font-size:12.0pt;font-family:Wingdings;color:black>è</span><span style=font-size:12.0pt;color:black>
</span><span style=font-size:12.0pt;color:red>in here layout cannot be resolved. How can I access the format method in the ReportNGTestLayout class?<o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                       
</span><b><span style=font-size:12.0pt;color:#7F0055>if</span></b><span style=font-size:12.0pt;color:black> (!</span><span style=font-size:12.0pt;color:#6A3E3E>logMessage</span><span style=font-size:12.0pt;color:black>.isEmpty()) {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                                    Reporter.<i>log</i>(</span><span style=font-size:12.0pt;color:#6A3E3E>logMessage</span><span style=font-size:12.0pt;color:black>);</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>                        }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>            }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>  
</span><span style=font-size:12.0pt;color:#646464>@Override</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>   
</span><b><span style=font-size:12.0pt;color:#7F0055>public</span></b><span style=font-size:12.0pt;color:black>
</span><b><span style=font-size:12.0pt;color:#7F0055>void</span></b><span style=font-size:12.0pt;color:black> stop() {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>    }</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:#3F7F5F>/*    @Override</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:#3F7F5F>    public boolean requiresLayout() {</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:#3F7F5F>        return true;</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:#3F7F5F>    }*/</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>  
</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>   }<o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><b><span style=font-size:12.0pt;color:black>This is how I setup the appender and layout in the logger:<o:p></o:p></span></b></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-indent:.5in;text-autospace:none><span style=font-size:12.0pt;color:black>Logger
</span><span style=font-size:12.0pt;color:#6A3E3E>rootLogger</span><span style=font-size:12.0pt;color:black> = (Logger)LoggerFactory.<i>getLogger</i>(Logger.</span><b><i><span style=font-size:12.0pt;color:#0000C0>ROOT_LOGGER_NAME</span></i></b><span style=font-size:12.0pt;color:black>);</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>            TestNGAppender
</span><span style=font-size:12.0pt;color:#6A3E3E>testNGAppender</span><span style=font-size:12.0pt;color:black> =
</span><b><span style=font-size:12.0pt;color:#7F0055>new</span></b><span style=font-size:12.0pt;color:black> TestNGAppender(</span><span style=font-size:12.0pt;color:#2A00FF>"TestNG"</span><span style=font-size:12.0pt;color:black>);</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>            ReportNGTestLayout
</span><span style=font-size:12.0pt;color:#6A3E3E>logLayout</span><span style=font-size:12.0pt;color:black> =
</span><b><span style=font-size:12.0pt;color:#7F0055>new</span></b><span style=font-size:12.0pt;color:black> ReportNGTestLayout();</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><span style=font-size:12.0pt;color:#6A3E3E>logLayout</span><span style=font-size:12.0pt;color:black>.</span><span style=font-size:12.0pt;color:#0000C0>executionDate</span><span style=font-size:12.0pt;color:black> =
</span><b><span style=font-size:12.0pt;color:#7F0055>new</span></b><span style=font-size:12.0pt;color:black> SimpleDateFormat(</span><span style=font-size:12.0pt;color:#2A00FF>"MM-dd-yyyy-HH-mm"</span><span style=font-size:12.0pt;color:black>).format(</span><b><span style=font-size:12.0pt;color:#7F0055>new</span></b><span style=font-size:12.0pt;color:black>
 Date());</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>       
</span><span style=font-size:12.0pt;color:#6A3E3E>logLayout</span><span style=font-size:12.0pt;color:black>.</span><span style=font-size:12.0pt;color:#0000C0>reportParentFolder</span><span style=font-size:12.0pt;color:black> = Paths.<i>get</i>(System.<i>getProperty</i>(</span><span style=font-size:12.0pt;color:#2A00FF>"reportRootPath"</span><span style=font-size:12.0pt;color:black>),
</span><span style=font-size:12.0pt;color:#6A3E3E>logLayout</span><span style=font-size:12.0pt;color:black>.</span><span style=font-size:12.0pt;color:#0000C0>executionDate</span><span style=font-size:12.0pt;color:black>).toString();</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>       
</span><span style=font-size:12.0pt;color:#6A3E3E>logLayout</span><span style=font-size:12.0pt;color:black>.</span><span style=font-size:12.0pt;color:#0000C0>consoleLevel</span><span style=font-size:12.0pt;color:black> = Level.<i>toLevel</i>(</span><span style=font-size:12.0pt;color:#6A3E3E>logLevel</span><span style=font-size:12.0pt;color:black>.toUpperCase(),
 Level.</span><b><i><span style=font-size:12.0pt;color:#0000C0>DEBUG</span></i></b><span style=font-size:12.0pt;color:black>).toInt();</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>       
</span><span style=font-size:12.0pt;color:#6A3E3E>testNGAppender</span><span style=font-size:12.0pt;color:black>.<u>setLayout</u>(</span><span style=font-size:12.0pt;color:#6A3E3E>logLayout</span><span style=font-size:12.0pt;color:black>);
</span><span style=font-size:12.0pt;font-family:Wingdings;color:black>è</span><span style=font-size:12.0pt;color:black>
</span><span style=font-size:12.0pt;color:red>I am also having an error on this line.</span><span style=font-size:12.0pt;color:red> The method setLayout(ReportNGTestLayout) is undefined for the type TestNGAppender</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><span style=font-size:12.0pt;color:#6A3E3E>testNGAppender</span><span style=font-size:12.0pt;color:black>.start();</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>           
</span><span style=font-size:12.0pt;color:#6A3E3E>rootLogger</span><span style=font-size:12.0pt;color:black>.addAppender(</span><span style=font-size:12.0pt;color:#6A3E3E>testNGAppender</span><span style=font-size:12.0pt;color:black>);</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:12.0pt;color:black>       
</span><b><i><span style=font-size:12.0pt;color:#0000C0>logger</span></i></b><span style=font-size:12.0pt;color:black>.debug(</span><span style=font-size:12.0pt;color:#2A00FF>"Log4j appender configuration is successful !!"</span><span style=font-size:12.0pt;color:black>);
</span><span style=font-size:12.0pt><o:p></o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:10.0pt;font-family:Consolas><o:p> </o:p></span></p>
<p class="MsoNormal" style=text-autospace:none><span style=font-size:10.0pt;font-family:Consolas><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p></p>
<p class="ImprintUniqueID"> </p>
<p class="ImprintUniqueID"><font color="#a5a5a5">----------------------------<br/>
This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient of this e-mail (even if the e-mail address above is yours), (i) you may
 not use, copy or retransmit it, (ii) please delete this message and (iii) please notify the sender immediately. Any disclosure, copying, or distribution of this message or the taking of any action based on it, is strictly prohibited.<br/>
----------------------------<br/>
</font><br/>
</p>
<p class="ImprintUniqueID"></p>
</P>
<P class=ImprintUniqueID> </P>
<P class=ImprintUniqueID><FONT color=#a5a5a5>----------------------------<BR/>This message (including any 
attachments) contains confidential information intended for a specific 
individual and purpose, and is protected by law. If you are not the intended 
recipient of this e-mail (even if the e-mail address above is yours), (i) you 
may not use, copy or retransmit it, (ii) please delete this message and (iii) 
please notify the sender immediately. Any disclosure, copying, or distribution 
of this message or the taking of any action based on it, is strictly 
prohibited.<BR/>----------------------------<BR/></FONT><BR/></P>
<P class=ImprintUniqueID></P></BODY>
</HTML>