View Javadoc

1   /**
2    * Copyright (c) 2002-2011 "Neo Technology,"
3    * Network Engine for Objects in Lund AB [http://neotechnology.com]
4    *
5    * This file is part of Neo4j.
6    *
7    * Neo4j is free software: you can redistribute it and/or modify
8    * it under the terms of the GNU General Public License as published by
9    * the Free Software Foundation, either version 3 of the License, or
10   * (at your option) any later version.
11   *
12   * This program is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   * GNU General Public License for more details.
16   *
17   * You should have received a copy of the GNU General Public License
18   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19   */
20  package org.neo4j.server.logging;
21  
22  import org.mortbay.log.Logger;
23  
24  /**
25   * Simple wrapper over the neo4j native logger class for getting jetty to use
26   * our logging framework. See <a
27   * href="http://docs.codehaus.org/display/JETTY/Debugging">the Jetty Debug
28   * page</a> for more info.
29   * 
30   * @author Chris Gioran
31   * 
32   */
33  
34  public class JettyLoggerAdapter implements Logger
35  {
36      private org.neo4j.server.logging.Logger delegate;
37  
38      public JettyLoggerAdapter()
39      {
40          delegate = org.neo4j.server.logging.Logger.getLogger( "SYSTEM" );
41      }
42  
43      @Override
44      public void debug( String arg0, Throwable arg1 )
45      {
46          delegate.debug( arg0, arg1 );
47      }
48  
49      @Override
50      public void debug( String arg0, Object arg1, Object arg2 )
51      {
52          delegate.debug( arg0, arg1, arg2 );
53      }
54  
55      @Override
56      public Logger getLogger( String arg0 )
57      {
58          JettyLoggerAdapter newInstance = new JettyLoggerAdapter();
59          newInstance.delegate = org.neo4j.server.logging.Logger.getLogger( arg0 );
60          return newInstance;
61      }
62  
63      @Override
64      public void info( String arg0, Object arg1, Object arg2 )
65      {
66          delegate.info( arg0, arg1, arg2 );
67  
68      }
69  
70      @Override
71      public boolean isDebugEnabled()
72      {
73          return true;
74      }
75  
76      @Override
77      public void setDebugEnabled( boolean arg0 )
78      {
79      }
80  
81      @Override
82      public void warn( String arg0, Throwable arg1 )
83      {
84          delegate.warn( arg1 );
85      }
86  
87      @Override
88      public void warn( String arg0, Object arg1, Object arg2 )
89      {
90          delegate.warn( arg0, arg1, arg2 );
91  
92      }
93  }