Forums Register Login

Logfile from different classes

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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 have a knack for fixing things like this ... um ... sorry ... here is a consilitory tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 800 times.
Similar Threads
How to limit the size of a log file?
log messages
re: help appreciated
log4j - no output to .log file
Initializing log4j within Eclipse on a per project (Dynamic Web Project) basis
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 02:29:24.