• 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

can't figure this one out

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there. I have a quick query in relation to Java logging functionality (java.util.logging). I know this may not be the best place to post this meassage but here goes anyway. In Java logging there is a Class LogRecord which has one constructor taking two parameters, i.e.

LogRecord(Level level, String msg)

I am simply trying to extend this LogRecord class so that I can add my own methods and so on to the subclass as is standard in inheritance. However when I try to create a subclass called MyLogRecord, I keep encountering the following error:

constructor LogRecord() not found in class java.util.logging.LogRecord

The MyLogRecord class appears as follows.

import java.util.logging.LogRecord;
import java.util.logging.*;

public class MyLogRecord extends LogRecord
{}

I have reduced this class to a mere couple of lines of code, as it appears above, but I am still getting the same error. Can anyone please help. joe
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A subclass has to call one of its superclass's constructors; if you don't call one explicitly, then the no-argument one is called implicitly. But LogRecord doesn't have a no-argument constructor, and so you're getting this compile error. You need to include a constructor in your class which looks like

 
reply
    Bookmark Topic Watch Topic
  • New Topic