Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #1697

=?UTF-8?B?U3lzdGVtLm91dC5

From "RedGrittyBrick" <redgrittybrick@THRWHITE.remove-dii-this>
Subject =?UTF-8?B?U3lzdGVtLm91dC5
Message-ID <jJednXnkNN3fwMXbnZ2dnUVZ8vydnZ2d@bt.com> (permalink)
Newsgroups comp.lang.java.gui
References <aOudncS6UOJU2cXbnZ2dnUVZ_qLinZ2d@comcast.com>
Date 2011-04-27 15:34 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
Lew wrote:
> Piet71 wrote:
>> In my real program I have added lots of System.out.println's from
> 
> One trouble with System.out.println (why didn't you use System.err?) is 
> that they have to be removed for production. 

Sorry to jump in here, I'd certainly agree that you should remove those 
sort of statements (or make them conditional), however since output to 
System.out is not normally visible in a jar'd Swing application (i.e. 
when not run from an IDE or command shell) - is there any major problem 
if they're left in?

> There are many reasons not 
> to use System.out for debug or trace purposes.

I'd be interested in reading your list of those reasons.

> 
> Why not using logging?

I can't answer for the OP, but in my case it went like this:

- System.out.println() works
   - it needs no special classes/jars bundled with your app.
   - it needs no complex XML config files
   - it needs no class instantiation/initialisation
   - it is just as easy to make conditional
   - it is just as easy to comment-out or remove using search/replace

- Logging classes seem like they're oriented to making complex
   logging needs possible. Few of them make simple jobs simple.

- There's too many to choose from. Writing System.out.println()
   a few dozen times takes a lot less gumption than studying a
   half dozen logging classes and choosing one then using it.

For my limited needs I preferred to reinvent the logging wheel myself, 
though I did feel properly guilty about it :-) I ended up with something 
I could control by environment variables or command line params, which 
could be used statically without configuration files or instantiation, 
which could have logging levels set programatically if needed, and which 
did the right thing in the absence of any configuration.

It goes without saying that it does a lot less than the more developed 
logging classes. But I like that it's as easy to use as 
System.out.println().

I still use System.out.println() for simple programs.

I'm open to persuasion, so I'm interested to hear more details of the 
evils of System.out.println().

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

=?iso-8859-1?q?JComboBox= "Piet71" <piet71@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
  =?iso-8859-1?q?Re:_JCombo "Piet71" <piet71@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
  Re: JComboBox.setSelected "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
    =?iso-8859-1?q?Re:_JCombo "Piet71" <piet71@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
      Re: JComboBox.setSelected "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
        =?UTF-8?B?U3lzdGVtLm91dC5 "RedGrittyBrick" <redgrittybrick@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
          =?UTF-8?B?UmU6IFN5c3RlbS5 "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
            =?UTF-8?B?UmU6IFN5c3RlbS5 "RedGrittyBrick" <redgrittybrick@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
              =?UTF-8?B?UmU6IFN5c3RlbS5 "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
  =?utf-8?B?UmU6IEpDb21ib0J "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
    =?iso-8859-1?q?Re:_JCombo "Piet71" <piet71@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000

csiph-web