Java Code Examples for org.mortbay.log.Log#debug()

The following examples show how to use org.mortbay.log.Log#debug() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JettyConfiguration.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Set up the classloader for the webapp, using the various parts of the Maven project
 *
 * @see org.mortbay.jetty.webapp.Configuration#configureClassLoader()
 */
public void configureClassLoader() throws Exception {
    if (classPathFiles != null) {
        Log.debug("Setting up classpath ...");

        //put the classes dir and all dependencies into the classpath
        for (File classPathFile : classPathFiles) {
            ((WebAppClassLoader) getWebAppContext().getClassLoader()).addClassPath(
                    classPathFile.getCanonicalPath());
        }

        if (Log.isDebugEnabled()) {
            Log.debug("Classpath = " + LazyList.array2List(
                    ((URLClassLoader) getWebAppContext().getClassLoader()).getURLs()));
        }
    } else {
        super.configureClassLoader();
    }
}
 
Example 2
Source File: JettyConfiguration.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Set up the classloader for the webapp, using the various parts of the Maven project
 *
 * @see org.mortbay.jetty.webapp.Configuration#configureClassLoader()
 */
public void configureClassLoader() throws Exception {
    if (classPathFiles != null) {
        Log.debug("Setting up classpath ...");

        //put the classes dir and all dependencies into the classpath
        for (File classPathFile : classPathFiles) {
            ((WebAppClassLoader) getWebAppContext().getClassLoader()).addClassPath(
                    classPathFile.getCanonicalPath());
        }

        if (Log.isDebugEnabled()) {
            Log.debug("Classpath = " + LazyList.array2List(
                    ((URLClassLoader) getWebAppContext().getClassLoader()).getURLs()));
        }
    } else {
        super.configureClassLoader();
    }
}
 
Example 3
Source File: JettyConfiguration.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Set up the classloader for the webapp, using the various parts of the Maven project
 *
 * @see org.mortbay.jetty.webapp.Configuration#configureClassLoader()
 */
public void configureClassLoader() throws Exception {
    if (classPathFiles != null) {
        Log.debug("Setting up classpath ...");

        //put the classes dir and all dependencies into the classpath
        for (File classPathFile : classPathFiles) {
            ((WebAppClassLoader) getWebAppContext().getClassLoader()).addClassPath(
                    classPathFile.getCanonicalPath());
        }

        if (Log.isDebugEnabled()) {
            Log.debug("Classpath = " + LazyList.array2List(
                    ((URLClassLoader) getWebAppContext().getClassLoader()).getURLs()));
        }
    } else {
        super.configureClassLoader();
    }
}
 
Example 4
Source File: JettyConfiguration.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Set up the classloader for the webapp, using the various parts of the Maven project
 *
 * @see org.mortbay.jetty.webapp.Configuration#configureClassLoader()
 */
public void configureClassLoader() throws Exception {
    if (classPathFiles != null) {
        Log.debug("Setting up classpath ...");

        //put the classes dir and all dependencies into the classpath
        for (File classPathFile : classPathFiles) {
            ((WebAppClassLoader) getWebAppContext().getClassLoader()).addClassPath(
                    classPathFile.getCanonicalPath());
        }

        if (Log.isDebugEnabled()) {
            Log.debug("Classpath = " + LazyList.array2List(
                    ((URLClassLoader) getWebAppContext().getClassLoader()).getURLs()));
        }
    } else {
        super.configureClassLoader();
    }
}
 
Example 5
Source File: FileUtil.java    From RDFS with Apache License 2.0 6 votes vote down vote up
/**
 * Change the permissions on a file / directory, recursively, if
 * needed.
 * @param filename name of the file whose permissions are to change
 * @param perm permission string
 * @param recursive true, if permissions should be changed recursively
 * @return the exit code from the command.
 * @throws IOException
 * @throws InterruptedException
 */
public static int chmod(String filename, String perm, boolean recursive)
                          throws IOException, InterruptedException {
  StringBuffer cmdBuf = new StringBuffer();
  cmdBuf.append("chmod ");
  if (recursive) {
    cmdBuf.append("-R ");
  }
  cmdBuf.append(perm).append(" ");
  cmdBuf.append(filename);
  String[] shellCmd = {"bash", "-c" ,cmdBuf.toString()};
  ShellCommandExecutor shExec = new ShellCommandExecutor(shellCmd);
  try {
    shExec.execute();
  }catch(IOException e) {
    if(Log.isDebugEnabled()) {
      Log.debug("Error while changing permission : " + filename 
          +" Exception: " + StringUtils.stringifyException(e));
    }
  }
  return shExec.getExitCode();
}
 
Example 6
Source File: JettyConfiguration.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
protected URL findWebXml() throws IOException {
    //if an explicit web.xml file has been set (eg for jetty:run) then use it
    if (webXmlFile != null && webXmlFile.exists()) {
        return webXmlFile.toURI().toURL();
    }

    //if we haven't overridden location of web.xml file, use the
    //standard way of finding it
    Log.debug("Looking for web.xml file in WEB-INF");
    return super.findWebXml();
}
 
