You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by shafreen anfar <an...@gmail.com> on 2020/03/05 01:06:15 UTC

Add an improvement to log-mediator

Hi All,

I am Shafreen and I've been working with Synapse for many years. With this
mail I am sending a fix [1] to solve one of the issues I've been facing.

At the moment, even though log-mediator has a category called DEBUG, there
is no way to enable this category. Therefore, no logs are printed under
this category. The only workaround we have for this problem is to enable
debug logs for log-mediator class itself by configuring log4j.properties
file. But I believe, this configuration is for people who implement
log-mediator but not for synapse users.

IMO, synapse users should be able to enable debug mode of the log-mediator
without touching the log4j.properties file. As a solution, I have done a
fix [1] in which synapse users can start the server as follows,

sh synapse.sh -synapseDebug

When the server is started with the above flag, all the logs of
log-mediator under the category DEBUG is printed. For more information,
please have a look at [1] and [2]. Also, please note that the provided fix
is tested in both linux and windows.

[1] https://github.com/apache/synapse/pull/24
[2] https://issues.apache.org/jira/browse/SYNAPSE-1116

Re: Add an improvement to log-mediator

Posted by shafreen anfar <an...@gmail.com>.
Hi All,

On Wed, Mar 11, 2020 at 6:09 PM shafreen anfar <an...@gmail.com>
wrote:

> Hi Isuru,
>
> On Wed, Mar 11, 2020 at 6:58 AM Isuru Udana <is...@gmail.com> wrote:
>
>> Hi Shafreen,
>>
>> I have merged the Pull request. Can you please send a PR to update the
>> documentation as well?
>>
>
> Thanks. Will send a documentation PR soon.
>

Please find the documentation PR in link [1].

[1] https://github.com/apache/synapse/pull/29


>
>
>>
>> Thanks.
>>
>> On Fri, Mar 6, 2020 at 7:06 AM shafreen anfar <an...@gmail.com>
>> wrote:
>>
>>> On Thu, Mar 5, 2020 at 7:42 AM Sagara Gunathunga <
>>> sagara.gunathunga@gmail.com> wrote:
>>>
>>>>
>>>>
>>>> Although this makes the life easier by eliminating the log4j.properties
>>>> modifications, still, one has to restart the server to see debug logs. It
>>>> would have been great to have a simple remote API to make these changes on
>>>> a running server.
>>>>
>>>
>>> Agreed. Having to restart could be problematic, especially in production
>>> environment. I will check how we can improve this further as the next step.
>>> Also, log4j.properties modification actually prints logs related to
>>> implementation of log-mediator along with synapse user log-mediator output.
>>> Provided fix eliminates these additional logs.
>>>
>>>
>>>>
>>>> BTW this is a useful improvement; but, you need to think about a better
>>>> name than "synapseDebug" to reflect the purpose of this setting. To
>>>> me, synapseDebug implies that the whole server will be in debug mode and
>>>> can be connected through an IDE.  What about more descriptive and generic
>>>> name like this   *-synapse.mediator.log.level.debug* that can be used
>>>> to change the log of the level of log mediator without limiting to debug
>>>> only?
>>>>
>>>> Thanks!
>>>>
>>>> On Thu, Mar 5, 2020 at 2:06 PM shafreen anfar <an...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi All,
>>>>>
>>>>> I am Shafreen and I've been working with Synapse for many years. With
>>>>> this mail I am sending a fix [1] to solve one of the issues I've been
>>>>> facing.
>>>>>
>>>>> At the moment, even though log-mediator has a category called DEBUG,
>>>>> there is no way to enable this category. Therefore, no logs are printed
>>>>> under this category. The only workaround we have for this problem is to
>>>>> enable debug logs for log-mediator class itself by configuring
>>>>> log4j.properties file. But I believe, this configuration is for people who
>>>>> implement log-mediator but not for synapse users.
>>>>>
>>>>> IMO, synapse users should be able to enable debug mode of the
>>>>> log-mediator without touching the log4j.properties file. As a solution, I
>>>>> have done a fix [1] in which synapse users can start the server as follows,
>>>>>
>>>>> sh synapse.sh -synapseDebug
>>>>>
>>>>> When the server is started with the above flag, all the logs of
>>>>> log-mediator under the category DEBUG is printed. For more information,
>>>>> please have a look at [1] and [2]. Also, please note that the provided fix
>>>>> is tested in both linux and windows.
>>>>>
>>>>> [1] https://github.com/apache/synapse/pull/24
>>>>> [2] https://issues.apache.org/jira/browse/SYNAPSE-1116
>>>>>
>>>>>
>>>>
>>>> --
>>>> Sagara Gunathunga
>>>>
>>>> Blog      - http://ssagara.blogspot.com
>>>> Web      - http://people.apache.org/~sagara/
>>>> LinkedIn - http://www.linkedin.com/in/ssagara
>>>>
>>>
>>
>> --
>> *Isuru Udana*
>> Associate Director/Architect
>>
>>
>>
>> *; WSO2 Inc.; http://wso2.com <http://wso2.com>email: isudana@gmail.com
>> <is...@gmail.com> *
>>
>>
>>

