+1

On Mon, Feb 23, 2015 at 7:27 AM, Lahiru Sandaruwan <lahi...@wso2.com> wrote:

> Hi all,
>
> There are lot of different approaches of logging in Stratos code. May be
> we can follow same format so that code looks clean and understandable. This
> is to decide which way we should follow.
>
> *1. Separation of objects*
>
> We are using square brackets in most of the places. I think that is a good
> approach. May be we can use a comma after one object. We need to decide.
>
> E.g. 1
>
> [network-partition] network-partition-1 [cluster-instance]
> single-cartridge-app-1 [cluster] php1.php.domain
>
I prefer this, we have used this in most of the logs

> E.g. 2
>
> [network-partition] network-partition-1, [cluster-instance]
> single-cartridge-app-1, [cluster] php1.php.domain
>
IMO square bracket itself becomes a separator

> *2. Using same text for identifying a particular type*
> E.g. We use [network-parition], [NW partition], [network partition] in
> different places. We could stick to one.
>
> I prefer [network-partition], we have used this in most of the logs


> *3. Using the String.format or concatenation. *
>
> String.format brings clarity and readability while it reduces the
> performance against concatenation. We need to decide what should be our
> choice. I would vote for String.format considering performance gain is
> negligible if we only have info level logs.
>
> +1 Yes this is the reason for using String.format()


> *4. Use isDebugEnabled() and don't use isInfoEnabled()*
>
> Regarding this, we must use *isDebugEnabled* everywhere we do debug
> logging. But i think we can skip *isInfoEnabled *assuming we will have
> info logs in limited numbers. Wdyt?
>
>
> Agree with Isuru on this.

Thanks


-- 
Imesh Gunaratne

Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

Reply via email to