1   /*
2    * Copyright (C) The DNA Group. All rights reserved.
3    *
4    * This software is published under the terms of the DNA
5    * Software License version 1.1, a copy of which has been included
6    * with this distribution in the LICENSE.txt file.
7    */
8   package org.codehaus.dna.impl;
9   
10  import org.apache.log4j.Appender;
11  import org.apache.log4j.Layout;
12  import org.apache.log4j.Level;
13  import org.apache.log4j.spi.ErrorHandler;
14  import org.apache.log4j.spi.Filter;
15  import org.apache.log4j.spi.LoggingEvent;
16  import org.apache.log4j.spi.ThrowableInformation;
17  
18  class MockAppender
19      implements Appender
20  {
21      boolean m_output;
22      Level m_priority;
23      String m_message;
24      Throwable m_throwable;
25  
26      public void doAppend( LoggingEvent event )
27      {
28          m_output = true;
29          m_priority = event.getLevel();
30          m_message = (String)event.getMessage();
31          final ThrowableInformation information = event.getThrowableInformation();
32          if( null != information )
33          {
34              m_throwable = information.getThrowable();
35          }
36      }
37  
38      public void addFilter( Filter filter )
39      {
40      }
41  
42      public Filter getFilter()
43      {
44          return null;
45      }
46  
47      public void clearFilters()
48      {
49      }
50  
51      public void close()
52      {
53      }
54  
55      public String getName()
56      {
57          return null;
58      }
59  
60      public void setErrorHandler( ErrorHandler errorHandler )
61      {
62      }
63  
64      public ErrorHandler getErrorHandler()
65      {
66          return null;
67      }
68  
69      public void setLayout( Layout layout )
70      {
71      }
72  
73      public Layout getLayout()
74      {
75          return null;
76      }
77  
78      public void setName( String classname )
79      {
80      }
81  
82      public boolean requiresLayout()
83      {
84          return false;
85      }
86  }