Re: Add an improvement to log-mediator

Posted by shafreen anfar <an...@gmail.com>.
Hi Isuru,

On Wed, Mar 11, 2020 at 6:58 AM Isuru Udana <is...@gmail.com> wrote:

> Hi Shafreen,
>
> I have merged the Pull request. Can you please send a PR to update the
> documentation as well?
>

Thanks. Will send a documentation PR soon.


>
> Thanks.
>
> On Fri, Mar 6, 2020 at 7:06 AM shafreen anfar <an...@gmail.com>
> wrote:
>
>> On Thu, Mar 5, 2020 at 7:42 AM Sagara Gunathunga <
>> sagara.gunathunga@gmail.com> wrote:
>>
>>>
>>>
>>> Although this makes the life easier by eliminating the log4j.properties
>>> modifications, still, one has to restart the server to see debug logs. It
>>> would have been great to have a simple remote API to make these changes on
>>> a running server.
>>>
>>
>> Agreed. Having to restart could be problematic, especially in production
>> environment. I will check how we can improve this further as the next step.
>> Also, log4j.properties modification actually prints logs related to
>> implementation of log-mediator along with synapse user log-mediator output.
>> Provided fix eliminates these additional logs.
>>
>>
>>>
>>> BTW this is a useful improvement; but, you need to think about a better
>>> name than "synapseDebug" to reflect the purpose of this setting. To me,
>>> synapseDebug implies that the whole server will be in debug mode and can be
>>> connected through an IDE.  What about more descriptive and generic name
>>> like this   *-synapse.mediator.log.level.debug* that can be used to
>>> change the log of the level of log mediator without limiting to debug
>>> only?
>>>
>>> Thanks!
>>>
>>> On Thu, Mar 5, 2020 at 2:06 PM shafreen anfar <an...@gmail.com>
>>> wrote:
>>>
>>>> Hi All,
>>>>
>>>> I am Shafreen and I've been working with Synapse for many years. With
>>>> this mail I am sending a fix [1] to solve one of the issues I've been
>>>> facing.
>>>>
>>>> At the moment, even though log-mediator has a category called DEBUG,
>>>> there is no way to enable this category. Therefore, no logs are printed
>>>> under this category. The only workaround we have for this problem is to
>>>> enable debug logs for log-mediator class itself by configuring
>>>> log4j.properties file. But I believe, this configuration is for people who
>>>> implement log-mediator but not for synapse users.
>>>>
>>>> IMO, synapse users should be able to enable debug mode of the
>>>> log-mediator without touching the log4j.properties file. As a solution, I
>>>> have done a fix [1] in which synapse users can start the server as follows,
>>>>
>>>> sh synapse.sh -synapseDebug
>>>>
>>>> When the server is started with the above flag, all the logs of
>>>> log-mediator under the category DEBUG is printed. For more information,
>>>> please have a look at [1] and [2]. Also, please note that the provided fix
>>>> is tested in both linux and windows.
>>>>
>>>> [1] https://github.com/apache/synapse/pull/24
>>>> [2] https://issues.apache.org/jira/browse/SYNAPSE-1116
>>>>
>>>>
>>>
>>> --
>>> Sagara Gunathunga
>>>
>>> Blog      - http://ssagara.blogspot.com
>>> Web      - http://people.apache.org/~sagara/
>>> LinkedIn - http://www.linkedin.com/in/ssagara
>>>
>>
>
> --
> *Isuru Udana*
> Associate Director/Architect
>
>
>
> *; WSO2 Inc.; http://wso2.com <http://wso2.com>email: isudana@gmail.com
> <is...@gmail.com> *
>
>
>

