Wasn't there an intention to replace System.out with LOG.debug() (with if (LOG.isDebugEnabled())? I remember seeing (or was I dreaming) it but can not find it any more
AR> Wasn't there an intention to replace System.out with LOG.debug() AR> (with if AR> (LOG.isDebugEnabled())? AR> I remember seeing (or was I dreaming) it but can not find it any AR> more
As far as I know, the IG inspection which searches for uses of System.out does not provide a quickfix. In Demetra, you can set up a Structural Search inspection to perform the searcn and replace for you.
-- Dmitry Jemerov Software Developer JetBrains, Inc. http://www.jetbrains.com "Develop with pleasure!"
Wasn't there an intention to replace System.out with LOG.debug() (with if (LOG.isDebugEnabled())? I remember seeing (or was I dreaming) it but can not find it any more
Hi Alex,
Why don't you use the power of live templates? Here's what I am using whenever I need to insert debug code:
You can do structural replace finding System.out.println($a$); and replacing it by if (LOG.isDebugEnabled()) { LOG.debug($a$); }
Alex Roytman wrote:
Wasn't there an intention to replace System.out with LOG.debug() (with if (LOG.isDebugEnabled())? I remember seeing (or was I dreaming) it but can not find it any more
-- Best regards, Maxim Mossienko IntelliJ Labs / JetBrains Inc. http://www.intellij.com "Develop with pleasure!"
In Demetra, you can set up a Structural Search inspection to perform the searcn and replace for you.
Unfortunately, this is not an optimal solution because SS is not powerful enough to distinguish whether a statement is wrapped in an if-clause or not - at least AFAIK.
>> In Demetra, you can set up a >> Structural Search inspection to perform the searcn and replace for you.
Unfortunately, this is not an optimal solution because SS is not powerful enough to distinguish whether a statement is wrapped in an if-clause or not - at least AFAIK.
I'm stupid - I should have read the whole thread ;)
I thought this was about finding LOG.debug() that isn't wrapped into if (LOG.isDebugEnabled()) { ... }
The problem wit SS is that you can only replace System.out with lets say debug. If it is an intention you can choose to make it debug or info or warning or remove etc
You can do structural replace finding System.out.println($a$); and replacing it by if (LOG.isDebugEnabled()) { LOG.debug($a$); }
>
Alex Roytman wrote:
>> Wasn't there an intention to replace System.out with LOG.debug() (with if >> (LOG.isDebugEnabled())? >> I remember seeing (or was I dreaming) it but can not find it any more >> >> > >
-- Best regards, Maxim Mossienko IntelliJ Labs / JetBrains Inc. http://www.intellij.com "Develop with pleasure!"
>> Wasn't there an intention to replace System.out with LOG.debug() (with if >> (LOG.isDebugEnabled())? >> I remember seeing (or was I dreaming) it but can not find it any more >> >> >
Hi Alex,
>
Why don't you use the power of live templates? Here's what I am using whenever I need to insert debug code:
Hello Alex,
AR> Wasn't there an intention to replace System.out with LOG.debug()
AR> (with if
AR> (LOG.isDebugEnabled())?
AR> I remember seeing (or was I dreaming) it but can not find it any
AR> more
As far as I know, the IG inspection which searches for uses of System.out
does not provide a quickfix. In Demetra, you can set up a Structural Search
inspection to perform the searcn and replace for you.
--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"
Alex Roytman wrote:
Hi Alex,
Why don't you use the power of live templates? Here's what I am using
whenever I need to insert debug code:
if($VAR$.isDebugEnabled()) {
$VAR$.debug("$END$");
}
For the above code I am using the abbreviation "debug". Anywhere in my
Java code I can write "debug", hit the TAB key, and you're in business ;)
Hope it makes sense, cheers!
-florin
You can do structural replace finding
System.out.println($a$);
and replacing it by
if (LOG.isDebugEnabled()) {
LOG.debug($a$);
}
Alex Roytman wrote:
--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
Dmitry Jemerov (JetBrains) wrote:
Unfortunately, this is not an optimal solution because SS is not powerful enough
to distinguish whether a statement is wrapped in an if-clause or not - at least
AFAIK.
Sascha
Sascha Weinreuter wrote:
>> In Demetra, you can set up a
>> Structural Search inspection to perform the searcn and replace for you.
I'm stupid - I should have read the whole thread ;)
I thought this was about finding LOG.debug() that isn't wrapped into if
(LOG.isDebugEnabled()) { ... }
Sascha
Sascha Weinreuter wrote:
It will be.
--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
Hi,
The problem wit SS is that you can only replace System.out with lets say
debug. If it is an intention you can choose to make it debug or info or
warning or remove etc
Thank you
Alex
"Maxim Mossienko (JetBrains)" <Maxim.Mossienko@jetbrains.com> wrote in
message news:dscu24$m46$1@is.intellij.net...
>
>> Wasn't there an intention to replace System.out with LOG.debug() (with if
>> (LOG.isDebugEnabled())?
>> I remember seeing (or was I dreaming) it but can not find it any more
>>
>>
>
>
Of course I use live templates. But here I am talking refactoring some rity
code without having to do 100 cut and pastes
"Florin PATRASCU" <fpatrascu@masterfile.com> wrote in message
news:dsctjo$kok$1@is.intellij.net...
>> Wasn't there an intention to replace System.out with LOG.debug() (with if
>> (LOG.isDebugEnabled())?
>> I remember seeing (or was I dreaming) it but can not find it any more
>>
>>
>
>
>
>
>
>
BTW, what LOG you are using? We also use a LOG constant per class, but
ours is a project class and maybe have different method calls.
What about defining some structural replace pairs and be able to show them
as intentions if the search term matches?
Tom
http://www.jetbrains.net/jira/browse/IDEA-6681