How to create log file in an existing directory ?..I have tried out this code:
String fileName = "/log/ABC.log";
FileHandler fileHandler = new FileHandler(fileName, true);
But it is not working.Here log is the directory...
How to create log file in an existing directory ?..I have tried out this code:
String fileName = "/log/ABC.log";
FileHandler fileHandler = new FileHandler(fileName, true);
But it is not working.Here log is the directory...
You should take a look at the Logger class which is part of Java (since version 1.4). The FileHandler class is part of the logging package and it relies on the Logger class to actually log the errors to the FileHandler object you create.
In order to create a new log file in the current directory, do not prefix the file name with "/", such as in the following code:
FileHandler fileHandler = new FileHandler("logs/abc.log");