Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

logging

 
Jayasri Alaparthi
Ranch Hand
Posts: 67
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
what is the primary use of logging statements when we have System.out.println statement.
Thanks,
Bhargavi.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A good logging system (like log4j for example) gives you a lot of flexibility and features that you don't get with simple System.out.println statements. For example, by configuring and using log4j properly you can very easily switch between different logging levels - you can for example choose to log only errors, or all debug messages. Also you can let log4j automatically add information to each log message such as a timestamp or a class and method name.

See the log4j documentation for more information.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic