• Post Reply Bookmark Topic Watch Topic
  • New Topic

java logging  RSS feed

 
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If we have both log4j logging (like logger.debug, logger.error, logger.info..) and System.out.prinltn in a production server. The System.out.println will just not produce anything when the class is run at background. But does System.out.println can halt the program's execution for any reason or under any condition just because the program does not know how to print it out ? Or will it just skip it if it can't print it out ?
 
Saloon Keeper
Posts: 7993
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you don't have to worry about println(). You can redirect the program output (to a file, for example), and if you don't, nothing will happen if the program is run in background, or if it uses a GUI instead of a console.
 
ben oliver
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. So, no matter if my code is run as a background job, or called by another script, etc. whenever the system finds there is no console for it to output (assuming I don't redirect to file or other device), it will just NOT be able to output it, right ?
It will just act like quietly ignoring this println() and move on, right ?

The bottom line --- It won't halt the program or throw any exception in this case, am I correct ?
 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!