Skip to content

Implementation of a Log in Java ready to use in your project

Notifications You must be signed in to change notification settings

albertogmdev/Sigleton-Log-Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sigleton Log in Java

Implementation of a Log in Java ready to use in your project

Using this Log is simple and you can also customize the code to add new label like [INFO], [WARN] or giving your log a custom name.

Steps

  1. Instanciate your log in Log.java
public static Logger log = Logger.getInstance("yourLogName");
public static LoggerDB logDB = LoggerDB.getInstance("yourLogName2");

     You can have in your project as many logs as you instanciate in this class
 

  1. Use info(), warn(), error() methods to log a new message
Log.log.info("Hello World!");
Log.log.warn("Something is not working...");
Log.log.error("Error message :(");

Log.logDB.info("Hello DataBase!");
Log.logDB.warn("Something is not working...");
Log.logDB.error("Error message :(");

     You can add new label for your log message adding a new method in Logger class  

Once you have done that the code will create:

  - logs directory in your project folder
  alt text
  - logDate directories with the date where the logs were created
  alt text
  - [time]log logs files
  alt text
  - Output of logs
  alt text
  alt text

About

Implementation of a Log in Java ready to use in your project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages