From c0536f1745d6ccd945bc59f8afa8388445174973 Mon Sep 17 00:00:00 2001 From: Frank Maritato Date: Fri, 16 Apr 2010 18:01:26 +0000 Subject: [PATCH] use commons-logging git-svn-id: https://lwes.svn.sourceforge.net/svnroot/lwes/lwes-java/trunk@443 a2f82657-cdd2-4550-bd36-68a8e7111808 --- src/main/java/org/lwes/emitter/AbstractEventEmitter.java | 9 ++++++--- src/main/java/org/lwes/emitter/MulticastEventEmitter.java | 7 +++++-- src/main/java/org/lwes/emitter/UnicastEventEmitter.java | 12 ++++++++---- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/lwes/emitter/AbstractEventEmitter.java b/src/main/java/org/lwes/emitter/AbstractEventEmitter.java index a72efa8..9ea8e74 100644 --- a/src/main/java/org/lwes/emitter/AbstractEventEmitter.java +++ b/src/main/java/org/lwes/emitter/AbstractEventEmitter.java @@ -3,15 +3,18 @@ package org.lwes.emitter; * @author fmaritato */ +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.lwes.Event; import org.lwes.EventFactory; import org.lwes.EventSystemException; -import org.lwes.util.Log; import java.io.IOException; public abstract class AbstractEventEmitter implements EventEmitter { + private static transient Log log = LogFactory.getLog(AbstractEventEmitter.class); + private EventFactory factory = new EventFactory(); private boolean emitHeartbeat = false; @@ -29,7 +32,7 @@ public abstract class AbstractEventEmitter implements EventEmitter { emit(e); } catch (EventSystemException e) { - Log.error(e.getMessage(), e); + log.error(e.getMessage(), e); } } @@ -41,7 +44,7 @@ public abstract class AbstractEventEmitter implements EventEmitter { sendEventWithStatistics(e, freqThisPeriod); } catch (EventSystemException e) { - Log.error(e.getMessage(), e); + log.error(e.getMessage(), e); } } diff --git a/src/main/java/org/lwes/emitter/MulticastEventEmitter.java b/src/main/java/org/lwes/emitter/MulticastEventEmitter.java index 1acdbd1..c3af369 100644 --- a/src/main/java/org/lwes/emitter/MulticastEventEmitter.java +++ b/src/main/java/org/lwes/emitter/MulticastEventEmitter.java @@ -1,8 +1,9 @@ package org.lwes.emitter; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.lwes.Event; import org.lwes.EventSystemException; -import org.lwes.util.Log; import java.io.IOException; import java.io.InputStream; @@ -33,6 +34,8 @@ import java.net.MulticastSocket; */ public class MulticastEventEmitter extends AbstractEventEmitter { + private static transient Log log = LogFactory.getLog(MulticastEventEmitter.class); + /* the actual multicast socket being used */ private MulticastSocket socket = null; @@ -244,7 +247,7 @@ public class MulticastEventEmitter extends AbstractEventEmitter { collectStatistics(); } catch (EventSystemException e) { - Log.error(e.getMessage(), e); + log.error(e.getMessage(), e); } } } diff --git a/src/main/java/org/lwes/emitter/UnicastEventEmitter.java b/src/main/java/org/lwes/emitter/UnicastEventEmitter.java index 4ff33c7..1ebaa04 100644 --- a/src/main/java/org/lwes/emitter/UnicastEventEmitter.java +++ b/src/main/java/org/lwes/emitter/UnicastEventEmitter.java @@ -1,9 +1,10 @@ package org.lwes.emitter; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.lwes.Event; import org.lwes.EventFactory; import org.lwes.EventSystemException; -import org.lwes.util.Log; import org.lwes.util.NumberCodec; import java.io.IOException; @@ -34,6 +35,9 @@ import java.net.InetAddress; */ public class UnicastEventEmitter implements EventEmitter { + + private static transient Log log = LogFactory.getLog(UnicastEventEmitter.class); + /* an EventFactory */ private EventFactory factory = new EventFactory(); @@ -149,7 +153,7 @@ public class UnicastEventEmitter implements EventEmitter { } catch(IOException ie) { throw ie; } catch(Exception e) { - Log.error("Unable to initialize UnicastEventEmitter", e); + log.error("Unable to initialize UnicastEventEmitter", e); } } @@ -219,8 +223,8 @@ public class UnicastEventEmitter implements EventEmitter { DatagramPacket dp = new DatagramPacket(bytes, bytes.length, address, port); socket.send(dp); - if (Log.isLogTrace()) { - Log.trace("Sent to network '" + + if (log.isTraceEnabled()) { + log.trace("Sent to network '" + NumberCodec.byteArrayToHexString(dp.getData(), 0, dp.getLength())); } } -- 2.11.4.GIT