本文整理匯總了Java中org.mortbay.log.Log.info方法的典型用法代碼示例。如果您正苦於以下問題:Java Log.info方法的具體用法?Java Log.info怎麽用?Java Log.info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.mortbay.log.Log
的用法示例。
在下文中一共展示了Log.info方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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()));
}
示例2: 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()));
}
示例3: 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;
}
示例4: 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;
}
示例5: 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
}
}
示例6: testClassFinderFiltersByClassInDirs
import org.mortbay.log.Log; //導入方法依賴的package包/類
@Test
public void testClassFinderFiltersByClassInDirs() throws Exception {
// Make some classes for us to find. Class naming and packaging is kinda cryptic.
// TODO: Fix.
final long counter = testCounter.incrementAndGet();
final String classNamePrefix = name.getMethodName();
String pkgNameSuffix = name.getMethodName();
Log.info("Created jar " + createAndLoadJar(pkgNameSuffix, classNamePrefix, counter));
final Class<?> clazz = makeClass(pkgNameSuffix, classNamePrefix, counter);
final ClassFinder.ClassFilter notThisFilter = new ClassFinder.ClassFilter() {
@Override
public boolean isCandidateClass(Class<?> c) {
return c != clazz;
}
};
String pkgName = makePackageName(pkgNameSuffix, counter);
ClassFinder allClassesFinder = new ClassFinder();
Set<Class<?>> allClasses = allClassesFinder.findClasses(pkgName, false);
assertTrue("Classes in " + pkgName, allClasses.size() > 0);
ClassFinder notThisClassFinder = new ClassFinder(null, null, notThisFilter);
Set<Class<?>> notAllClasses = notThisClassFinder.findClasses(pkgName, false);
assertFalse(contains(notAllClasses, clazz.getSimpleName()));
assertEquals(allClasses.size() - 1, notAllClasses.size());
}
示例7: 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);
}
示例8: canStartJobTracker
import org.mortbay.log.Log; //導入方法依賴的package包/類
/**
* Check whether the JobTracker can be started.
*
* @throws IOException
*/
private boolean canStartJobTracker(JobConf conf) throws InterruptedException,
IOException {
JobTracker jt = null;
try {
jt = JobTracker.startTracker(conf);
Log.info("Started JobTracker");
} catch (IOException e) {
Log.info("Can not Start JobTracker", e.getLocalizedMessage());
return false;
}
if (jt != null) {
jt.fs.close();
jt.stopTracker();
}
return true;
}
示例9: 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);
}
示例10: testClassFinderFiltersByNameInDirs
import org.mortbay.log.Log; //導入方法依賴的package包/類
@Test
public void testClassFinderFiltersByNameInDirs() throws Exception {
// Make some classes for us to find. Class naming and packaging is kinda cryptic.
// TODO: Fix.
final long counter = testCounter.incrementAndGet();
final String classNamePrefix = name.getMethodName();
String pkgNameSuffix = name.getMethodName();
Log.info("Created jar " + createAndLoadJar(pkgNameSuffix, classNamePrefix, counter));
final String classNameToFilterOut = classNamePrefix + counter;
final ClassFinder.FileNameFilter notThisFilter = new ClassFinder.FileNameFilter() {
@Override
public boolean isCandidateFile(String fileName, String absFilePath) {
return !fileName.equals(classNameToFilterOut + ".class");
}
};
String pkgName = makePackageName(pkgNameSuffix, counter);
ClassFinder allClassesFinder = new ClassFinder();
Set<Class<?>> allClasses = allClassesFinder.findClasses(pkgName, false);
assertTrue("Classes in " + pkgName, allClasses.size() > 0);
ClassFinder notThisClassFinder = new ClassFinder(null, notThisFilter, null);
Set<Class<?>> notAllClasses = notThisClassFinder.findClasses(pkgName, false);
assertFalse(contains(notAllClasses, classNameToFilterOut));
assertEquals(allClasses.size() - 1, notAllClasses.size());
}
示例11: 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);
assertTrue(amClient.ask.size() == 0);
assertTrue(amClient.release.size() == 0);
assertTrue(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;
}
示例12: main
import org.mortbay.log.Log; //導入方法依賴的package包/類
public static void main(String[] argv) throws IOException {
TestHFileSeek testCase = new TestHFileSeek();
MyOptions options = new MyOptions(argv);
if (options.proceed == false) {
return;
}
testCase.options = options;
for (int i = 0; i < options.trialCount; i++) {
Log.info("Beginning trial " + (i+1));
testCase.setUp();
testCase.testSeeks();
testCase.tearDown();
}
}
示例13: getAllocatedContainersNumber
import org.mortbay.log.Log; //導入方法依賴的package包/類
private int getAllocatedContainersNumber(
AMRMClientImpl<AMRMClient.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);
assertTrue(amClient.ask.size() == 0);
assertTrue(amClient.release.size() == 0);
assertTrue(NODECOUNT == amClient.getClusterNodeCount());
allocatedContainerCount += allocResponse.getAllocatedContainers().size();
if(allocatedContainerCount == 0) {
// sleep to let NM's heartbeat to RM and trigger allocations
sleep(SpliceTestYarnPlatform.DEFAULT_HEARTBEAT_INTERVAL);
}
}
return allocatedContainerCount;
}
示例14: setupForViewFileSystem
import org.mortbay.log.Log; //導入方法依賴的package包/類
/**
*
* @param fsTarget - the target fs of the view fs.
* @return return the ViewFS File context to be used for tests
* @throws Exception
*/
static public FileSystem setupForViewFileSystem(Configuration conf, FileSystemTestHelper fileSystemTestHelper, FileSystem fsTarget) throws Exception {
/**
* create the test root on local_fs - the mount table will point here
*/
Path targetOfTests = fileSystemTestHelper.getTestRootPath(fsTarget);
// In case previous test was killed before cleanup
fsTarget.delete(targetOfTests, true);
fsTarget.mkdirs(targetOfTests);
// Set up viewfs link for test dir as described above
String testDir = fileSystemTestHelper.getTestRootPath(fsTarget).toUri()
.getPath();
linkUpFirstComponents(conf, testDir, fsTarget, "test dir");
// Set up viewfs link for home dir as described above
setUpHomeDir(conf, fsTarget);
// the test path may be relative to working dir - we need to make that work:
// Set up viewfs link for wd as described above
String wdDir = fsTarget.getWorkingDirectory().toUri().getPath();
linkUpFirstComponents(conf, wdDir, fsTarget, "working dir");
FileSystem fsView = FileSystem.get(FsConstants.VIEWFS_URI, conf);
fsView.setWorkingDirectory(new Path(wdDir)); // in case testdir relative to wd.
Log.info("Working dir is: " + fsView.getWorkingDirectory());
return fsView;
}
示例15: setUpHomeDir
import org.mortbay.log.Log; //導入方法依賴的package包/類
static void setUpHomeDir(Configuration conf, FileContext fsTarget) {
String homeDir = fsTarget.getHomeDirectory().toUri().getPath();
int indexOf2ndSlash = homeDir.indexOf('/', 1);
if (indexOf2ndSlash >0) {
linkUpFirstComponents(conf, homeDir, fsTarget, "home dir");
} else { // home dir is at root. Just link the home dir itse
URI linkTarget = fsTarget.makeQualified(new Path(homeDir)).toUri();
ConfigUtil.addLink(conf, homeDir, linkTarget);
Log.info("Added link for home dir " + homeDir + "->" + linkTarget);
}
// Now set the root of the home dir for viewfs
String homeDirRoot = fsTarget.getHomeDirectory().getParent().toUri().getPath();
ConfigUtil.setHomeDirConf(conf, homeDirRoot);
Log.info("Home dir base for viewfs" + homeDirRoot);
}