当前位置: 首页>>代码示例>>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;未经允许,请勿转载。