Page 1 of 1

System.out.printlns?

PostPosted: Fri Jul 24, 2009 5:23 pm
by jbeltran
Hi all,

I'm using docx4j in a web application and the application logs are getting littered with System.out.printlns? Are there any plans to remove those from the application?

If not, is the best way to deal with it simply to download the source and comment all the printlns and then build a new docx4j jar?

Thanks,
Justin

Re: System.out.printlns?

PostPosted: Tue Jul 28, 2009 3:01 pm
by jason
jbeltran wrote:I'm using docx4j in a web application and the application logs are getting littered with System.out.printlns?


True.

jbeltran wrote:Are there any plans to remove those from the application?


Yes, just haven't gotten around to it yet (even though its a 10 min job).

jbeltran wrote:If not, is the best way to deal with it simply to download the source and comment all the printlns and then build a new docx4j jar?


Sure, you can do that. Otherwise you can wait, but it may be several weeks before I can upload a nightly build.

cheers .. Jason

Re: System.out.printlns?

PostPosted: Mon Aug 03, 2009 1:38 pm
by jason
This is now fixed in my local copy; its just a matter of committing it.

Re: System.out.printlns?

PostPosted: Mon Sep 14, 2009 6:46 am
by clarke
We have a huge (old legacy java) code-base, where many files (around 5k) have System.out.println's. We are planning to remove them for cleanup/performance reasons. How can we write a script that will replace them without introducing any issues in the code? The script cannot blindly delete them as following case can be an issue:

if ()
some.code...
else
System.out.println(...);
DB.close();

I'm thinking of replacing them with ';'. That will take care of above case. Do you see any other issues? Any other suggestions?

Re: System.out.printlns?

PostPosted: Mon Sep 14, 2009 9:55 am
by jason
If it were me, I'd be hesitant to obliterate them like that, since they probably contain some knowledge relating to the system.

I think I'd replace them with calls to one of the logging frameworks, but at debug level, so you never need to see them unless you want to. Progressively over time, you could change the log levels or remove some of the logging statements entirely.