• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

logger.log method compile error

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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");
try{
Handler handler = new FileHandler("logMessages.log");
handler.setFormatter(new SimpleFormatter() ) ;
logger.addHandler(handler);
//int K=1/0;
}
catch(Exception e)
{
e.printStackTrace();
//logger.log("Level.ALL","Exception...");
logger.log("Level.ALL","Exception...", e);
}
}
}
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
Regards
Maulin
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic