need a mechanism for turning ON/OFF SOPs

P

peczcyberworld

hi all,

please help me in finding a solution::: the scenario is I have some 20
classes and each has 2 methods and those methods has
System.out.println(" some text "). i need a mechanism to turn ON/ OFF
the SOPs to be printed in the console.
I have two possible ways
1. using javaw instead of java which will bypass the console.
2. using an if condition
for eg:

class A
{
boolean a = false;
if(false)
{
System.out.println("some text");
}
}

but I need to have this IF condition check at each n every method is
there any possibility that I can have only one check that can turn
ON /OFF the SOPs
or please help me with other alternatives.

thanks in advance

}
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

peczcyberworld said:
please help me in finding a solution::: the scenario is I have some 20
classes and each has 2 methods and those methods has
System.out.println(" some text "). i need a mechanism to turn ON/ OFF
the SOPs to be printed in the console.
I have two possible ways
1. using javaw instead of java which will bypass the console.
2. using an if condition
for eg:

class A
{
boolean a = false;
if(false)
{
System.out.println("some text");
}
}

but I need to have this IF condition check at each n every method is
there any possibility that I can have only one check that can turn
ON /OFF the SOPs
or please help me with other alternatives.

Look at either java.util.logging or log4j !

Arne
 
K

Knute Johnson

peczcyberworld said:
hi all,

please help me in finding a solution::: the scenario is I have some 20
classes and each has 2 methods and those methods has
System.out.println(" some text "). i need a mechanism to turn ON/ OFF
the SOPs to be printed in the console.
I have two possible ways
1. using javaw instead of java which will bypass the console.
2. using an if condition
for eg:

class A
{
boolean a = false;
if(false)
{
System.out.println("some text");
}
}

but I need to have this IF condition check at each n every method is
there any possibility that I can have only one check that can turn
ON /OFF the SOPs
or please help me with other alternatives.

thanks in advance

}

System.setOut(new PrintStream("nul)); // windows
System.setOut(new PrintStream("/dev/nul")); // linux
 
L

Lew

peczcyberworld said:
class A
{
boolean a = false;
if(false)
{
System.out.println("some text");
}
}

but I need to have this IF condition check at each n every method is
there any possibility that I can have only one check that can turn
Look at either java.util.logging or log4j !

And perhaps apache commons-logging in conjunction with either of those.
 
Z

Z.

peczcyberworld said:
but I need to have this IF condition check at each n every method is
there any possibility that I can have only one check that can turn
ON /OFF the SOPs
or please help me with other alternatives.

See System.setOut();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,438
Messages
2,571,699
Members
48,796
Latest member
Greg L.
Top