Skip to content

theashutoshpandey/LogX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LogX - Making Logging Easy and Efficient

LogX, also known as Log Express, is a Java-based logging utility designed to integrate seamlessly with Java programs, providing an efficient and organized logging system. It aims to simplify the process of debugging by organizing logs in a standard format, allowing developers to identify and address program issues more effectively. The idea for creating LogX stemmed from the reported flaw in log4j, which resulted in a surge of cyberattacks towards the end of 2021.

Key Features

LogX offers a range of features to streamline the logging process and enhance the overall debugging experience:

  1. Custom Logger Implementation: LogX provides a custom logger implementation that supports various logging levels, ensuring flexibility and expressiveness while debugging.

  2. Multiple Logging Levels: The utility supports multiple logging levels, including:

    • All: Captures all logging information.
    • TRACE: Detailed information, typically used for troubleshooting and diagnosing.
    • DEBUG: Information helpful for debugging purposes.
    • WARN: Indicates potential issues that might need attention.
    • FATAL: Critical errors that might lead to the program's termination.
    • ERROR: Reports errors that need immediate attention.
  3. Console and File Logging: LogX allows logs to be directed both to the console and a log file, providing developers with flexibility in monitoring and storing log data.

  4. Well-Formatted Logs: Logs generated by LogX are well-formatted and include essential details such as timestamp, log level, class name, line number, and log message. This ensures better readability and comprehension of the logged information.

  5. Log File Rotation: To manage log file size and avoid overwhelming log files, LogX supports automatic log file rotation. This feature helps maintain log files within a specified size limit.

  6. Exception Handling: LogX can effectively handle logging exceptions along with stack traces, making it easier to identify the root cause of errors and exceptions.

Supports

  1. Set the desired logging level and configure other options (e.g., log file path, rotation size) as needed.

  2. Enjoy easy and efficient logging with LogX in your Java application!

    • With LogX, you can rest assured that your logging needs are well-handled, and debugging your Java programs becomes a breeze.

Note: This logger is designed as a singleton, and you can get an instance using getLogger() method ,Ensure you keep the LogX library up-to-date to leverage the latest improvements and security enhancements.

Getting Started

To integrate LogX into your Java program, follow these steps:

  1. Clone the LogX library and include it in your project's classpath or create a jar and include.

  2. Initialize the logger instance in your Java code:

  3. you can find the log file in User Home directory

import com.logger.express.LogLevel;
import com.logger.express.LogOperator;
import com.logger.express.Logger;

public class Main {

    private static final Logger logger = LogOperator.getLogger().writeHeaderBanner();

    public static void main(String[] args) {
        // Your code here
        logger.trace("This is a trace message.");
        logger.debug("This is a debug message.");
        logger.info("This is an info message.");
        logger.warn("This is a warning message");
        logger.error("This is a error message");
        logger.error(new Exception("This is error printStackTrace message of exception "));
        logger.fatal("This is a fatal message");

        logger.setLogLevel(LogLevel.WARN); // Set log level to WARN

        logger.trace("This debug message won't be logged.");
        logger.debug("This debug message won't be logged.");
        logger.info("This is an info message after changing log level.");
        logger.warn("This is a warning message after changing log level.");
        logger.error("This is an error message after changing log level.");
        logger.fatal("This is an fatal message after changing log level."); 
    }
}

About

LogX, also known as Log Express, is a Java-based logging utility designed to integrate seamlessly with Java programs

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages