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

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "logger.log method compile error " Watch "logger.log method compile error " New topic

logger.log method compile error

Murali Mohan
Ranch Hand

Joined: Jun 14, 2001
Posts: 47
Hi all,
this is a simple logger api example. But it is giving complilation error at logger.log("Level.ALL","Exception..."). Why it is giving like that. Can u pls tell me?
import java.util.logging.*;
public class LoggerTest
public static void main(String args[]){

Logger logger = Logger.getLogger("LoggerTest");
Handler handler = new FileHandler("logMessages.log");
handler.setFormatter(new SimpleFormatter() ) ;
//int K=1/0;
catch(Exception e)
logger.log("Level.ALL","Exception...", e);
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
Hi Murli
Please re-look the logger api. The log() method doesn't accept String. It accepts Level.ALL just as it is. I guess that is why you are facing compiler error.
wood burning stoves
subject: logger.log method compile error
Similar Threads
logger.log......compile error
Java Logger Puzzle
can I use a single java.util.logging.logger instance for entire project
java.util.logging error
logging solution