當前位置: 首頁>>代碼示例>>Java>>正文


Java Log類代碼示例

本文整理匯總了Java中org.mortbay.log.Log的典型用法代碼示例。如果您正苦於以下問題:Java Log類的具體用法?Java Log怎麽用?Java Log使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Log類屬於org.mortbay.log包,在下文中一共展示了Log類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: configureClassLoader

import org.mortbay.log.Log; //導入依賴的package包/類
/**
 * 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();
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:24,代碼來源:JettyConfiguration.java

示例2: testSessionCookie

import org.mortbay.log.Log; //導入依賴的package包/類
@Test
public void testSessionCookie() throws IOException {
  try {
      startServer(true);
  } catch (Exception e) {
      // Auto-generated catch block
      e.printStackTrace();
  }

  URL base = new URL("http://" + NetUtils.getHostPortString(server
          .getConnectorAddress(0)));
  HttpURLConnection conn = (HttpURLConnection) new URL(base,
          "/echo").openConnection();

  String header = conn.getHeaderField("Set-Cookie");
  List<HttpCookie> cookies = HttpCookie.parse(header);
  Assert.assertTrue(!cookies.isEmpty());
  Log.info(header);
  Assert.assertFalse(header.contains("; Expires="));
  Assert.assertTrue("token".equals(cookies.get(0).getValue()));
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:22,代碼來源:TestAuthenticationSessionCookie.java

示例3: testPersistentCookie

import org.mortbay.log.Log; //導入依賴的package包/類
@Test
public void testPersistentCookie() throws IOException {
  try {
      startServer(false);
  } catch (Exception e) {
      // Auto-generated catch block
      e.printStackTrace();
  }

  URL base = new URL("http://" + NetUtils.getHostPortString(server
          .getConnectorAddress(0)));
  HttpURLConnection conn = (HttpURLConnection) new URL(base,
          "/echo").openConnection();

  String header = conn.getHeaderField("Set-Cookie");
  List<HttpCookie> cookies = HttpCookie.parse(header);
  Assert.assertTrue(!cookies.isEmpty());
  Log.info(header);
  Assert.assertTrue(header.contains("; Expires="));
  Assert.assertTrue("token".equals(cookies.get(0).getValue()));
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:22,代碼來源:TestAuthenticationSessionCookie.java

示例4: getAllocatedContainersNumber

import org.mortbay.log.Log; //導入依賴的package包/類
private int getAllocatedContainersNumber(
    AMRMClientImpl<ContainerRequest> amClient, int iterationsLeft)
    throws YarnException, IOException {
  int allocatedContainerCount = 0;
  while (iterationsLeft-- > 0) {
    Log.info(" == alloc " + allocatedContainerCount + " it left " + iterationsLeft);
    AllocateResponse allocResponse = amClient.allocate(0.1f);
    assertEquals(0, amClient.ask.size());
    assertEquals(0, amClient.release.size());
      
    assertEquals(nodeCount, amClient.getClusterNodeCount());
    allocatedContainerCount += allocResponse.getAllocatedContainers().size();
      
    if(allocatedContainerCount == 0) {
      // sleep to let NM's heartbeat to RM and trigger allocations
      sleep(100);
    }
  }
  return allocatedContainerCount;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:21,代碼來源:TestAMRMClient.java

示例5: notifyURLOnce

import org.mortbay.log.Log; //導入依賴的package包/類
/**
 * Notify the URL just once. Use best effort.
 */
