- Singeleton.
- How to log java code.
- How to save this log to a file.
before getting started, please ensure you installed java JDK on you machine by using
javac --version
#clone repo
git clone https://github.com/hajajmaor/java_log_singleton.git
cd java_log_singleton/src
#create binary file from java code
javac App.java
#if you want to create the binary in a diffrent folder use:
javac -d {path_you_want} App.java
#run the binary file
java App
comman IDEs:
open the directory with your ide and run:
- Create a directory called
logs
. - Create a file called
log_file.log
. - you can change those names inside
src/MyLogger.java
in the privte constructorprivate MyLogger()
. - as you develop the app, remember to log things like
user inputs
,HTTP requests
,status of transaction
,Database connection
, things you need to check and ensure your application works at it's best!!!
The workspace contains two folders by default, where:
src
: where the magic happenslib
: the folder to maintain dependencies - future use