From 567e2e4f8a455058afc9648093d050cea605842e Mon Sep 17 00:00:00 2001 From: romanman Date: Thu, 22 May 2014 20:26:01 +0300 Subject: [PATCH] log4j support introduced --- ethereumj-core/pom.xml | 55 ++++++++++++++----- .../main/java/org/ethereum/gui/ToolBar.java | 18 ++++++ .../net/peerdiscovery/PeerTaster.java | 2 - .../main/java/org/ethereum/util/Utils.java | 10 ++++ .../src/main/resources/log4j.properties | 8 +++ 5 files changed, 77 insertions(+), 16 deletions(-) create mode 100644 ethereumj-core/src/main/resources/log4j.properties diff --git a/ethereumj-core/pom.xml b/ethereumj-core/pom.xml index 62eb8a0b..ba9bbc18 100644 --- a/ethereumj-core/pom.xml +++ b/ethereumj-core/pom.xml @@ -87,21 +87,48 @@ mvn clean package -Dmaven.test.skip=true - - - org.slf4j - slf4j-jdk14 - ${slf4j.version} - runtime - true - - - org.slf4j - slf4j-api - ${slf4j.version} - + + + + commons-logging + commons-logging + 1.0 + provided + + + + org.slf4j + slf4j-api + 1.7.7 + compile + + + + + + org.slf4j + jcl-over-slf4j + 1.5.6 + runtime + + + + + + org.slf4j + slf4j-log4j12 + 1.7.5 + runtime + + + + + + log4j + log4j + 1.2.17 + com.yuvalshavit antlr-denter diff --git a/ethereumj-core/src/main/java/org/ethereum/gui/ToolBar.java b/ethereumj-core/src/main/java/org/ethereum/gui/ToolBar.java index d96229e2..95294a26 100644 --- a/ethereumj-core/src/main/java/org/ethereum/gui/ToolBar.java +++ b/ethereumj-core/src/main/java/org/ethereum/gui/ToolBar.java @@ -1,6 +1,9 @@ package org.ethereum.gui; import org.ethereum.manager.MainData; +import org.ethereum.util.Utils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.swing.*; @@ -17,6 +20,8 @@ import java.awt.event.ItemListener; */ public class ToolBar extends JFrame { + Logger logger = LoggerFactory.getLogger(getClass()); + ConnectionConsoleWindow connectionConsoleWindow = null; PeersTableWindow mainFrame = null; BlockChainTable blockChainWindow = null; @@ -25,6 +30,19 @@ public class ToolBar extends JFrame { public ToolBar() throws HeadlessException { + + logger.info("EthereumJ [v0.5.1] by Roman Mandeleil"); + logger.info(" design by Vitaly Buterin"); + logger.info(""); + logger.info("java.version: " + System.getProperty("java.version")); + logger.info("java.home: " + System.getProperty("java.home")); + + if (Utils.JAVA_VERSION < 1.7) { + logger.info("EthereumJ support version 1.7 and higher of Java Runtime please update"); + System.exit(0); + } + + final JPanel cp = new JPanel(new FlowLayout()); cp.setBackground(Color.WHITE); diff --git a/ethereumj-core/src/main/java/org/ethereum/net/peerdiscovery/PeerTaster.java b/ethereumj-core/src/main/java/org/ethereum/net/peerdiscovery/PeerTaster.java index 4c2f1950..6925340a 100644 --- a/ethereumj-core/src/main/java/org/ethereum/net/peerdiscovery/PeerTaster.java +++ b/ethereumj-core/src/main/java/org/ethereum/net/peerdiscovery/PeerTaster.java @@ -72,8 +72,6 @@ public class PeerTaster { e.printStackTrace(); } } - - System.out.println("I am dead"); } diff --git a/ethereumj-core/src/main/java/org/ethereum/util/Utils.java b/ethereumj-core/src/main/java/org/ethereum/util/Utils.java index ca86ded1..130cc750 100644 --- a/ethereumj-core/src/main/java/org/ethereum/util/Utils.java +++ b/ethereumj-core/src/main/java/org/ethereum/util/Utils.java @@ -47,4 +47,14 @@ public class Utils { public static SecureRandom getRandom(){ return random; } + + public static double JAVA_VERSION = getJavaVersion(); + static double getJavaVersion() { + String version = System.getProperty("java.version"); + int pos = 0, count = 0; + for ( ; pos