labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ber...@apache.org
Subject svn commit: r709749 - in /labs/vysper: lib/ src/main/config/ src/main/java/org/apache/vysper/xmpp/delivery/ src/main/java/org/apache/vysper/xmpp/modules/core/im/handler/ src/main/java/org/apache/vysper/xmpp/modules/roster/handler/
Date Sat, 01 Nov 2008 18:51:19 GMT
Author: berndf
Date: Sat Nov  1 11:51:19 2008
New Revision: 709749

URL: http://svn.apache.org/viewvc?rev=709749&view=rev
Log:
[vysper] introduce logging via slf4j using log4j

Added:
    labs/vysper/lib/slf4j-api-1.5.3.jar   (with props)
    labs/vysper/lib/slf4j-log4j12-1.5.3.jar   (with props)
    labs/vysper/src/main/config/log4j.xml
Modified:
    labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/DeliveringClientOutboundStanzaRelay.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/DeliveringInboundStanzaRelay.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceAvailabilityHandler.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/handler/RosterIQHandler.java

Added: labs/vysper/lib/slf4j-api-1.5.3.jar
URL: http://svn.apache.org/viewvc/labs/vysper/lib/slf4j-api-1.5.3.jar?rev=709749&view=auto
==============================================================================
Binary file - no diff available.

Propchange: labs/vysper/lib/slf4j-api-1.5.3.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: labs/vysper/lib/slf4j-log4j12-1.5.3.jar
URL: http://svn.apache.org/viewvc/labs/vysper/lib/slf4j-log4j12-1.5.3.jar?rev=709749&view=auto
==============================================================================
Binary file - no diff available.

