Consider I am going to write a simple file based logger AppLogger to be used in my apps, ideally it should be a singleton so I can call it viapublic class AppLogger {    public static String file = ..;    public void logToFile() {        // Write to file    }    public static log(String s) {        AppLogger.getInstance().logToFile(s);    }}And to use itAppLogger::log(This is a log statement);The problem is, what is the best time I should provide the value of file since it is a just a singleton? Or how to refactor the above code (or skip using singleton) so I can customize the log file path? (Assume I don't need to write to multiple at the same time)p.s. I know I can use library e.g. log4j, but consider it is just a design question, how to refactor the code above?
How to change the state of a singleton in runtime
java;design patterns;object oriented;object oriented design;singleton