On Thu, Jun 7, 2012 at 11:29 AM, Amila Maha Arachchi <[email protected]>wrote:

>
>
> On Thu, Jun 7, 2012 at 11:13 AM, Nirmal Fernando <[email protected]> wrote:
>
>> Hi,
>>
>> On Thu, Jun 7, 2012 at 11:07 AM, Amila Maha Arachchi <[email protected]>wrote:
>>
>>>
>>>
>>> On Thu, Jun 7, 2012 at 11:00 AM, Amila Maha Arachchi <[email protected]>wrote:
>>>
>>>> Hi Lakmali,
>>>>
>>>> On Thu, Jun 7, 2012 at 10:33 AM, Lakmali Baminiwatta 
>>>> <[email protected]>wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I encountered Java OutOfMemoryError while testing ESB Smooks Mediator
>>>>> with big messages.
>>>>>
>>>>> at
>>>>> org.wso2.carbon.activation.module.ActivationHandler.invoke(ActivationHandler.java:51)
>>>>>     at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
>>>>>     at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
>>>>>
>>>>> This occurs because ActivationHandler class of stratos
>>>>> org.wso2.carbon.activation component logs the message as follows.
>>>>>
>>>>> log.debug("Staring Activation Handler invocation. Incoming Message: " +
>>>>>                 messageContext.getEnvelope().toString());
>>>>>
>>>>> Shall we change this to log only when debug mode is enabled?
>>>>>
>>>>
>>>> Looking into this.
>>>>
>>>
>>> Fixed to look for isDebugEnabled at r129418.
>>>
>>
>> In a related note, you mind explaining the rationale for doing this
>> (performing this check before calling log.debug)? Is this a limitation in
>> log4j?
>>
>
> If there is nothing to process before logging, i.e. if it is just a string
> which you are trying to log you dont need to check for debug enabled.
> AFAIK, what happens is, log4 first prepares the message and then checks
> whether debug is enabled. So in this case, it processes the
> envelop.toString() before checking whether debug is enabled. Thats how it
> went OOM in this scenario.
>
> So, in practice, if there is some processing involved when preparing the
> log message, you need to check the preferred log level to avoid unnecessary
> processing.
>

Got it! I always wondered why doing this! :)

>
>
>>
>> I felt very odd when doing this. :)
>>
>>
>>>
>>>> AmilaM.
>>>>
>>>>>
>>>>> Thanks,
>>>>> Lakmali
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Lakmali Baminiwatta*
>>>>> *
>>>>> Software Engineer
>>>>> WSO2, Inc.: http://wso2.com
>>>>> lean.enterprise.middleware
>>>>>
>>>>>  *
>>>>> *
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> [email protected]
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> *Amila Maharachchi*
>>>> Technical Lead
>>>> Member, Management Committee - Cloud & Platform TG
>>>> WSO2, Inc.; http://wso2.com
>>>>
>>>> Blog: http://maharachchi.blogspot.com
>>>> Mobile: +94719371446
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> *Amila Maharachchi*
>>> Technical Lead
>>> Member, Management Committee - Cloud & Platform TG
>>> WSO2, Inc.; http://wso2.com
>>>
>>> Blog: http://maharachchi.blogspot.com
>>> Mobile: +94719371446
>>>
>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>>
>> Thanks & regards,
>> Nirmal
>>
>> Software Engineer- Platform Technologies Team, WSO2 Inc.
>> Mobile: +94715779733
>> Blog: http://nirmalfdo.blogspot.com/
>>
>
>
>
> --
> *Amila Maharachchi*
> Technical Lead
> Member, Management Committee - Cloud & Platform TG
> WSO2, Inc.; http://wso2.com
>
> Blog: http://maharachchi.blogspot.com
> Mobile: +94719371446
>
>
>


-- 

Thanks & regards,
Nirmal

Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: +94715779733
Blog: http://nirmalfdo.blogspot.com/
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to