You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Yakov Zhdanov <yz...@apache.org> on 2015/12/14 13:01:36 UTC

Debug Output in Prod

Guys,

I noticed the following code in repo several days
ago(org/apache/ignite/internal/portable/BinaryWriterExImpl.java:1810):


out.unsafeEnsure(1 + 4);

out.unsafeWriteByte(GridPortableMarshaller.HANDLE);
out.unsafeWriteInt(pos - old);

if (obj.getClass().isArray())
    System.out.println("CASE!");

return true;

Couple of points here:

1. When putting debug output to production code use U.debug(). This method
gives at least deprecation warning which can be caught and debug printouts
will not get to the repo + it prints timestamp and thread name.
2. Can we change release build to fail if U.debug() is somewhere in
production code? Anton V, perhaps you know how to achieve that?

--Yakov

Re: Debug Output in Prod

Posted by Yakov Zhdanov <yz...@apache.org>.
No, it prints to std or to log with INFO level. Let's postpone this for
now, however, I ask everyone to be attentive and remove debug output on
commit.

--Yakov

2015-12-14 15:46 GMT+03:00 Anton Vinogradov <av...@gridgain.com>:

> Yakov,
> We can simply grep sources for U.debug(), but I'm not sure it helpes.
>
> Am I rigth that we have to reconfigure log4j setting each time we want to
> use U.debug()?
>
> On Mon, Dec 14, 2015 at 3:01 PM, Yakov Zhdanov <yz...@apache.org>
> wrote:
>
> > Guys,
> >
> > I noticed the following code in repo several days
> > ago(org/apache/ignite/internal/portable/BinaryWriterExImpl.java:1810):
> >
> >
> > out.unsafeEnsure(1 + 4);
> >
> > out.unsafeWriteByte(GridPortableMarshaller.HANDLE);
> > out.unsafeWriteInt(pos - old);
> >
> > if (obj.getClass().isArray())
> >     System.out.println("CASE!");
> >
> > return true;
> >
> > Couple of points here:
> >
> > 1. When putting debug output to production code use U.debug(). This
> method
> > gives at least deprecation warning which can be caught and debug
> printouts
> > will not get to the repo + it prints timestamp and thread name.
> > 2. Can we change release build to fail if U.debug() is somewhere in
> > production code? Anton V, perhaps you know how to achieve that?
> >
> > --Yakov
> >
>

Re: Debug Output in Prod

Posted by Anton Vinogradov <av...@gridgain.com>.
Yakov,
We can simply grep sources for U.debug(), but I'm not sure it helpes.

Am I rigth that we have to reconfigure log4j setting each time we want to
use U.debug()?

On Mon, Dec 14, 2015 at 3:01 PM, Yakov Zhdanov <yz...@apache.org> wrote:

> Guys,
>
> I noticed the following code in repo several days
> ago(org/apache/ignite/internal/portable/BinaryWriterExImpl.java:1810):
>
>
> out.unsafeEnsure(1 + 4);
>
> out.unsafeWriteByte(GridPortableMarshaller.HANDLE);
> out.unsafeWriteInt(pos - old);
>
> if (obj.getClass().isArray())
>     System.out.println("CASE!");
>
> return true;
>
> Couple of points here:
>
> 1. When putting debug output to production code use U.debug(). This method
> gives at least deprecation warning which can be caught and debug printouts
> will not get to the repo + it prints timestamp and thread name.
> 2. Can we change release build to fail if U.debug() is somewhere in
> production code? Anton V, perhaps you know how to achieve that?
>
> --Yakov
>