Package mx4j.log

Examples of mx4j.log.Logger


         setDaemon(true);
      }

      public void run()
      {
         Logger logger = getLogger();
         while (!isInterrupted())
         {
            try
            {
               int read = -1;
               while ((read = m_stream.read(m_buffer)) >= 0)
               {
                  if (logger.isEnabledFor(Logger.INFO)) logger.info(new String(m_buffer, 0, read));
               }
            }
            catch (InterruptedIOException x)
            {
               Thread.currentThread().interrupt();
               break;
            }
            catch (IOException x)
            {
               if (logger.isEnabledFor(Logger.INFO)) logger.info("Error while consuming process stream", x);
               break;
            }
         }
      }
View Full Code Here


      return Log.getLogger(getClass().getName());
   }

   public void onStartElement(String namespace, String localName, String prefix, Attributes attributes, DeserializationContext context) throws SAXException
   {
      Logger logger = getLogger();
      if (logger.isEnabledFor(Logger.TRACE))
      {
         logger.trace("Enter: " + getClass().getName() + ".onStartElement()");
         logger.trace("namespace: " + namespace);
         logger.trace("localName: " + localName);
         logger.trace("prefix: " + prefix);
      }
   }
View Full Code Here

      }
   }

   public SOAPHandler onStartChild(String namespace, String localName, String prefix, Attributes attributes, DeserializationContext context) throws SAXException
   {
      Logger logger = getLogger();
      if (logger.isEnabledFor(Logger.TRACE))
      {
         logger.trace("Enter: " + getClass().getName() + ".onStartChild()");
         logger.trace("namespace: " + namespace);
         logger.trace("localName: " + localName);
         logger.trace("prefix: " + prefix);
      }
/*
      if (context.isNil(attributes))
      {
         setChildValue(null, localName);
View Full Code Here

      return (SOAPHandler)deserializer;
   }

   public void setChildValue(Object value, Object hint) throws SAXException
   {
      Logger logger = getLogger();
      if (logger.isEnabledFor(Logger.TRACE))
      {
         logger.trace("Enter: " + getClass().getName() + ".setChildValue()");
         logger.trace("value: " + value);
         logger.trace("hint: " + hint);
      }
      onSetChildValue(value, hint);
   }
View Full Code Here

   protected abstract void onSetChildValue(Object value, Object hint) throws SAXException;

   public void onEndElement(String namespace, String localName, DeserializationContext context) throws SAXException
   {
      Logger logger = getLogger();
      if (logger.isEnabledFor(Logger.TRACE))
      {
         logger.trace("Enter: " + getClass().getName() + ".onEndElement()");
         logger.trace("namespace: " + namespace);
         logger.trace("localName: " + localName);
      }
      setValue(createObject());
   }
View Full Code Here

      }
   }

   private void configure(JMXServiceURL url, Map environment) throws IOException
   {
      Logger logger = getLogger();

      if (environment != null)
      {
         Object config = environment.get(HTTPConnectorServer.WEB_CONTAINER_CONFIGURATION);
         if (config instanceof String)
         {
            if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Configuring Jetty with configuration " + config);
            getServer().configure((String)config);

            // Be sure there is at least one listener on the port specified by the JMXServiceURL
            HttpListener[] listeners = getServer().getListeners();
            if (listeners != null)
            {
               boolean found = false;
               for (int i = 0; i < listeners.length; ++i)
               {
                  HttpListener listener = listeners[i];
                  if (listener.getPort() == url.getPort())
                  {
                     found = true;
                     break;
                  }
               }
               if (!found) throw new IOException("No listener configured with configuration " + config + " matches JMXServiceURL " + url);
               // Configured successfully, return
               if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Configured Jetty successfully with configuration " + config);
               return;
            }
            else
            {
               if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Jetty configuration " + config + " does not have any listener");
            }
         }
         else
         {
            if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Skipping Jetty configuration " + config + " (must be a String)");
         }
      }
      configureListener(url, environment);
   }
View Full Code Here

      configureListener(url, environment);
   }

   protected void configureListener(JMXServiceURL url, Map environment) throws IOException
   {
      Logger logger = getLogger();
      if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Configuring Jetty with a default listener on port " + url.getPort());
      getServer().addListener(":" + url.getPort());
   }
View Full Code Here

      synchronized (HTTPConnectorServer.class)
      {
         ConnectionManager manager = (ConnectionManager)instances.get(address);
         if (manager != null) return manager;

         Logger logger = Log.getLogger(HTTPConnectorServer.class.getName());
         if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Known HTTPConnectorServers bound at " + instances.keySet());
         return null;
      }
   }
View Full Code Here

         // so we can use this class' classloader
         cls = getClass().getClassLoader().loadClass(className);
      }
      catch (ClassNotFoundException x)
      {
         Logger logger = getLogger();
         if (logger.isEnabledFor(Logger.TRACE)) logger.trace("Cannot load Throwable class " + className, x);
      }

      if (cls == null) return fault;

      Object exception = null;
      if (message != null)
      {
         try
         {
            // Try to find the suitable constructor
            Constructor ctor = cls.getConstructor(new Class[]{String.class});
            exception = ctor.newInstance(new Object[]{message});
         }
         catch (Throwable x)
         {
            Logger logger = getLogger();
            if (logger.isEnabledFor(Logger.TRACE)) logger.trace("Cannot find constructor " + className + "(String message)", x);
         }
      }

      if (exception == null)
      {
         try
         {
            exception = cls.newInstance();
         }
         catch (Throwable x)
         {
            Logger logger = getLogger();
            if (logger.isEnabledFor(Logger.TRACE)) logger.trace("Cannot find constructor " + className + "()", x);
         }
      }

      // Handle JMX exceptions with special case constructors
      if (MBeanException.class.getName().equals(className))
      {
         exception = new MBeanException(null, message);
      }
      else if (RuntimeMBeanException.class.getName().equals(className))
      {
         exception = new RuntimeMBeanException(null, message);
      }

      if (!(exception instanceof Throwable))
      {
         Logger logger = getLogger();
         if (logger.isEnabledFor(Logger.TRACE)) logger.trace("Could not recreate exception thrown on server side: " + className);
         return fault;
      }

      return (Throwable)exception;
   }
View Full Code Here

      synchronized (this)
      {
         if (connections.containsKey(connectionId)) throw new IOException("Connection '" + connection + "' already connected");
         connections.put(connectionId, connection);

         Logger logger = getLogger();
         if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Added connection '" + connectionId + "', known connections are " + connections.keySet());
      }
   }
View Full Code Here

TOP

Related Classes of mx4j.log.Logger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.