View Javadoc

1   // ========================================================================
2   // Copyright (c) 2009-2009 Mort Bay Consulting Pty. Ltd.
3   // ------------------------------------------------------------------------
4   // All rights reserved. This program and the accompanying materials
5   // are made available under the terms of the Eclipse Public License v1.0
6   // and Apache License v2.0 which accompanies this distribution.
7   // The Eclipse Public License is available at
8   // http://www.eclipse.org/legal/epl-v10.html
9   // The Apache License v2.0 is available at
10  // http://www.opensource.org/licenses/apache2.0.php
11  // You may elect to redistribute this code under either of these licenses.
12  // ========================================================================
13  
14  package org.eclipse.jetty.util.log.jmx;
15  
16  import java.util.ArrayList;
17  import java.util.List;
18  
19  import org.eclipse.jetty.jmx.ObjectMBean;
20  import org.eclipse.jetty.util.log.Log;
21  
22  /* ------------------------------------------------------------ */
23  /**
24   */
25  public class LogMBean extends ObjectMBean
26  {
27  
28      public LogMBean(Object managedObject)
29      {
30          super(managedObject);
31      }
32  
33      public List<String> getLoggers()
34      {
35          List<String> keySet = new ArrayList<String>(Log.getLoggers().keySet());
36          return keySet;
37      }
38  
39      public boolean isDebugEnabled(String logger)
40      {
41          return Log.getLogger(logger).isDebugEnabled();
42      }
43  
44      public void setDebugEnabled(String logger, Boolean enabled)
45      {
46          Log.getLogger(logger).setDebugEnabled(enabled);
47      }
48  }