Search:

Type: Posts; User: nickar1172

Search: Search took 0.08 seconds.

  1. Re: Creating a file logger using Singleton, factory, and abstract class

    how does this look?

    import java.util.*;
    import java.text.*;
    import java.io.*;


    public class FileLogger extends SimpleLogger {

    private File logFile;
  2. Re: Creating a file logger using Singleton, factory, and abstract class

    i don't know any log() methods that's the problem, I am a beginner in an advanced course, I thought the methods that I already have are the log methods that output but I guess I'm wayyyy off

    ---...
  3. Re: Creating a file logger using Singleton, factory, and abstract class

    yes but what log methods are you talking about that is where I am also lost
  4. Re: Creating a file logger using Singleton, factory, and abstract class

    This is my new code, apparently my logger methods are "empty" and because of that I have no output. How do I go about fixing this??

    import java.util.*;
    import java.text.*;
    import java.io.*;

    ...
  5. Re: Creating a file logger using Singleton, factory, and abstract class

    but then wouldn't the file logger be an abstract also if it extends SimpleLogger? so then the FileLogger class would be :
    public abstract class FileLogger extends SimpleLogger
  6. Re: Creating a file logger using Singleton, factory, and abstract class

    but then it would change:

    public class MyProgram {

    private SimpleLogger logger;

    public static void main(String[] args) {
    try {
    SimpleLogger logger =...
  7. Re: Creating a file logger using Singleton, factory, and abstract class

    but since FileLogger is a singleton doesnt that make the constructor private to something like

    return new FileLogger();

    cant be compiled?
  8. Re: Creating a file logger using Singleton, factory, and abstract class

    public class LoggerFactory {


    public static SimpleLogger getLogger(String log) {

    return new SimpleLogger(log);
    }

    }
  9. Re: Creating a file logger using Singleton, factory, and abstract class

    I had a feeling that it had to be changed to abstract as well as the set method I just overlooked.

    This is the error code I keep getting:

    Exception in thread "main"...
  10. Re: Creating a file logger using Singleton, factory, and abstract class

    I keep getting this error and I cant figure out why, the only thing is I cannot change the My Program class bc that was given by my instructor everything else is flexible

    public abstract class...
  11. Re: Creating a file logger using Singleton, factory, and abstract class

    1. Yes it is a project requirement
    2. I'm not 100% positive the only thing I know is that we create our own exceptions so whatever is needed to be inputted in regards to error that are in the file...
  12. Re: Creating a file logger using Singleton, factory, and abstract class

    We start with a SimpleLogger which is an abstract class. It is a parent class of FileLogger, which is a concrete Singleton class that represents a single Logger. It also has all of the methods...
  13. Creating a file logger using Singleton, factory, and abstract class

    Ok so here it goes, I have the format down I just don't know where and what the syntax is supposed to be for these classes. I have 5 classes:

    SimpleLogger - Abstract Class
    FileLogger - Singleton...
Results 1 to 13 of 13