Code Monkey home page Code Monkey logo

logx's Introduction

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."); 
    }
}

logx's People

Watchers

Ashutosh Pandey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.