Results 1 to 6 of 6
- 04-12-2011, 06:49 AM #1
Member
- Join Date
- Apr 2011
- Posts
- 3
- Rep Power
- 0
How to modify System.out.println()
Hi everyone,
How can I change the System.out.println(x) to allways act as System.out.println(this + x)
The reason is that I have a project with thousand of java-files and in every one of them there are several System.out.println(). I would like to know what java class is printing on the console. I thought maybe there is a way to modify the System.out.print/println in the main Java library so it would allways do as write the class name or some kind of clue about which class it is first and then the content of println ... But I don't know how?
Can I modify System.out.println in Java??? Is this possible at all? //Thanks
- 04-12-2011, 06:56 AM #2
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
You can find the java source files in the java folder on your computer, for a windows it should be located somewhere similar to
It may be risky however to modify the java library.Java Code:c:/program files/java/jdk/src
- 04-12-2011, 07:40 AM #3
Member
- Join Date
- Apr 2011
- Posts
- 3
- Rep Power
- 0
Is it really possible to modify Java API source becase I thought it is not possible?
- 04-12-2011, 08:34 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
Use a proper logging framework.
It's a lot easier.
Other than that you would have to write your own extension of PrintStream, overriding println() print() etc etc, and set System.out to an instance of that.
But using a logging framework would be far more sensible.
- 04-12-2011, 10:56 AM #5
Member
- Join Date
- Apr 2011
- Posts
- 3
- Rep Power
- 0
Thanks
Many thanks for you advices.
- 04-12-2011, 01:01 PM #6
Crossposted: How to modify System.out.println()
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
Similar Threads
-
System.out.println
By JohnDoe in forum New To JavaReplies: 1Last Post: 09-05-2010, 10:14 AM -
System.out.println(040|343);
By satheshshiva in forum New To JavaReplies: 5Last Post: 06-26-2010, 10:26 PM -
Println VS system.out.println
By ccie007 in forum New To JavaReplies: 2Last Post: 05-20-2010, 08:52 AM -
difference between system.out.println() & out.println()
By wickedrahul9 in forum Advanced JavaReplies: 5Last Post: 10-18-2008, 11:06 PM -
System.out.println
By sunjavaboy in forum Advanced JavaReplies: 3Last Post: 03-22-2008, 01:30 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks