A simple Java logging library.
- DEBUG, INFO, WARN, ERROR levels
- Writes logs to a file
- Easy to use
Download the logging.jar
file from the Releases page.
-
Eclipse:
- Right-click on your project.
- Select
Build Path
>Add External Archives...
. - Choose the downloaded
logging.jar
file and add it.
-
IntelliJ IDEA:
- Go to
File
>Project Structure
>Modules
>Dependencies
. - Click the
+
button and selectJARs or directories
. - Select the
logging.jar
file and add it.
- Go to
-
Visual Studio Code:
- Install Java extention from Marketplace.
- Open your project with Java extention.
- Go to your
Project Settings
>Libraries
>Add Library
> Select JAR file >Apply Settings
. - Restart your IDE.
-
Place the JAR File:
Create a
lib
directory in your project and movelogging.jar
into it. -
Compile Your Project:
javac -cp lib/logging.jar -d bin src/yourapp/*.java java -cp bin:lib/logging.jar yourapp.MainClass
Note: On Windows, use ; instead of : as the classpath separator:
java -cp bin;lib/logging.jar yourapp.MainClass
import com.emr.logging.Logger;
import com.emr.logging.LogLevel;
public class Example {
public static void main(String[] args) {
Logger logger = new Logger(LogLevel.INFO);
logger.debug("This is a debug message.");
logger.info("Application started.");
logger.warn("This is a warning message.");
logger.error("This is an error message.");
logger.close();
}
}