JavaFx Logging Example

I am using JavaFx with my own packaging. What is the best way to log the output of the System console to a file? Can sl4j-simple be used? Could you give me an example?

+3


source to share


1 answer


The simplest way is probably to use the java.util.logging framework and route its output to a file like this: How to get the Java Logger output to a default file . Then you don't need to worry about packaging any additional dependencies for the registration frameworks. If you do, you should be using the java.util.logging api, which is a little awkward compared to slf4j, but still works.



You could use slf4j as your frontend instead, but you would need to package additional jar files with your application to accomplish this.If you know maven then perhaps the easiest way would be to build libraries to build your project with zenjava maven plugin with appropriate dependencies placed in your project pom for slf4j log libraries you would like to use. (I haven't used the zenjava maven tool myself).

+1


source







All Articles