You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Philip Denno <pd...@tsi.bc.ca> on 2007/07/05 20:40:16 UTC

SocketHubAppender

The project I am working on is very multi - threaded (> 500 threads) and
I have implemented the SocketHubAppender to send all the events to
Chainsaw.
 
Everything works fine (most times) but occasionally I get the following
stack trace:
 
 java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
     at java.util.Vector.removeElementAt(Vector.java:518)
     at
org.apache.log4j.net.SocketHubAppender.append(SocketHubAppender.java:208
)
     etc...
 
It seems to crash at random and at different places in my application.
 
So my question is: 
 
    Is SocketHubAppender not thread safe?
 
Cheers,
Philip.
 

__________________


IMPORTANT NOTICE
Email from TSI Terminal Systems Inc. (TSI) is confidential and may be legally privileged. If it is not intended for you, please delete it immediately unread. Under no circumstances should this e-mail be redistributed without prior written consent of TSI. The internet cannot guarantee that this communication is free of viruses, interception or interference and anyone who communicates with us by email is taken to accept the risks in doing so. Without limitation, TSI and its affiliates accept no liability whatsoever and howsoever arising in connection with the use of this email. Under no circumstances shall this email constitute a binding agreement for provision of services by TSI, which is subject to the terms and conditions of TSI's standard schedule for Terminal Tariffs which is also available at http://www.tsi.bc.ca.

RE: [BULK] Re: SocketHubAppender

Posted by Philip Denno <pd...@tsi.bc.ca>.
I'm using 1.2.9

