Not able to call method "error" from the logger object.
java, java.util.logging
Solution
You are using java.util.logging.Logger and this logger has no `error()` method.
Either use
Logger.log(Level, String);
Logger.log(Level, String, Throwable);
with one of the levels defined in java.util.logging.Level
or
Logger.severe(String);
... to your second question:
The logger is declared well.
If you change the logger declaration to
private final static Logger logger = Logger.getLogger(SaveOrder.class.getName());
then the logger will have another name. The name is used when you configure the logging system. I would suggest you to read the Java Logging Overview and come back when you have a particular question about the java logging system.
Problem
``` package firstAOP; import java.util.logging.Logger; public class OrderDAO { private final static Logger logger = Logger.getLogger(OrderDAO.class.getName()); public boolean saveOrder(Order order) { boolean flag =false; try { //functional code flag = true; } catch(Exception e) { logger.error(e); } return flag; } } ``` In the above code I get an error in the line "logger.error(e)" This is the error: The method error() is undefined for the type Logger Rest of the methods like logger.info are working. And if it is not too much to ask can you please tell me have I declared logger correctly. And what will happen if I write: ``` private final static Logger logger = Logger.getLogger(SaveOrder.class.getName()); ``` SaveOrder is another class in the same package.