Alexei,

I see you've merged LoggerWrapper into main and use it in Raft module.
I can't figure out what manner you suggest to use LoggerWrapper in.
In the example above 'LOG' field is static, non-final and you create a
wrapper explicitly.

I see 2 ways:
* Use a factory method to create a logger and set it into 'static final'
field.
In this case, a user will not be able to split logs from different nodes
running in the same JVM.
* Set logger into non-static field (with dependency injection future).
In this case, we need to pass the logger to every class instance where it
can be used.


On Fri, Mar 26, 2021 at 6:48 PM Вячеслав Коптилин <slava.kopti...@gmail.com>
wrote:

> Hello Alexei,
>
> It would be nice to add something like as follows:
>     boolean isInfoEnabled();
>     boolean isDebugEnabled();
> or
>     boolean isLoggable(Level) - the same way which System.Logger suggests
>
> Thanks,
> S.
>
> пт, 26 мар. 2021 г. в 17:41, Alexei Scherbakov <
> alexey.scherbak...@gmail.com
> >:
>
> > Andrey,
> >
> > I've introduced a new class LogWrapper to fix usability issues [1]
> >
> > The suggested usage is something like:
> >
> > private static LogWrapper LOG = new LogWrapper(MyClass.class);
> >
> > [1]
> >
> >
> https://github.com/gridgain/apache-ignite-3/blob/9acb050a6a6a601ead849797293a1d0ad48ab9e0/modules/core/src/main/java/org/apache/ignite/lang/LogWrapper.java
> >
> > пт, 26 мар. 2021 г. в 16:05, Andrey Mashenkov <
> andrey.mashen...@gmail.com
> > >:
> >
> > > Forgot to attach a link to the PR with an example [1].
> > >
> > > [1] https://github.com/apache/ignite-3/pull/59
> > >
> > > On Fri, Mar 26, 2021 at 4:03 PM Andrey Mashenkov <
> > > andrey.mashen...@gmail.com>
> > > wrote:
> > >
> > > > Hi Igniters,
> > > >
> > > > In almost every new task we faced the problem of what logger has to
> be
> > > > used: JUL. log4J or any else.
> > > >
> > > > Since JDK 9 there is a System.Logger which interface looks acceptable
> > for
> > > > use,
> > > > excepts maybe some usability issues like method signatures.
> > > > LogLevel is passed as a mandatory argument, and no shortcut methods
> are
> > > > provided (like 'warn', 'error' or 'info').
> > > >
> > > > I like Alex Scherbakov idea [1] to use a brand new JDK system logger
> by
> > > > default and
> > > > extend it with shortcut methods.
> > > >
> > > > I've created a ticket to unify logger usage in Ignite-3.0 project to
> > fix
> > > > already existed code.
> > > >
> > > > Any thoughts or objections?
> > > >
> > > > --
> > > > Best regards,
> > > > Andrey V. Mashenkov
> > > >
> > >
> > >
> > > --
> > > Best regards,
> > > Andrey V. Mashenkov
> > >
> >
> >
> > --
> >
> > Best regards,
> > Alexei Scherbakov
> >
>


-- 
Best regards,
Andrey V. Mashenkov

Reply via email to