I synchronized access around the append method and it no longer crashes
(at least it hasn't yet) so
I think the problem is solved.

Cheers,
Philip. 

-----Original Message-----
From: Paul Smith [mailto:psmith@aconex.com] 
Sent: Thursday, July 05, 2007 8:55 PM
To: Log4J Users List
Subject: [BULK] Re: SocketHubAppender
Importance: Low

Can you post a full stack trace of this?  Which log4j version are you
using?  Neither the latest 1.2.x series or from trunk appear to match up
the line #'s.

Perhaps you are using an older 1.2, because in the latest 1.2 version of
SocketHubAppender that exception is not logged (there is a try/ catch
block to trap ArrayIndexOutOfBoundsException, but I think that's
defending against logging done during the cleanup/close of the
appender).

cheers,

Paul

On 06/07/2007, at 4:40 AM, Philip Denno wrote:

> The project I am working on is very multi - threaded (> 500
> threads) and
> I have implemented the SocketHubAppender to send all the events to 
> Chainsaw.
>
> Everything works fine (most times) but occasionally I get the 
> following stack trace:
>
>  java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
>      at java.util.Vector.removeElementAt(Vector.java:518)
>      at
> org.apache.log4j.net.SocketHubAppender.append
> (SocketHubAppender.java:208
> )
>      etc...
>
> It seems to crash at random and at different places in my application.
>
> So my question is:
>
>     Is SocketHubAppender not thread safe?
>
> Cheers,
> Philip.
>
>
> __________________
>
>
> IMPORTANT NOTICE
> Email from TSI Terminal Systems Inc. (TSI) is confidential and may be 
> legally privileged. If it is not intended for you, please delete it 
> immediately unread. Under no circumstances should this e-mail be 
> redistributed without prior written consent of TSI. The internet 
> cannot guarantee that this communication is free of viruses, 
> interception or interference and anyone who communicates with us by 
> email is taken to accept the risks in doing so. Without limitation, 
> TSI and its affiliates accept no liability whatsoever and howsoever 
> arising in connection with the use of this email. Under no 
> circumstances shall this email constitute a binding agreement for 
> provision of services by TSI, which is subject to the terms and 
> conditions of TSI's standard schedule for Terminal Tariffs which is 
> also available at http://www.tsi.bc.ca.

Paul Smith
Core Engineering Manager

Aconex
The easy way to save time and money on your project

696 Bourke Street, Melbourne,
VIC 3000, Australia
Tel: +61 3 9240 0200  Fax: +61 3 9240 0299
Email: psmith@aconex.com  www.aconex.com

This email and any attachments are intended solely for the addressee.  
The contents may be privileged, confidential and/or subject to copyright
or other applicable law. No confidentiality or privilege is lost by an
erroneous transmission. If you have received this e-mail in error,
please let us know by reply e-mail and delete or destroy this mail and
all copies. If you are not the intended recipient of this message you
must not disseminate, copy or take any action in reliance on it. The
sender takes no responsibility for the effect of this message upon the
recipient's computer system.




__________________


IMPORTANT NOTICE
Email from TSI Terminal Systems Inc. (TSI) is confidential and may be legally privileged. If it is not intended for you, please delete it immediately unread. Under no circumstances should this e-mail be redistributed without prior written consent of TSI. The internet cannot guarantee that this communication is free of viruses, interception or interference and anyone who communicates with us by email is taken to accept the risks in doing so. Without limitation, TSI and its affiliates accept no liability whatsoever and howsoever arising in connection with the use of this email. Under no circumstances shall this email constitute a binding agreement for provision of services by TSI, which is subject to the terms and conditions of TSI's standard schedule for Terminal Tariffs which is also available at http://www.tsi.bc.ca.

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


Re: SocketHubAppender

Posted by Paul Smith <ps...@aconex.com>.
Can you post a full stack trace of this?  Which log4j version are you  
using?  Neither the latest 1.2.x series or from trunk appear to match  
up the line #'s.

Perhaps you are using an older 1.2, because in the latest 1.2 version  
of SocketHubAppender that exception is not logged (there is a try/ 
catch block to trap ArrayIndexOutOfBoundsException, but I think  
that's defending against logging done during the cleanup/close of the  
appender).

cheers,

Paul

On 06/07/2007, at 4:40 AM, Philip Denno wrote:

> The project I am working on is very multi - threaded (> 500  
> threads) and
> I have implemented the SocketHubAppender to send all the events to
> Chainsaw.
>
> Everything works fine (most times) but occasionally I get the  
> following
> stack trace:
>
>  java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
>      at java.util.Vector.removeElementAt(Vector.java:518)
>      at
> org.apache.log4j.net.SocketHubAppender.append 
> (SocketHubAppender.java:208
> )
>      etc...
>
> It seems to crash at random and at different places in my application.
>
> So my question is:
>
>     Is SocketHubAppender not thread safe?
>
> Cheers,
> Philip.
>
>
> __________________
>
>
> IMPORTANT NOTICE
> Email from TSI Terminal Systems Inc. (TSI) is confidential and may  
> be legally privileged. If it is not intended for you, please delete  
> it immediately unread. Under no circumstances should this e-mail be  
> redistributed without prior written consent of TSI. The internet  
> cannot guarantee that this communication is free of viruses,  
> interception or interference and anyone who communicates with us by  
> email is taken to accept the risks in doing so. Without limitation,  
> TSI and its affiliates accept no liability whatsoever and howsoever  
> arising in connection with the use of this email. Under no  
> circumstances shall this email constitute a binding agreement for  
> provision of services by TSI, which is subject to the terms and  
> conditions of TSI's standard schedule for Terminal Tariffs which is  
> also available at http://www.tsi.bc.ca.

Paul Smith
Core Engineering Manager

Aconex
The easy way to save time and money on your project

696 Bourke Street, Melbourne,
VIC 3000, Australia
Tel: +61 3 9240 0200  Fax: +61 3 9240 0299
Email: psmith@aconex.com  www.aconex.com

This email and any attachments are intended solely for the addressee.  
The contents may be privileged, confidential and/or subject to  
copyright or other applicable law. No confidentiality or privilege is  
lost by an erroneous transmission. If you have received this e-mail  
in error, please let us know by reply e-mail and delete or destroy  
this mail and all copies. If you are not the intended recipient of  
this message you must not disseminate, copy or take any action in  
reliance on it. The sender takes no responsibility for the effect of  
this message upon the recipient's computer system.