How do i create a logfile that can be accessed from different classes. I only want to use one logfile which will be open while the application i make is running. It will only close when i close my application. I have many classes in different files. What can i do to make the Log class a public accessible class to all the others.
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
You could apply the Singleton pattern for the Logger class (all code would use Logger.getInstance(), and get a reference to the same Logger instance). This Logger class should be able to handle input from different threads at once, to avoid intermixed output in the file. Hope this helps. Regards, G�nther. http://www.javacoding.net
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.