com.jcraft.jsch.Logger Java Examples
The following examples show how to use
com.jcraft.jsch.Logger.
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: JSchSlf4JLoggerTest.java From ssh-proxy with Apache License 2.0 | 6 votes |
@Test public void testIsEnabled() throws Exception { JSchSlf4JLogger logger = new JSchSlf4JLogger(); assertFalse(logger.isEnabled(Logger.DEBUG)); assertFalse(logger.isEnabled(Logger.INFO)); assertTrue(logger.isEnabled(Logger.WARN)); assertTrue(logger.isEnabled(Logger.ERROR)); assertTrue(logger.isEnabled(Logger.FATAL)); try { logger.isEnabled(100); fail("IllegalArgumentException expected"); } catch (IllegalArgumentException e) { assertEquals("Unknown log level: 100", e.getMessage()); } }
Example #2
Source File: JSchSlf4JLoggerTest.java From ssh-proxy with Apache License 2.0 | 6 votes |
@Test public void testLog() throws Exception { JSchSlf4JLogger logger = new JSchSlf4JLogger(); logger.log(Logger.DEBUG, "some debug message"); logger.log(Logger.INFO, "some info message"); logger.log(Logger.WARN, "some warning message"); logger.log(Logger.ERROR, "some error message"); logger.log(Logger.FATAL, "some fatal message"); try { logger.log(100, "some message"); fail("IllegalArgumentException expected"); } catch (IllegalArgumentException e) { assertEquals("Unknown log level: 100", e.getMessage()); } }
Example #3
Source File: DynamoDBLocal.java From geowave with Apache License 2.0 | 6 votes |
protected boolean install() throws IOException { HttpURLConnection.setFollowRedirects(true); final URL url = new URL(DYNDB_URL + DYNDB_TAR); final File downloadFile = new File(dynLocalDir, DYNDB_TAR); if (!downloadFile.exists()) { try (FileOutputStream fos = new FileOutputStream(downloadFile)) { IOUtils.copyLarge(url.openStream(), fos); fos.flush(); } } final TarGZipUnArchiver unarchiver = new TarGZipUnArchiver(); unarchiver.enableLogging(new ConsoleLogger(Logger.WARN, "DynamoDB Local Unarchive")); unarchiver.setSourceFile(downloadFile); unarchiver.setDestDirectory(dynLocalDir); unarchiver.extract(); if (!downloadFile.delete()) { LOGGER.warn("cannot delete " + downloadFile.getAbsolutePath()); } // Check the install if (!isInstalled()) { LOGGER.error("DynamoDB Local install failed"); return false; } return true; }
Example #4
Source File: KuduLocal.java From geowave with Apache License 2.0 | 4 votes |
private boolean install() throws IOException, ArchiveException { LOGGER.info("Installing {}", KUDU_DEB_PACKAGE); LOGGER.debug("downloading kudu debian package"); final File debPackageFile = new File(kuduLocalDir, KUDU_DEB_PACKAGE); if (!debPackageFile.exists()) { HttpURLConnection.setFollowRedirects(true); final URL url = new URL(KUDU_REPO_URL + KUDU_DEB_PACKAGE); try (FileOutputStream fos = new FileOutputStream(debPackageFile)) { IOUtils.copy(url.openStream(), fos); fos.flush(); } } LOGGER.debug("extracting kudu debian package data contents"); final File debDataTarGz = new File(kuduLocalDir, "data.tar.gz"); if (!debDataTarGz.exists()) { try (FileInputStream fis = new FileInputStream(debPackageFile); ArchiveInputStream debInputStream = new ArchiveStreamFactory().createArchiveInputStream("ar", fis)) { ArchiveEntry entry = null; while ((entry = debInputStream.getNextEntry()) != null) { if (debDataTarGz.getName().equals(entry.getName())) { try (FileOutputStream fos = new FileOutputStream(debDataTarGz)) { IOUtils.copy(debInputStream, fos); } break; } } } } LOGGER.debug("extracting kudu data contents"); final TarGZipUnArchiver unarchiver = new TarGZipUnArchiver(); unarchiver.enableLogging(new ConsoleLogger(Logger.WARN, "Kudu Local Unarchive")); unarchiver.setSourceFile(debDataTarGz); unarchiver.setDestDirectory(kuduLocalDir); unarchiver.extract(); for (final File f : new File[] {debPackageFile, debDataTarGz}) { if (!f.delete()) { LOGGER.warn("cannot delete {}", f.getAbsolutePath()); } } LOGGER.debug("moving kudu master and tablet binaries to {}", kuduLocalDir); // move the master and tablet server binaries into the kudu local directory final Path kuduBin = Paths.get(kuduLocalDir.getAbsolutePath(), "usr", "lib", "kudu", "sbin-release"); final File kuduMasterBinary = kuduBin.resolve(KUDU_MASTER).toFile(); final File kuduTabletBinary = kuduBin.resolve(KUDU_TABLET).toFile(); kuduMasterBinary.setExecutable(true); kuduTabletBinary.setExecutable(true); FileUtils.moveFileToDirectory(kuduMasterBinary, kuduLocalDir, false); FileUtils.moveFileToDirectory(kuduTabletBinary, kuduLocalDir, false); if (isInstalled()) { LOGGER.info("Kudu Local installation successful"); return true; } else { LOGGER.error("Kudu Local installation failed"); return false; } }