Propchange: labs/vysper/lib/slf4j-log4j12-1.5.3.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: labs/vysper/src/main/config/log4j.xml
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/config/log4j.xml?rev=709749&view=auto
==============================================================================
--- labs/vysper/src/main/config/log4j.xml (added)
+++ labs/vysper/src/main/config/log4j.xml Sat Nov  1 11:51:19 2008
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!--
+ ! Copyright (c) 2008 The Apache Software Foundation.                  !
+ ! All rights reserved.                                                !
+ !                                                                     !
+ ! Licensed under the Apache License, Version 2.0 (the "License"); you !
+ ! may not use this file except in compliance with the License. You    !
+ ! may obtain a copy of the License at:                                !
+ !                                                                     !
+ !     http://www.apache.org/licenses/LICENSE-2.0                      !
+ !                                                                     !
+ ! Unless required by applicable law or agreed to in writing, software !
+ ! distributed under the License is distributed on an "AS IS" BASIS,   !
+ ! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or     !
+ ! implied.  See the License for the specific language governing       !
+ ! permissions and limitations under the License.                      !
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <appender name="CONS" class="org.apache.log4j.ConsoleAppender">
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="TRACE"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <param name="ConversionPattern" value="%-5p %d{HH:mm:ss,SSS} | %c{1} | %m%n"/>
+      </layout>
+   </appender>
+
+   <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
+     <param name="File" value="log/vysper_server.log"/>
+     <param name="Append" value="true"/>
+     <param name="MaxFileSize" value="500KB"/>
+     <param name="MaxBackupIndex" value="1"/>
+     <param name="Threshold" value="INFO"/>
+
+     <layout class="org.apache.log4j.PatternLayout">
+       <param name="ConversionPattern" value="%-5p %d{HH:mm:ss,SSS} | %c{1} | %m%n"/>
+     </layout>
+   </appender>
+
+   <!-- limit logging for spring -->
+   <category name="org.springframework">
+     <priority value="INFO"/>
+   </category>
+
+   <root>
+     <appender-ref ref="CONS"/>
+     <appender-ref ref="FILE"/>
+   </root>
+
+</log4j:configuration>

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/DeliveringClientOutboundStanzaRelay.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/DeliveringClientOutboundStanzaRelay.java?rev=709749&r1=709748&r2=709749&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/DeliveringClientOutboundStanzaRelay.java
(original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/DeliveringClientOutboundStanzaRelay.java
Sat Nov  1 11:51:19 2008
@@ -21,6 +21,8 @@
 import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.stanza.Stanza;
 import org.apache.vysper.xmpp.writer.StanzaWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.List;
 import java.util.concurrent.Callable;
@@ -38,6 +40,8 @@
  */
 public class DeliveringClientOutboundStanzaRelay implements StanzaRelay {
 
+    final Logger logger = LoggerFactory.getLogger(DeliveringClientOutboundStanzaRelay.class);
+
     protected ResourceRegistry resourceRegistry;
     protected ExecutorService executor; 
 
@@ -104,7 +108,7 @@
             try {
                 List<SessionContext> receivingSessions = resourceRegistry.getSessions(receiver);
                 if (receivingSessions == null || receivingSessions.size() == 0) {
-                    System.out.println("S: #E# cannot relay to " + receiver.getFullQualifiedName());
+                    logger.warn("cannot relay to {} stanza {}", receiver.getFullQualifiedName(),
stanza.toString());
                     return new RelayResult(new LocalRecipientNotReachableException());
                 }
                 for (SessionContext sessionContext : receivingSessions) {

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/DeliveringInboundStanzaRelay.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/DeliveringInboundStanzaRelay.java?rev=709749&r1=709748&r2=709749&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/DeliveringInboundStanzaRelay.java
(original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/delivery/DeliveringInboundStanzaRelay.java
Sat Nov  1 11:51:19 2008
@@ -24,6 +24,8 @@
 import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.server.SessionState;
 import org.apache.vysper.xmpp.stanza.Stanza;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -40,6 +42,8 @@
  */
 public class DeliveringInboundStanzaRelay implements StanzaRelay {
 
+    final Logger logger = LoggerFactory.getLogger(DeliveringInboundStanzaRelay.class);
+
     private static final InboundStanzaProtocolWorker INBOUND_STANZA_PROTOCOL_WORKER = new
InboundStanzaProtocolWorker();
 
     protected ResourceRegistry resourceRegistry;
@@ -110,7 +114,7 @@
             try {
                 List<SessionContext> receivingSessions = resourceRegistry.getSessions(receiver);
                 if (receivingSessions == null || receivingSessions.size() == 0) {
-                    System.out.println("S: #E# cannot relay to " + receiver.getFullQualifiedName());
+                    logger.warn("cannot relay to {} stanza {}", receiver.getFullQualifiedName(),
stanza.toString());
                     return new RelayResult(new LocalRecipientNotReachableException());
                 }
                 for (SessionContext sessionContext : receivingSessions) {

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceAvailabilityHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceAvailabilityHandler.java?rev=709749&r1=709748&r2=709749&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceAvailabilityHandler.java
(original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/core/im/handler/PresenceAvailabilityHandler.java
Sat Nov  1 11:51:19 2008
@@ -36,6 +36,8 @@
 import org.apache.vysper.xmpp.state.resourcebinding.ResourceRegistry;
 import org.apache.vysper.xmpp.state.resourcebinding.ResourceState;
 import org.apache.vysper.xmpp.xmlfragment.Attribute;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -46,6 +48,8 @@
  */
 public class PresenceAvailabilityHandler extends AbstractPresenceSpecializedHandler {
 
+    final Logger logger = LoggerFactory.getLogger(PresenceAvailabilityHandler.class);
+    
     /*package*/ Stanza executeCorePresence(SessionContext sessionContext, PresenceStanza
presenceStanza, RosterManager rosterManager) {
 
         if (isSubscriptionType(presenceStanza.getPresenceType())) {
@@ -109,7 +113,7 @@
         if (presenceStanza != null && presenceStanza.getFrom() != null) {
             unavailableContact = presenceStanza.getFrom().getFullQualifiedName();
         }
-        System.out.println(unavailableContact + " has become unavailable");
+        logger.info("{} has become unavailable", unavailableContact);
 
         return presenceStanza;
     }
@@ -234,7 +238,7 @@
         // write inbound stanza to the user
         sessionContext.getResponseWriter().write(stanza);
 
-        System.out.println(stanza.getFrom().getFullQualifiedName() +  " has become available");
+        logger.info("{} has become available", stanza.getFrom().getFullQualifiedName());
 
         return stanza;
 	}

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/handler/RosterIQHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/handler/RosterIQHandler.java?rev=709749&r1=709748&r2=709749&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/handler/RosterIQHandler.java
(original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/modules/roster/handler/RosterIQHandler.java
Sat Nov  1 11:51:19 2008
@@ -17,32 +17,50 @@
 
 package org.apache.vysper.xmpp.modules.roster.handler;
 
+import org.apache.vysper.xmpp.addressing.Entity;
+import org.apache.vysper.xmpp.addressing.EntityFormatException;
+import org.apache.vysper.xmpp.addressing.EntityImpl;
 import org.apache.vysper.xmpp.modules.core.base.handler.IQHandler;
-import org.apache.vysper.xmpp.modules.roster.*;
+import org.apache.vysper.xmpp.modules.roster.AskSubscriptionType;
+import org.apache.vysper.xmpp.modules.roster.Roster;
+import org.apache.vysper.xmpp.modules.roster.RosterBadRequestException;
+import org.apache.vysper.xmpp.modules.roster.RosterConfiguration;
+import org.apache.vysper.xmpp.modules.roster.RosterException;
+import org.apache.vysper.xmpp.modules.roster.RosterGroup;
+import org.apache.vysper.xmpp.modules.roster.RosterItem;
+import org.apache.vysper.xmpp.modules.roster.RosterNotAcceptableException;
+import org.apache.vysper.xmpp.modules.roster.RosterStanzaUtils;
+import org.apache.vysper.xmpp.modules.roster.SubscriptionType;
 import org.apache.vysper.xmpp.modules.roster.persistence.RosterManager;
 import org.apache.vysper.xmpp.protocol.NamespaceURIs;
-import org.apache.vysper.xmpp.state.resourcebinding.ResourceRegistry;
-import org.apache.vysper.xmpp.state.resourcebinding.ResourceState;
 import org.apache.vysper.xmpp.server.ServerRuntimeContext;
 import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.server.response.ServerErrorResponses;
-import org.apache.vysper.xmpp.stanza.*;
-import org.apache.vysper.xmpp.addressing.Entity;
-import org.apache.vysper.xmpp.addressing.EntityImpl;
-import org.apache.vysper.xmpp.addressing.EntityFormatException;
-import org.apache.vysper.xmpp.xmlfragment.XMLElement;
-import org.apache.vysper.xmpp.xmlfragment.XMLSemanticError;
+import org.apache.vysper.xmpp.stanza.IQStanza;
+import org.apache.vysper.xmpp.stanza.IQStanzaType;
+import org.apache.vysper.xmpp.stanza.Stanza;
+import org.apache.vysper.xmpp.stanza.StanzaBuilder;
+import org.apache.vysper.xmpp.stanza.StanzaErrorCondition;
+import org.apache.vysper.xmpp.stanza.StanzaErrorType;
+import org.apache.vysper.xmpp.state.resourcebinding.ResourceRegistry;
+import org.apache.vysper.xmpp.state.resourcebinding.ResourceState;
 import org.apache.vysper.xmpp.xmlfragment.Attribute;
+import org.apache.vysper.xmpp.xmlfragment.XMLElement;
 import org.apache.vysper.xmpp.xmlfragment.XMLElementVerifier;
+import org.apache.vysper.xmpp.xmlfragment.XMLSemanticError;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * handles roster get, set, push & result requests
  */
 public class RosterIQHandler extends IQHandler {
 
+    final Logger logger = LoggerFactory.getLogger(RosterIQHandler.class);
+
     @Override
     protected boolean verifyNamespace(Stanza stanza) {
         return verifyInnerNamespace(stanza, NamespaceURIs.JABBER_IQ_ROSTER);
@@ -182,7 +200,7 @@
         synchronized (existingItem) {
             if (setRosterItem.getName() != null) {
                 // TODO set name on item
-                System.out.println("set name to " + setRosterItem.getName());
+                logger.debug("{} roster: set roster item name to {}", user.getBareJID(),
setRosterItem.getName());
             }
             // TODO set groups on item
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message