Re: Add an improvement to log-mediator

Posted by Isuru Udana <is...@gmail.com>.
Hi Shafreen,

I have merged the Pull request. Can you please send a PR to update the
documentation as well?

Thanks.

On Fri, Mar 6, 2020 at 7:06 AM shafreen anfar <an...@gmail.com>
wrote:

> On Thu, Mar 5, 2020 at 7:42 AM Sagara Gunathunga <
> sagara.gunathunga@gmail.com> wrote:
>
>>
>>
>> Although this makes the life easier by eliminating the log4j.properties
>> modifications, still, one has to restart the server to see debug logs. It
>> would have been great to have a simple remote API to make these changes on
>> a running server.
>>
>
> Agreed. Having to restart could be problematic, especially in production
> environment. I will check how we can improve this further as the next step.
> Also, log4j.properties modification actually prints logs related to
> implementation of log-mediator along with synapse user log-mediator output.
> Provided fix eliminates these additional logs.
>
>
>>
>> BTW this is a useful improvement; but, you need to think about a better
>> name than "synapseDebug" to reflect the purpose of this setting. To me,
>> synapseDebug implies that the whole server will be in debug mode and can be
>> connected through an IDE.  What about more descriptive and generic name
>> like this   *-synapse.mediator.log.level.debug* that can be used to
>> change the log of the level of log mediator without limiting to debug
>> only?
>>
>> Thanks!
>>
>> On Thu, Mar 5, 2020 at 2:06 PM shafreen anfar <an...@gmail.com>
>> wrote:
>>
>>> Hi All,
>>>
>>> I am Shafreen and I've been working with Synapse for many years. With
>>> this mail I am sending a fix [1] to solve one of the issues I've been
>>> facing.
>>>
>>> At the moment, even though log-mediator has a category called DEBUG,
>>> there is no way to enable this category. Therefore, no logs are printed
>>> under this category. The only workaround we have for this problem is to
>>> enable debug logs for log-mediator class itself by configuring
>>> log4j.properties file. But I believe, this configuration is for people who
>>> implement log-mediator but not for synapse users.
>>>
>>> IMO, synapse users should be able to enable debug mode of the
>>> log-mediator without touching the log4j.properties file. As a solution, I
>>> have done a fix [1] in which synapse users can start the server as follows,
>>>
>>> sh synapse.sh -synapseDebug
>>>
>>> When the server is started with the above flag, all the logs of
>>> log-mediator under the category DEBUG is printed. For more information,
>>> please have a look at [1] and [2]. Also, please note that the provided fix
>>> is tested in both linux and windows.
>>>
>>> [1] https://github.com/apache/synapse/pull/24
>>> [2] https://issues.apache.org/jira/browse/SYNAPSE-1116
>>>
>>>
>>
>> --
>> Sagara Gunathunga
>>
>> Blog      - http://ssagara.blogspot.com
>> Web      - http://people.apache.org/~sagara/
>> LinkedIn - http://www.linkedin.com/in/ssagara
>>
>

