Want to remove debug information

Reply

Join Date: Nov 2004
Posts: 189
Reputation: George2 is an unknown quantity at this point 
Solved Threads: 0
George2 George2 is offline Offline
Junior Poster

Want to remove debug information

 
0
  #1
Jan 17th, 2005
Hello everyone,


I am wondering how to remove debug information (for example, System.out or System.err) automatically when I build/compile a Java project? Does Java compiler or build tool has such options when we build/compile a Java application?


Thanks in advance,
George
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: Want to remove debug information

 
0
  #2
Jan 17th, 2005
I don't recall anything like that. I would either leave them, or remove them manually.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Want to remove debug information

 
0
  #3
Jan 17th, 2005
You can't, and you don't want to.

Once your application ships you want to be able to get some logs when there's a problem at a customer's site.

To get that build your application to log those messages to some file.
If you create a logger with different logging levels you can turn on different levels of logging at runtime by changing a config file or command line option.

Java has (from 1.4 onwards) a quite comprehensive logging framework built in, or you can use a 3rd party framework like Log4J.

Logfiles should at the minimum list a timestamp with every entry so you can trace what happened where, and best also a very good indication of where the entry was created (just using this.toString() is a good start, line numbers can help as well).
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: Want to remove debug information

 
0
  #4
Jan 17th, 2005
I had no clue you could do that in java. I looked at some of the logging api's, and it looked very useful.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 189
Reputation: George2 is an unknown quantity at this point 
Solved Threads: 0
George2 George2 is offline Offline
Junior Poster

Re: Want to remove debug information

 
0
  #5
Jan 18th, 2005
Thanks all the same, server_crash.


Originally Posted by server_crash
I don't recall anything like that. I would either leave them, or remove them manually.

regards,
George
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 189
Reputation: George2 is an unknown quantity at this point 
Solved Threads: 0
George2 George2 is offline Offline
Junior Poster

Re: Want to remove debug information

 
0
  #6
Jan 18th, 2005
Thanks jwenting,


Originally Posted by jwenting
You can't, and you don't want to.

Once your application ships you want to be able to get some logs when there's a problem at a customer's site.

To get that build your application to log those messages to some file.
If you create a logger with different logging levels you can turn on different levels of logging at runtime by changing a config file or command line option.

Java has (from 1.4 onwards) a quite comprehensive logging framework built in, or you can use a 3rd party framework like Log4J.

Logfiles should at the minimum list a timestamp with every entry so you can trace what happened where, and best also a very good indication of where the entry was created (just using this.toString() is a good start, line numbers can help as well).
Your reply is very helpful. I have learned so much dealing with log from you. Can you recommend some online resources to learn log related topics?


regards,
George
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 189
Reputation: George2 is an unknown quantity at this point 
Solved Threads: 0
George2 George2 is offline Offline
Junior Poster

Re: Want to remove debug information

 
0
  #7
Jan 18th, 2005
Thanks server_crash,


Originally Posted by server_crash
I had no clue you could do that in java. I looked at some of the logging api's, and it looked very useful.
I am wondering how you debug your applications since you do not use log utility.


regards,
George
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Want to remove debug information

 
0
  #8
Jan 18th, 2005
Oh, there's System.out.println() which is what everyone used before dedicated loggers became available.
We created our own logging API, another favourite passtime in days past.
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: Want to remove debug information

 
0
  #9
Jan 18th, 2005
Originally Posted by George2
Thanks server_crash,




I am wondering how you debug your applications since you do not use log utility.


regards,
George
lol I never really did. Sometimes I used System.out.println()'s, and sometimes I just knew what to do from the error. I've never really created anything so big, that it require a lot of debugging. But, my text editor I'm working on right now is in need of it. So I might have to put it to some use.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 189
Reputation: George2 is an unknown quantity at this point 
Solved Threads: 0
George2 George2 is offline Offline
Junior Poster

Re: Want to remove debug information

 
0
  #10
Jan 18th, 2005
Thanks for providing information server_crash,


Originally Posted by server_crash
lol I never really did. Sometimes I used System.out.println()'s, and sometimes I just knew what to do from the error. I've never really created anything so big, that it require a lot of debugging. But, my text editor I'm working on right now is in need of it. So I might have to put it to some use.

regards,
George
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC