Issue
I would like the user to be able to choose where the error logs in my application are sent to. I am using tinylog at the moment.
I have used their example code to configure where errors are written to (the user preference is chosen via a Swing fileChooser).
Their example is:
Configurator.defaultConfig()
.writer(new FileWriter("log.txt"))
.level(Level.WARNING)
.activate();
which I have changed to:
Writer fwError= new FileWriter(userPrefs.get("PathForError", null),true);
Configurator.defaultConfig().writer(fwError).level(Level.WARNING).activate();
However I get the error as follows "Type mismatch: cannot convert from FileWriter to Writer".
How can I make this conversion work and why doesn't the example work?
Solution
org.pmw.tinylog.writers.Writer is not ancestor of java.io.FileWriter. try to use full qualified org.pmw.tinylog.writers.FileWriter()
Answered By - rustot
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.