| | |
| | | static public final String LOG_FILE_SUFFIX = ".log"; |
| | | |
| | | static private File logFile = null; |
| | | static private FileHandler fileHandler = null; |
| | | |
| | | /** |
| | | * Creates a new file handler for writing log messages to the file indicated |
| | |
| | | static public void initLogFileHandler(File file) throws IOException { |
| | | if (!isInitialized()) { |
| | | logFile = file; |
| | | FileHandler fileHandler = new FileHandler(logFile.getCanonicalPath()); |
| | | fileHandler = new FileHandler(logFile.getCanonicalPath()); |
| | | fileHandler.setFormatter(new SimpleFormatter()); |
| | | Logger logger = Logger.getLogger("org.opends.quicksetup"); |
| | | logger.addHandler(fileHandler); |
| | |
| | | } |
| | | |
| | | /** |
| | | * Creates a new file handler for writing log messages of a given package |
| | | * to the file indicated by <code>file</code>. |
| | | * @param file log file to which log messages will be written. |
| | | * @param packageName the name of the package of the classes that generate |
| | | * log messages. |
| | | * @throws IOException if something goes wrong |
| | | */ |
| | | static public void initLogFileHandler(File file, String packageName) |
| | | throws IOException { |
| | | initLogFileHandler(file); |
| | | Logger logger = Logger.getLogger(packageName); |
| | | logger.addHandler(fileHandler); |
| | | logger.setUseParentHandlers(false); |
| | | } |
| | | |
| | | /** |
| | | * Prevents messages written to loggers from appearing in the console |
| | | * output. |
| | | */ |