-- 
*Isuru Udana*
Associate Director/Architect



*; WSO2 Inc.; http://wso2.com <http://wso2.com>email: isudana@gmail.com
<is...@gmail.com> *

Re: Add an improvement to log-mediator

Posted by shafreen anfar <an...@gmail.com>.
On Thu, Mar 5, 2020 at 7:42 AM Sagara Gunathunga <
sagara.gunathunga@gmail.com> wrote:

>
>
> Although this makes the life easier by eliminating the log4j.properties
> modifications, still, one has to restart the server to see debug logs. It
> would have been great to have a simple remote API to make these changes on
> a running server.
>

Agreed. Having to restart could be problematic, especially in production
environment. I will check how we can improve this further as the next step.
Also, log4j.properties modification actually prints logs related to
implementation of log-mediator along with synapse user log-mediator output.
Provided fix eliminates these additional logs.


>
> BTW this is a useful improvement; but, you need to think about a better
> name than "synapseDebug" to reflect the purpose of this setting. To me,
> synapseDebug implies that the whole server will be in debug mode and can be
> connected through an IDE.  What about more descriptive and generic name
> like this   *-synapse.mediator.log.level.debug* that can be used to
> change the log of the level of log mediator without limiting to debug
> only?
>
> Thanks!
>
> On Thu, Mar 5, 2020 at 2:06 PM shafreen anfar <an...@gmail.com>
> wrote:
>
>> Hi All,
>>
>> I am Shafreen and I've been working with Synapse for many years. With
>> this mail I am sending a fix [1] to solve one of the issues I've been
>> facing.
>>
>> At the moment, even though log-mediator has a category called DEBUG,
>> there is no way to enable this category. Therefore, no logs are printed
>> under this category. The only workaround we have for this problem is to
>> enable debug logs for log-mediator class itself by configuring
>> log4j.properties file. But I believe, this configuration is for people who
>> implement log-mediator but not for synapse users.
>>
>> IMO, synapse users should be able to enable debug mode of the
>> log-mediator without touching the log4j.properties file. As a solution, I
>> have done a fix [1] in which synapse users can start the server as follows,
>>
>> sh synapse.sh -synapseDebug
>>
>> When the server is started with the above flag, all the logs of
>> log-mediator under the category DEBUG is printed. For more information,
>> please have a look at [1] and [2]. Also, please note that the provided fix
>> is tested in both linux and windows.
>>
>> [1] https://github.com/apache/synapse/pull/24
>> [2] https://issues.apache.org/jira/browse/SYNAPSE-1116
>>
>>
>
> --
> Sagara Gunathunga
>
> Blog      - http://ssagara.blogspot.com
> Web      - http://people.apache.org/~sagara/
> LinkedIn - http://www.linkedin.com/in/ssagara
>

Re: Add an improvement to log-mediator

Posted by Isuru Udana <is...@gmail.com>.
On Thu, Mar 5, 2020 at 7:42 AM Sagara Gunathunga <
sagara.gunathunga@gmail.com> wrote:

>
>
> Although this makes the life easier by eliminating the log4j.properties
> modifications, still, one has to restart the server to see debug logs. It
> would have been great to have a simple remote API to make these changes on
> a running server.
>
+1, we can do it as an improvement.

>
> BTW this is a useful improvement; but, you need to think about a better
> name than "synapseDebug" to reflect the purpose of this setting. To me,
> synapseDebug implies that the whole server will be in debug mode and can be
> connected through an IDE.  What about more descriptive and generic name
> like this   *-synapse.mediator.log.level.debug* that can be used to
> change the log of the level of log mediator without limiting to debug
> only?
>
Yes, this is a useful improvement. IMO, we can treat this as a starting
point for implementing a debug mode for the server (Logs become part of
it).


