You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2005/04/13 17:15:31 UTC

DO NOT REPLY [Bug 34440] New: - sandbox:IMAppender - comma-seperated recipient list patch

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34440>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34440

           Summary: sandbox:IMAppender - comma-seperated recipient list
                    patch
           Product: Log4j
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Appender
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: dhartford@ghsinc.com


log4j-sandbox, org.apache.log4j.net.IMAppender

Modify IMAppender class to support comma-seperated 'recipient' field in the
log4j properties file to allow for broadcast/multiple recipients.
-dhartford, 4/13/05

/*
 * Copyright 1999,2004 The Apache Software Foundation.
 * 
 * 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.
 */

import java.util.StringTokenizer;
.....
protected void sendBuffer() {
.....
      if (chatroom) {
        groupchat.sendMessage(buf.toString());
      } else {
//DRH 4/13/05 change in favor of recipient list.       
//chat.sendMessage(buf.toString());
		  psuedoBroadcast(buf.toString());
	  }
    } catch (Exception e) {
      errorHandler.error(
        "Could not send message in IMAppender [" + name + "]", e,
        ErrorCode.GENERIC_FAILURE);
    }
  }

  /**
   * This method breaks up a comma-seperated recipient list
   * to allow for psuedo-broadcasting.
   */
  private void psuedoBroadcast(String bufferedmessage) throws XMPPException{
		StringTokenizer st = new StringTokenizer(recipient, ","); 
		while (st.hasMoreTokens()) {
	        chat = con.createChat(st.nextToken());
			chat.sendMessage(bufferedmessage);
		}  
  }

//=====end snippet=====

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org