jQuery in Action, 2nd edition*
The moose likes Beginning Java and the fly likes create log file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "create log file" Watch "create log file" New topic
Author

create log file

Joyce Leung
Greenhorn

Joined: Mar 20, 2010
Posts: 4
i just start learning java, the first step is how can i write a log file info txt file ?
any example for my reference?

thanks sir or madam.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18529
    
  40

Joyce Leung wrote:i just start learning java, the first step is how can i write a log file info txt file ?
any example for my reference?


Here is a reference to the Sun logging tutorial.There are a few examples in the tutorial.

http://download.oracle.com/javase/1.4.2/docs/guide/util/logging/overview.html


The most popular logging engine is log4J, which is another option you can use.

http://logging.apache.org/log4j/1.2/

Henry

Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Sunny Bhandari
Ranch Hand

Joined: Dec 06, 2010
Posts: 448

log4j will give you more power.

But the default logger available with Java is sufficient if you are just starting off.


Java Experience
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

There are a whole lot of logging frameworks out there. Log4j is one of the most popular ones. I prefer the "successor" of log4j: slf4j with the logback implementation. Slf4j separates the api from the actual implementation and can be used in conjunction with log4j. Log4j, slf4j and logback are all made by Ceki Gülcü.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
 
wood burning stoves
 
subject: create log file
 
Similar Threads
Simple JBoss Web Service With Eclipse
System.out.println statement donot show in tomact 5.0 console
Need help on a java topic
log4j - log to a file
cewolf charts color