system.out.println

I need solution for the following -

I want system.out.println statements to work in its usual way if a user-defined flag is set in a properties file.

In case the flag is not set then I don't want statements to be printed anywhere at all.

One option could be - Define and function where it will check the flag and print the statement passed as argument if the flag is set to true and call this function whereever the system.out.println is called

Could anyone think of any other better solution!

[532 byte] By [shris] at [2007-9-26 1:15:08]
# 1
See System.setOut System.setErr Foxcoming
foxcoming at 2007-6-29 0:41:08 > top of Java-index,Archived Forums,Java Programming...
# 2

setout method means redirecting the output and I don't to redirect it! I don't want to print any of the system.out.println statements at all since it will take considerable amount of time printing those lines and I want them to be printed only when I set one of the properties to true. It is not possible to use setout null as the parameter.

If it is possible please let me know.

shris at 2007-6-29 0:41:08 > top of Java-index,Archived Forums,Java Programming...
# 3
If (propertyFlag == yes)System.out.println(message);Klint
saen at 2007-6-29 0:41:08 > top of Java-index,Archived Forums,Java Programming...