btw,
Shafreen and Sagara,
Welcome to the Synapse-dev. Looking forward to more contributions from you
:)

>
> Thanks!
>
> On Thu, Mar 5, 2020 at 2:06 PM shafreen anfar <an...@gmail.com>
> wrote:
>
>> Hi All,
>>
>> I am Shafreen and I've been working with Synapse for many years. With
>> this mail I am sending a fix [1] to solve one of the issues I've been
>> facing.
>>
>> At the moment, even though log-mediator has a category called DEBUG,
>> there is no way to enable this category. Therefore, no logs are printed
>> under this category. The only workaround we have for this problem is to
>> enable debug logs for log-mediator class itself by configuring
>> log4j.properties file. But I believe, this configuration is for people who
>> implement log-mediator but not for synapse users.
>>
>> IMO, synapse users should be able to enable debug mode of the
>> log-mediator without touching the log4j.properties file. As a solution, I
>> have done a fix [1] in which synapse users can start the server as follows,
>>
>> sh synapse.sh -synapseDebug
>>
>> When the server is started with the above flag, all the logs of
>> log-mediator under the category DEBUG is printed. For more information,
>> please have a look at [1] and [2]. Also, please note that the provided fix
>> is tested in both linux and windows.
>>
>> [1] https://github.com/apache/synapse/pull/24
>> [2] https://issues.apache.org/jira/browse/SYNAPSE-1116
>>
>>
>
> --
> Sagara Gunathunga
>
> Blog      - http://ssagara.blogspot.com
> Web      - http://people.apache.org/~sagara/
> LinkedIn - http://www.linkedin.com/in/ssagara
>


-- 
*Isuru Udana*
Associate Director/Architect



*; WSO2 Inc.; http://wso2.com <http://wso2.com>email: isudana@gmail.com
<is...@gmail.com> *

Re: Add an improvement to log-mediator

Posted by Sagara Gunathunga <sa...@gmail.com>.
Although this makes the life easier by eliminating the log4j.properties
modifications, still, one has to restart the server to see debug logs. It
would have been great to have a simple remote API to make these changes on
a running server.

BTW this is a useful improvement; but, you need to think about a better
name than "synapseDebug" to reflect the purpose of this setting. To me,
synapseDebug implies that the whole server will be in debug mode and can be
connected through an IDE.  What about more descriptive and generic name
like this   *-synapse.mediator.log.level.debug* that can be used to change
the log of the level of log mediator without limiting to debug only?

Thanks!

On Thu, Mar 5, 2020 at 2:06 PM shafreen anfar <an...@gmail.com>
wrote:

> Hi All,
>
> I am Shafreen and I've been working with Synapse for many years. With this
> mail I am sending a fix [1] to solve one of the issues I've been facing.
>
> At the moment, even though log-mediator has a category called DEBUG, there
> is no way to enable this category. Therefore, no logs are printed under
> this category. The only workaround we have for this problem is to enable
> debug logs for log-mediator class itself by configuring log4j.properties
> file. But I believe, this configuration is for people who implement
> log-mediator but not for synapse users.
>
> IMO, synapse users should be able to enable debug mode of the log-mediator
> without touching the log4j.properties file. As a solution, I have done a
> fix [1] in which synapse users can start the server as follows,
>
> sh synapse.sh -synapseDebug
>
> When the server is started with the above flag, all the logs of
> log-mediator under the category DEBUG is printed. For more information,
> please have a look at [1] and [2]. Also, please note that the provided fix
> is tested in both linux and windows.
>
> [1] https://github.com/apache/synapse/pull/24
> [2] https://issues.apache.org/jira/browse/SYNAPSE-1116
>
>

-- 
Sagara Gunathunga

Blog      - http://ssagara.blogspot.com
Web      - http://people.apache.org/~sagara/
LinkedIn - http://www.linkedin.com/in/ssagara