Example 7
Source File: JettyConfiguration.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
protected URL findWebXml() throws IOException {
    //if an explicit web.xml file has been set (eg for jetty:run) then use it
    if (webXmlFile != null && webXmlFile.exists()) {
        return webXmlFile.toURI().toURL();
    }

    //if we haven't overridden location of web.xml file, use the
    //standard way of finding it
    Log.debug("Looking for web.xml file in WEB-INF");
    return super.findWebXml();
}
 
Example 8
Source File: JettyConfiguration.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
protected URL findWebXml() throws IOException {
    //if an explicit web.xml file has been set (eg for jetty:run) then use it
    if (webXmlFile != null && webXmlFile.exists()) {
        return webXmlFile.toURI().toURL();
    }

    //if we haven't overridden location of web.xml file, use the
    //standard way of finding it
    Log.debug("Looking for web.xml file in WEB-INF");
    return super.findWebXml();
}
 
Example 9
Source File: JettyConfiguration.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
protected URL findWebXml() throws IOException {
    //if an explicit web.xml file has been set (eg for jetty:run) then use it
    if (webXmlFile != null && webXmlFile.exists()) {
        return webXmlFile.toURI().toURL();
    }

    //if we haven't overridden location of web.xml file, use the
    //standard way of finding it
    Log.debug("Looking for web.xml file in WEB-INF");
    return super.findWebXml();
}
 
Example 10
Source File: HBaseConfigurationUtil.java    From opensoc-streaming with Apache License 2.0 5 votes vote down vote up
/**
 * Closes the underlying connection to cluster; ignores if any exception is
 * thrown.
 */
public static void closeConnection() {
  if (clusterConnection != null) {
    try {
      clusterConnection.close();
    } catch (IOException e) {
      Log.debug("Caught ignorable exception ", e);
    }
  }
}
 
Example 11
Source File: HBaseConfigurationUtil.java    From opensoc-streaming with Apache License 2.0 5 votes vote down vote up
/**
 * Closes the underlying connection to cluster; ignores if any exception is
 * thrown.
 */
public static void closeConnection() {
  if (clusterConnection != null) {
    try {
      clusterConnection.close();
    } catch (IOException e) {
      Log.debug("Caught ignorable exception ", e);
    }
  }
}
 
Example 12
Source File: TaskReporter.java    From incubator-tez with Apache License 2.0 4 votes vote down vote up
/**
 * @param eventsArg
 * @return
 * @throws IOException
 *           indicates an RPC communication failure.
 * @throws TezException
 *           indicates an exception somewhere in the AM.
 */
private synchronized boolean heartbeat(Collection<TezEvent> eventsArg) throws IOException,
    TezException {

  if (eventsArg != null) {
    eventsToSend.addAll(eventsArg);
  }

  TezEvent updateEvent = null;
  List<TezEvent> events = new ArrayList<TezEvent>();
  eventsToSend.drainTo(events);

  if (!task.isTaskDone() && !task.hadFatalError()) {
    TezCounters counters = null;
    /**
     * Increasing the heartbeat interval can delay the delivery of events. Sending just updated
     * records would save CPU in DAG AM, but certain counters are updated very frequently. Until
     * real time decisions are made based on these counters, it can be sent once per second.
     */
    // Not completely accurate, since OOB heartbeats could go out.
    if ((nonOobHeartbeatCounter - prevCounterSendHeartbeatNum) * pollInterval >= sendCounterInterval) {
      counters = task.getCounters();
      prevCounterSendHeartbeatNum = nonOobHeartbeatCounter;
    }
    updateEvent = new TezEvent(new TaskStatusUpdateEvent(counters, task.getProgress()),
        updateEventMetadata);
    events.add(updateEvent);
  }

  long requestId = requestCounter.incrementAndGet();
  TezHeartbeatRequest request = new TezHeartbeatRequest(requestId, events, containerIdStr,
      task.getTaskAttemptID(), task.getEventCounter(), maxEventsToGet);
  if (LOG.isDebugEnabled()) {
    Log.debug("Sending heartbeat to AM, request=" + request);
  }

  maybeLogCounters();

  TezHeartbeatResponse response = umbilical.heartbeat(request);
  if (LOG.isDebugEnabled()) {
    LOG.debug("Received heartbeat response from AM, response=" + response);
  }

  if (response.shouldDie()) {
    LOG.info("Received should die response from AM");
    return false;
  }
  if (response.getLastRequestId() != requestId) {
    throw new TezException("AM and Task out of sync" + ", responseReqId="
        + response.getLastRequestId() + ", expectedReqId=" + requestId);
  }

  // The same umbilical is used by multiple tasks. Problematic in the case where multiple tasks
  // are running using the same umbilical.
  if (task.isTaskDone() || task.hadFatalError()) {
    if (response.getEvents() != null && !response.getEvents().isEmpty()) {
      LOG.warn("Current task already complete, Ignoring all event in"
          + " heartbeat response, eventCount=" + response.getEvents().size());
    }
  } else {
    if (response.getEvents() != null && !response.getEvents().isEmpty()) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Routing events from heartbeat response to task" + ", currentTaskAttemptId="
            + task.getTaskAttemptID() + ", eventCount=" + response.getEvents().size());
      }
      // This should ideally happen in a separate thread
      task.handleEvents(response.getEvents());
    }
  }
  return true;

}