You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shenyu.apache.org by XiaoYu <xi...@apache.org> on 2021/06/02 07:36:31 UTC

[DISCUSS] Used JAVA Lambda Optimized log printing

Hi Community

It is very appropriate to use the delayed nature of lambda expressions to
print logs.

If we should print logs, like this : `log.error("hello world"); `

If log level not config is ERROR,  This `Java String` is a loss to the
program.

Now if we used lambda expressions, like this : `log.error(() -> "hello
world ")`

It will only output if the log config is ERROR.

Based on the above considerations, I created
`org.apache.shenyu.common.utils.LogUtils`

This `LogUtils`  use lambda expressions to print logs.

In the shenyu project, should we use it all for printing logs?

Looking forward to your suggestions!

Thanks!

Re: [DISCUSS] Used JAVA Lambda Optimized log printing

Posted by 翟伟 <zh...@163.com>.
Ok, i do it




On 06/9/2021 14:12,XiaoYu<xi...@apache.org> wrote:
HI

its good job,I suggest that we start by using LogUtils.

thanks

翟伟 <zh...@163.com> 于2021年6月9日周三 下午1:14写道:

Hi,Logback has been used in the Shenyu project to record logs, and slf4j
has not been maintained for a long time. I think I can replace these with
`LogUtils`




On 06/2/2021 15:36,XiaoYu<xi...@apache.org> wrote:
Hi Community

It is very appropriate to use the delayed nature of lambda expressions to
print logs.

If we should print logs, like this : `log.error("hello world"); `

If log level not config is ERROR,  This `Java String` is a loss to the
program.

Now if we used lambda expressions, like this : `log.error(() -> "hello
world ")`

It will only output if the log config is ERROR.

Based on the above considerations, I created
`org.apache.shenyu.common.utils.LogUtils`

This `LogUtils`  use lambda expressions to print logs.

In the shenyu project, should we use it all for printing logs?

Looking forward to your suggestions!

Thanks!


Re: [DISCUSS] Used JAVA Lambda Optimized log printing

Posted by XiaoYu <xi...@apache.org>.
HI

its good job,I suggest that we start by using LogUtils.

thanks

翟伟 <zh...@163.com> 于2021年6月9日周三 下午1:14写道:

> Hi,Logback has been used in the Shenyu project to record logs, and slf4j
> has not been maintained for a long time. I think I can replace these with
> `LogUtils`
>
>
>
>
> On 06/2/2021 15:36,XiaoYu<xi...@apache.org> wrote:
> Hi Community
>
> It is very appropriate to use the delayed nature of lambda expressions to
> print logs.
>
> If we should print logs, like this : `log.error("hello world"); `
>
> If log level not config is ERROR,  This `Java String` is a loss to the
> program.
>
> Now if we used lambda expressions, like this : `log.error(() -> "hello
> world ")`
>
> It will only output if the log config is ERROR.
>
> Based on the above considerations, I created
> `org.apache.shenyu.common.utils.LogUtils`
>
> This `LogUtils`  use lambda expressions to print logs.
>
> In the shenyu project, should we use it all for printing logs?
>
> Looking forward to your suggestions!
>
> Thanks!
>

Re:[DISCUSS] Used JAVA Lambda Optimized log printing

Posted by 翟伟 <zh...@163.com>.
Hi,Logback has been used in the Shenyu project to record logs, and slf4j has not been maintained for a long time. I think I can replace these with `LogUtils`




On 06/2/2021 15:36,XiaoYu<xi...@apache.org> wrote:
Hi Community

It is very appropriate to use the delayed nature of lambda expressions to
print logs.

If we should print logs, like this : `log.error("hello world"); `

If log level not config is ERROR,  This `Java String` is a loss to the
program.

Now if we used lambda expressions, like this : `log.error(() -> "hello
world ")`

It will only output if the log config is ERROR.

Based on the above considerations, I created
`org.apache.shenyu.common.utils.LogUtils`

This `LogUtils`  use lambda expressions to print logs.

In the shenyu project, should we use it all for printing logs?

Looking forward to your suggestions!

Thanks!

Re:[DISCUSS] Used JAVA Lambda Optimized log printing

Posted by 翟伟 <zh...@163.com>.
I like this


On 06/2/2021 15:36,XiaoYu<xi...@apache.org> wrote:
Hi Community

It is very appropriate to use the delayed nature of lambda expressions to
print logs.

If we should print logs, like this : `log.error("hello world"); `

If log level not config is ERROR,  This `Java String` is a loss to the
program.

Now if we used lambda expressions, like this : `log.error(() -> "hello
world ")`

It will only output if the log config is ERROR.

Based on the above considerations, I created
`org.apache.shenyu.common.utils.LogUtils`

This `LogUtils`  use lambda expressions to print logs.

In the shenyu project, should we use it all for printing logs?

Looking forward to your suggestions!

Thanks!