logback instead of log4j

This commit is contained in:
Shikhar Bhushan
2010-05-21 21:40:59 +01:00
parent f372ae782a
commit ca07e0d25a
11 changed files with 23 additions and 110 deletions

87
pom.xml
View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -45,57 +46,35 @@
<version>1.45</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<version>1.0.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-core</artifactId>
<version>0.3.0</version>
<version>0.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.11</version>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>0.9.20</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>0.9.20</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>oro</groupId>
<artifactId>oro</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
@@ -172,7 +151,7 @@
<profiles>
<profile>
<id>dev</id>
<id>full-deps</id>
<dependencies>
<dependency>
<groupId>org.bouncycastle</groupId>
@@ -185,36 +164,14 @@
<version>1.0.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.11</version>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>0.9.20</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>oro</groupId>
<artifactId>oro</artifactId>
</exclusion>
</exclusions>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>0.9.20</version>
</dependency>
</dependencies>
</profile>

View File

@@ -23,10 +23,6 @@ import java.io.IOException;
/** This examples demonstrates how a remote command can be executed. */
public class Exec {
// static {
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
// }
public static void main(String... args)
throws IOException {
SSHClient ssh = new SSHClient();
@@ -37,7 +33,7 @@ public class Exec {
ssh.authPublickey(System.getProperty("user.name"));
Command cmd = ssh.startSession().exec("ping google.com -n 1");
Command cmd = ssh.startSession().exec("ping -c 1 google.com");
// Pipe.pipe(cmd.getInputStream(), System.out, cmd.getLocalMaxPacketSize(), false);
System.out.print(cmd.getOutputAsString());

View File

@@ -26,11 +26,6 @@ import java.net.InetSocketAddress;
*/
public class LocalPF {
// static
// {
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
// }
public static void main(String... args)
throws IOException {
SSHClient ssh = new SSHClient();

View File

@@ -28,10 +28,6 @@ import java.net.InetSocketAddress;
*/
public class RemotePF {
// static {
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
// }
public static void main(String... args)
throws IOException {
SSHClient client = new SSHClient();

View File

@@ -28,10 +28,6 @@ import java.io.IOException;
/** A very rudimentary psuedo-terminal based on console I/O. */
class RudimentaryPTY {
// static {
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
// }
public static void main(String... args)
throws IOException {

View File

@@ -22,10 +22,6 @@ import java.io.IOException;
/** This example demonstrates downloading of a file over SCP from the SSH server. */
public class SCPDownload {
// static {
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
// }
public static void main(String[] args)
throws IOException {
SSHClient ssh = new SSHClient();

View File

@@ -22,10 +22,6 @@ import java.io.IOException;
/** This example demonstrates uploading of a file over SCP to the SSH server. */
public class SCPUpload {
// static {
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
// }
public static void main(String[] args)
throws IOException, ClassNotFoundException {
SSHClient ssh = new SSHClient();

View File

@@ -22,10 +22,6 @@ import java.io.IOException;
/** This example demonstrates downloading of a file over SFTP from the SSH server. */
public class SFTPDownload {
// static {
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
// }
public static void main(String[] args)
throws IOException {
SSHClient ssh = new SSHClient();

View File

@@ -22,11 +22,6 @@ import java.io.IOException;
/** This example demonstrates uploading of a file over SFTP to the SSH server. */
public class SFTPUpload {
// static
// {
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
// }
public static void main(String[] args)
throws IOException {
SSHClient ssh = new SSHClient();

View File

@@ -27,10 +27,6 @@ import java.net.InetSocketAddress;
/** This example demonstrates how forwarding X11 connections from a remote host can be accomplished. */
public class X11 {
// static {
// BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
// }
public static void main(String... args)
throws IOException, InterruptedException {
SSHClient ssh = new SSHClient();

View File

@@ -18,9 +18,6 @@ package net.schmizz.sshj;
import net.schmizz.sshj.transport.TransportException;
import net.schmizz.sshj.userauth.UserAuthException;
import net.schmizz.sshj.util.BogusPasswordAuthenticator;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.PatternLayout;
import org.apache.sshd.SshServer;
import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
import org.junit.After;
@@ -35,9 +32,6 @@ import static org.junit.Assert.assertTrue;
/* Kinda basic right now */
public class SmokeTest {
static {
BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%d [%-15.15t] %-5p %-30.30c{1} - %m%n")));
}
private SSHClient ssh;
private SshServer sshd;