Skip to content

Commit

Permalink
use new logger (#976)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaldino committed Nov 11, 2019
1 parent c6780ee commit 7a7f5cf
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.jitsi.osgi.*;
import org.jitsi.service.configuration.*;
import org.jitsi.utils.concurrent.*;
import org.jitsi.utils.logging.*;
import org.jitsi.utils.logging2.*;
import org.osgi.framework.*;

/**
Expand All @@ -36,8 +36,8 @@ public class VideobridgeExpireThread
* The <tt>Logger</tt> used by the <tt>VideobridgeExpireThread</tt> class
* and its instances to print debug information.
*/
private static final Logger logger
= Logger.getLogger(VideobridgeExpireThread.class);
private static final Logger logger =
new LoggerImpl(VideobridgeExpireThread.class.getName());

/**
* The executor which periodically calls {@link #expire(Videobridge)} (if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.jitsi.eventadmin.*;
import org.jitsi.stats.media.*;
import org.jitsi.utils.concurrent.*;
import org.jitsi.utils.logging.*;
import org.jitsi.utils.logging2.*;
import org.jitsi.videobridge.*;

/**
Expand All @@ -38,7 +38,7 @@ class CallStatsConferenceStatsHandler
* class and its instances to print debug information.
*/
private static final Logger logger
= Logger.getLogger(CallStatsConferenceStatsHandler.class);
= new LoggerImpl(CallStatsConferenceStatsHandler.class.getName());

/**
* The {@link RecurringRunnableExecutor} which periodically invokes
Expand Down Expand Up @@ -117,7 +117,7 @@ public void handleEvent(Event event)
{
if (event == null)
{
logger.debug("Could not handle an event because it was null.");
logger.debug(() -> "Could not handle an event because it was null.");
return;
}

Expand All @@ -143,9 +143,8 @@ private void conferenceCreated(final Conference conference)
{
if (conference == null)
{
logger.debug(
"Could not log conference created event because the"
+ " conference is null.");
logger.debug(() -> "Could not log conference created event because " +
"the conference is null.");
return;
}

Expand All @@ -172,9 +171,8 @@ private void conferenceExpired(Conference conference)
{
if (conference == null)
{
logger.debug(
"Could not log conference expired event because the"
+ " conference is null.");
logger.debug(() -> "Could not log conference expired event " +
"because the conference is null.");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import org.jitsi.osgi.*;
import org.jitsi.service.configuration.*;
import org.jitsi.utils.logging.*;
import org.jitsi.utils.logging2.*;
import org.osgi.framework.*;

import java.net.*;
Expand All @@ -35,7 +35,7 @@ public class OctoRelayService
* instances to print debug information.
*/
private static final Logger logger
= Logger.getLogger(OctoRelayService.class);
= new LoggerImpl(OctoRelayService.class.getName());

/**
* The name of the configuration property which controls the address on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import org.jitsi.service.configuration.*;
import org.jitsi.service.libjitsi.*;
import org.jitsi.utils.logging.*;
import org.jitsi.utils.logging2.*;
import org.osgi.framework.*;

/**
Expand All @@ -32,7 +32,7 @@ public class ConfigurationActivator
* The logger instance used by this class.
*/
private final static Logger logger
= Logger.getLogger(ConfigurationActivator.class);
= new LoggerImpl(ConfigurationActivator.class.getName());

@Override
public void start(BundleContext bundleContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import org.jitsi.videobridge.stats.*;
import org.jitsi.videobridge.xmpp.*;
import org.jitsi.utils.logging.*;
import org.jitsi.utils.logging2.*;
import org.jivesoftware.smack.packet.*;
import org.jivesoftware.smack.packet.id.*;
import org.jivesoftware.smackx.pubsub.*;
Expand Down Expand Up @@ -50,7 +50,7 @@ public class PubSubPublisher
* instances to print debug information.
*/
private static final Logger logger
= Logger.getLogger(PubSubPublisher.class);
= new LoggerImpl(PubSubPublisher.class.getName());

/**
* The default timeout of the packets in milliseconds.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.jitsi.osgi.*;
import org.jitsi.videobridge.*;
import org.jitsi.videobridge.xmpp.*;
import org.jitsi.utils.logging.*;
import org.jitsi.utils.logging2.*;
import org.jitsi.xmpp.extensions.colibri.*;
import org.jivesoftware.smack.packet.*;
import org.jxmpp.jid.*;
Expand All @@ -39,7 +39,7 @@ public class ColibriStatsTransport
* its instances to print debug information.
*/
private static final Logger logger
= Logger.getLogger(ColibriStatsTransport.class);
= new LoggerImpl(ColibriStatsTransport.class.getName());

/**
* Builds the IQ packet that will be sent.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
package org.jitsi.videobridge.stats;

import org.jitsi.osgi.*;
import org.jitsi.utils.logging2.*;
import org.jitsi.videobridge.xmpp.*;
import org.jitsi.utils.logging.*;

/**
* Implements a {@link StatsTransport} which publishes via Presence in an XMPP
Expand All @@ -33,7 +33,7 @@ public class MucStatsTransport
* its instances to print debug information.
*/
private static final Logger logger
= Logger.getLogger(MucStatsTransport.class);
= new LoggerImpl(MucStatsTransport.class.getName());

/**
* Gets the {@link ClientConnectionImpl} to be used to publish
Expand All @@ -56,10 +56,7 @@ public void publishStatistics(Statistics stats)
= getUserConnectionBundleActivator();
if (clientConnectionImpl != null)
{
if (logger.isDebugEnabled())
{
logger.debug("Publishing statistics through MUC: " + stats);
}
logger.debug(() -> "Publishing statistics through MUC: " + stats);

clientConnectionImpl
.setPresenceExtension(Statistics.toXmppExtensionElement(stats));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import org.jitsi.videobridge.pubsub.*;
import org.jitsi.videobridge.xmpp.*;
import org.jitsi.utils.logging.*;
import org.jitsi.utils.logging2.*;
import org.jivesoftware.smack.packet.*;
import org.jxmpp.jid.*;
import org.osgi.framework.*;
Expand All @@ -39,7 +39,7 @@ public class PubSubStatsTransport
* its instances to print debug information.
*/
private static final Logger logger
= Logger.getLogger(PubSubStatsTransport.class);
= new LoggerImpl(PubSubStatsTransport.class.getName());

/**
* The ID of PubSub item which stores bridge statistics.
Expand Down Expand Up @@ -318,7 +318,7 @@ private void serviceChanged(ServiceEvent ev)
catch ( IllegalArgumentException
| IllegalStateException | SecurityException ex )
{
logger.debug( "An unexpected exception occurred.", ex );
logger.debug(() -> "An unexpected exception occurred: " + ex.toString());
}
if (service instanceof ComponentImpl)
{
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jitsi/videobridge/stats/Statistics.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.util.concurrent.atomic.*;
import java.util.concurrent.locks.*;

import org.jitsi.utils.logging.*;
import org.jitsi.utils.logging2.*;
import org.jitsi.xmpp.extensions.colibri.*;

/**
Expand All @@ -34,7 +34,7 @@ public abstract class Statistics
* The {@link Logger} used by the {@link Endpoint} class to print debug
* information.
*/
private static final Logger logger = Logger.getLogger(Statistics.class);
private static final Logger logger = new LoggerImpl(Statistics.class.getName());

/**
* Formats statistics in <tt>ColibriStatsExtension</tt> object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.jitsi.osgi.*;
import org.jitsi.service.configuration.*;
import org.jitsi.util.*;
import org.jitsi.utils.logging.*;
import org.jitsi.utils.logging2.*;
import org.jxmpp.jid.*;
import org.jxmpp.jid.impl.*;
import org.jxmpp.stringprep.*;
Expand Down Expand Up @@ -67,7 +67,7 @@ public class StatsManagerBundleActivator
* class and its instances to print debug information.
*/
private static final Logger logger
= Logger.getLogger(StatsManagerBundleActivator.class);
= new LoggerImpl(StatsManagerBundleActivator.class.getName());

/**
* The name of the property which specifies the name of the PubSub node that
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jitsi/videobridge/transport/Harvesters.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import org.ice4j.ice.harvest.*;
import org.jitsi.service.configuration.*;
import org.jitsi.utils.logging.*;
import org.jitsi.utils.logging2.*;

import java.io.*;
import java.util.*;
Expand Down Expand Up @@ -70,7 +70,7 @@ public class Harvesters
* print debug information.
*/
private static final Logger classLogger
= Logger.getLogger(Harvesters.class);
= new LoggerImpl(Harvesters.class.getName());

/**
* The default port that the <tt>TcpHarvester</tt> will
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.jitsi.osgi.*;
import org.jitsi.service.configuration.*;
import org.jitsi.utils.logging2.*;
import org.jitsi.xmpp.extensions.colibri.*;
import org.jitsi.xmpp.extensions.health.*;
import org.jitsi.xmpp.mucclient.*;
Expand All @@ -38,8 +39,8 @@ public class ClientConnectionImpl
* The {@link Logger} used by the {@link ClientConnectionImpl}
* class and its instances for logging output.
*/
private static final org.jitsi.utils.logging.Logger logger
= org.jitsi.utils.logging.Logger.getLogger(ClientConnectionImpl.class);
private static final Logger logger
= new LoggerImpl(ClientConnectionImpl.class.getName());

/**
* The prefix of the property names used to configure this bundle.
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/org/jitsi/videobridge/xmpp/ComponentImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.jitsi.meet.*;
import org.jitsi.osgi.*;
import org.jitsi.service.configuration.*;
import org.jitsi.utils.logging2.*;
import org.jitsi.videobridge.Videobridge;
import org.jitsi.xmpp.component.*;
import org.jitsi.xmpp.util.*;
Expand Down Expand Up @@ -47,8 +48,8 @@ public class ComponentImpl
* The {@link Logger} used by the {@link ComponentImpl} class and its
* instances for logging output.
*/
private static final org.jitsi.utils.logging.Logger logger
= org.jitsi.utils.logging.Logger.getLogger(ComponentImpl.class);
private static final Logger logger
= new LoggerImpl(ComponentImpl.class.getName());

/**
* The (default) description of <tt>ComponentImpl</tt> instances.
Expand Down Expand Up @@ -382,10 +383,7 @@ public void send(org.jivesoftware.smack.packet.IQ iq)

send(packet);

if (logger.isDebugEnabled())
{
logger.debug("SENT: " + packet.toXML());
}
logger.debug(() -> "SENT: " + packet.toXML());
}
catch (Exception e)
{
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/org/jitsi/videobridge/xmpp/XmppCommon.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.jitsi.videobridge.xmpp;

import org.jitsi.osgi.*;
import org.jitsi.utils.logging2.*;
import org.jitsi.utils.version.*;
import org.jitsi.videobridge.*;
import org.jitsi.xmpp.extensions.colibri.*;
Expand All @@ -39,8 +40,8 @@ class XmppCommon
* The {@link Logger} used by the {@link XmppCommon} class and its
* instances for logging output.
*/
private static final org.jitsi.utils.logging.Logger logger
= org.jitsi.utils.logging.Logger.getLogger(XmppCommon.class);
private static final Logger logger
= new LoggerImpl(XmppCommon.class.getName());

static final String[] FEATURES
= new String[]
Expand Down Expand Up @@ -120,16 +121,16 @@ private VersionService getVersionService()
*/
IQ handleIQ(IQ requestIQ)
{
if (logger.isDebugEnabled() && requestIQ != null)
if (requestIQ != null)
{
logger.debug("RECV: " + requestIQ.toXML());
logger.debug(() -> "RECV: " + requestIQ.toXML());
}

IQ replyIQ = handleIQInternal(requestIQ);

if (logger.isDebugEnabled() && replyIQ != null)
if (replyIQ != null)
{
logger.debug("SENT: " + replyIQ.toXML());
logger.debug(() -> "SENT: " + replyIQ.toXML());
}

return replyIQ;
Expand Down

0 comments on commit 7a7f5cf

Please sign in to comment.