protected boolean notifyURLOnce() {
  boolean success = false;
  try {
    Log.info("Job end notification trying " + urlToNotify);
    HttpURLConnection conn =
      (HttpURLConnection) urlToNotify.openConnection(proxyToUse);
    conn.setConnectTimeout(timeout);
    conn.setReadTimeout(timeout);
    conn.setAllowUserInteraction(false);
    if(conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
      Log.warn("Job end notification to " + urlToNotify +" failed with code: "
      + conn.getResponseCode() + " and message \"" + conn.getResponseMessage()
      +"\"");
    }
    else {
      success = true;
      Log.info("Job end notification to " + urlToNotify + " succeeded");
    }
  } catch(IOException ioe) {
    Log.warn("Job end notification to " + urlToNotify + " failed", ioe);
  }
  return success;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:27,代碼來源:JobEndNotifier.java

示例6: registerApplicationMaster

import org.mortbay.log.Log; //導入依賴的package包/類
@Override
public RegisterApplicationMasterResponse registerApplicationMaster(
    RegisterApplicationMasterRequest request) throws YarnException,
    IOException {
  String amrmToken = getAppIdentifier();
  Log.info("Registering application attempt: " + amrmToken);

  synchronized (applicationContainerIdMap) {
    Assert.assertFalse("The application id is already registered: "
        + amrmToken, applicationContainerIdMap.containsKey(amrmToken));
    // Keep track of the containers that are returned to this application
    applicationContainerIdMap.put(amrmToken,
        new ArrayList<ContainerId>());
  }

  return RegisterApplicationMasterResponse.newInstance(null, null, null,
      null, null, request.getHost(), null);
}
 
開發者ID:aliyun-beta,項目名稱:aliyun-oss-hadoop-fs,代碼行數:19,代碼來源:MockResourceManagerFacade.java

示例7: finishApplicationMaster

import org.mortbay.log.Log; //導入依賴的package包/類
@Override
public FinishApplicationMasterResponse finishApplicationMaster(
    FinishApplicationMasterRequest request) throws YarnException,
    IOException {
  String amrmToken = getAppIdentifier();
  Log.info("Finishing application attempt: " + amrmToken);

  synchronized (applicationContainerIdMap) {
    // Remove the containers that were being tracked for this application
    Assert.assertTrue("The application id is NOT registered: "
        + amrmToken, applicationContainerIdMap.containsKey(amrmToken));
    List<ContainerId> ids = applicationContainerIdMap.remove(amrmToken);
    for (ContainerId c : ids) {
      allocatedContainerMap.remove(c);
    }
  }

  return FinishApplicationMasterResponse
      .newInstance(request.getFinalApplicationStatus() == FinalApplicationStatus.SUCCEEDED ? true
          : false);
}
 
開發者ID:aliyun-beta,項目名稱:aliyun-oss-hadoop-fs,代碼行數:22,代碼來源:MockResourceManagerFacade.java

示例8: cleanUpConnectors

import org.mortbay.log.Log; //導入依賴的package包/類
private void cleanUpConnectors()
   {
	Iterator<Map.Entry<String, Connector>> it = _connectors.entrySet().iterator();
	while (it.hasNext())
	{
		Map.Entry<String, Connector> entry = (Map.Entry<String, Connector>) it.next();
		Connector connector = entry.getValue();
		try
		{
			connector.stop();
		} catch (Exception ex)
		{
			Log.warn(ex);
		}
		_server.removeConnector(connector);
	}
	_connectors.clear();
}
 
開發者ID:iMartinezMateu,項目名稱:openbravo-pos,代碼行數:19,代碼來源:JettyHttpServer.java

示例9: afterPropertiesSet

import org.mortbay.log.Log; //導入依賴的package包/類
public void afterPropertiesSet() throws Exception 
{
	// not the right place to write out a full on configuration object, server not initialized, but this does appear
	// to write out an object.  Need to work out the reading and writing bit, maybe try a consolidated configuration object with a
	// a map of configurations keys by a unique key based on clusterInfo and then read/write that.  would want to ensure its
	// unique though, so maybe instance Id 1 would be the only one allowed to create it, others would block?
	
	// of course this is dependent on the space setting, currently configured with in jvm space only, is this the default
	// way we want to do it?
	gigaSpace.write( new GigaServerConfiguration( _clusterInfo, this ) );
	
	GigaServerConfiguration gsc = gigaSpace.read( new GigaServerConfiguration() );
	
	if ( gsc == null )
	{
		Log.info( "GSC is null :(" );	
	}
	else
	{
		Log.info( "GSC is not null and  server port is " + gsc.getServerPort() );  // currently 0, need another place for doing this
	}
}
 
開發者ID:iMartinezMateu,項目名稱:openbravo-pos,代碼行數:23,代碼來源:GigaServer.java

示例10: Session

import org.mortbay.log.Log; //導入依賴的package包/類
/**
 * Session from a request.
 * 
 * @param request
 */
protected Session (HttpServletRequest request)
{
 
    super(request);   
    _data = new SessionData(_clusterId);
    _data.setMaxIdleMs(_dftMaxIdleSecs*1000);
    _data.setContextPath(_context.getContextPath());
    _data.setVirtualHost(getVirtualHost(_context));
    _data.setExpiryTime(_maxIdleMs < 0 ? 0 : (System.currentTimeMillis() + _maxIdleMs));
    _data.setCookieSet(0);
    if (_data.getAttributeMap()==null)
        newAttributeMap();
    _values=_data.getAttributeMap();
    if (Log.isDebugEnabled()) Log.debug("New Session from request, "+_data.toStringExtended());
}
 
開發者ID:iMartinezMateu,項目名稱:openbravo-pos,代碼行數:21,代碼來源:GigaSessionManager.java

示例11: complete

import org.mortbay.log.Log; //導入依賴的package包/類
/** 
 * Exit from session
 * 
 * If the session attributes changed then always write the session 
 * to the cloud.
 * 
 * If just the session access time changed, we don't always write out the
 * session, because the gigaspace will serialize the unchanged sesssion
 * attributes. To save on serialization overheads, we only write out the
 * session when only the access time has changed if the time at which we
 * last saved the session exceeds the chosen save interval.
 * 
 * @see org.mortbay.jetty.servlet.AbstractSessionManager.Session#complete()
 */
protected void complete()
{
    super.complete();
    try
    {
        if (_dirty || (_data._accessed - _data._lastSaved) >= (_savePeriodMs))
        {
            _data.setLastSaved(System.currentTimeMillis());
            willPassivate();   
            update(_data);
            didActivate();
            if (Log.isDebugEnabled()) Log.debug("Dirty="+_dirty+", accessed-saved="+_data._accessed +"-"+ _data._lastSaved+", savePeriodMs="+_savePeriodMs);
        }
    }
    catch (Exception e)
    {
        Log.warn("Problem persisting changed session data id="+getId(), e);
    }
    finally
    {
        _dirty=false;
    }
}
 
開發者ID:iMartinezMateu,項目名稱:openbravo-pos,代碼行數:38,代碼來源:GigaSessionManager.java

示例12: addSession

import org.mortbay.log.Log; //導入依賴的package包/類
protected void addSession(org.mortbay.jetty.servlet.AbstractSessionManager.Session abstractSession)
{
    if (abstractSession==null)
        return;
    
    if (!(abstractSession instanceof GigaSessionManager.Session))
            throw new IllegalStateException("Not a GigaspacesSessionManager.Session "+abstractSession);
    
    synchronized (this)
    {
        GigaSessionManager.Session session = (GigaSessionManager.Session)abstractSession;

        try
        {
            _sessions.put(getClusterId(session), session);
            add(session._data);
        }
        catch (Exception e)
        {
            Log.warn("Problem writing new SessionData to space ", e);
        }
    } 
}
 
開發者ID:iMartinezMateu,項目名稱:openbravo-pos,代碼行數:24,代碼來源:GigaSessionManager.java

示例13: addSession

import org.mortbay.log.Log; //導入依賴的package包/類
public void addSession(HttpSession session)
{
    if (session == null)
        return;
    
    synchronized (_sessionIds)
    {
        if (session instanceof GigaSessionManager.Session)
        {
            String id = ((GigaSessionManager.Session)session).getClusterId();            
            try
            {
                Id theId = new Id(id);
                add(theId);
                _sessionIds.add(theId);
                if (Log.isDebugEnabled()) Log.debug("Added id "+id);
            }
            catch (Exception e)
            {
                Log.warn("Problem storing session id="+id, e);
            }
        }
        else
            throw new IllegalStateException ("Session is not a Gigaspaces session");
    }
}
 
開發者ID:iMartinezMateu,項目名稱:openbravo-pos,代碼行數:27,代碼來源:GigaSessionIdManager.java

示例14: idInUse

import org.mortbay.log.Log; //導入依賴的package包/類
public boolean idInUse(String id)
{
    if (id == null)
        return false;
    
    String clusterId = getClusterId(id);
    Id theId = new Id(clusterId);
    synchronized (_sessionIds)
    {
        if (_sessionIds.contains(theId))
            return true; //optimisation - if this session is one we've been managing, we can check locally
        
        //otherwise, we need to go to the space to check
        try
        {
            return exists(theId);
        }
        catch (Exception e)
        {
            Log.warn("Problem checking inUse for id="+clusterId, e);
            return false;
        }
    }
}
 
開發者ID:iMartinezMateu,項目名稱:openbravo-pos,代碼行數:25,代碼來源:GigaSessionIdManager.java

示例15: removeSession

import org.mortbay.log.Log; //導入依賴的package包/類
public void removeSession (String id)
{

    if (id == null)
        return;
    
    synchronized (_sessionIds)
    {  
        if (Log.isDebugEnabled())
            Log.debug("Removing session id="+id);
        try
        {               
            Id theId = new Id(id);
            _sessionIds.remove(theId);
            delete(theId);
        }
        catch (Exception e)
        {
            Log.warn("Problem removing session id="+id, e);
        }
    }
    
}
 
開發者ID:iMartinezMateu,項目名稱:openbravo-pos,代碼行數:24,代碼來源:GigaSessionIdManager.java


注:本文中的org.mortbay.log.Log類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。