File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes logging Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "logging" Watch "logging" New topic


Jayasri Alaparthi
Ranch Hand

Joined: Aug 14, 2006
Posts: 67
Hi friends,
what is the primary use of logging statements when we have System.out.println statement.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15100

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.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
subject: logging
jQuery in Action, 3rd edition