If you use a logging pagkage like log4j you can place as many logging statements all over the place and toggle them on and off using a LEVEL. For example, you can have logging statements for DEBUG and soem for ERROR. IN
test the overall level is set to DEBUG and both logging statelents will log. In PROD you can set the level to ERROR and only the statement set to ERROR will log.