{"id":25028082,"url":"https://github.com/rvguradiya/slf4j-examples","last_synced_at":"2025-03-30T18:13:36.172Z","repository":{"id":274293309,"uuid":"922165301","full_name":"rvguradiya/slf4j-examples","owner":"rvguradiya","description":"A Java project showcasing the key features of SLF4J, including logging levels, parameterized logging, MDC, markers, and integrations with Logback, Log4j2, and JUL. Includes detailed examples and tests.","archived":false,"fork":false,"pushed_at":"2025-01-26T10:45:28.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-05T20:07:48.061Z","etag":null,"topics":["best-practices","java","java-examples","log4j2","logback","logging","logging-frameworks","markers","mdc","slf4j"],"latest_commit_sha":null,"homepage":"https://www.slf4j.org","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rvguradiya.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-25T13:50:33.000Z","updated_at":"2025-01-26T12:36:32.000Z","dependencies_parsed_at":"2025-01-26T11:37:05.345Z","dependency_job_id":null,"html_url":"https://github.com/rvguradiya/slf4j-examples","commit_stats":null,"previous_names":["rvguradiya/slf4j-examples"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvguradiya%2Fslf4j-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvguradiya%2Fslf4j-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvguradiya%2Fslf4j-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvguradiya%2Fslf4j-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rvguradiya","download_url":"https://codeload.github.com/rvguradiya/slf4j-examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246358337,"owners_count":20764366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["best-practices","java","java-examples","log4j2","logback","logging","logging-frameworks","markers","mdc","slf4j"],"created_at":"2025-02-05T19:56:33.802Z","updated_at":"2025-03-30T18:13:36.154Z","avatar_url":"https://github.com/rvguradiya.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SLF4J Examples\n\nThis repository demonstrates key features of the **Simple Logging Facade for Java (SLF4J)**, including integration with popular logging frameworks and advanced logging techniques. Whether you're a beginner or an experienced Java developer, this project will help you understand and use SLF4J effectively.\n\n---\n\n## Table of Contents\n\n1. [Introduction](#introduction)\n2. [Features](#features)\n3. [Repository Structure](#repository-structure)\n4. [Setup Guide](#setup-guide)\n5. [Examples Overview](#examples-overview)\n6. [Contributing](#contributing)\n7. [License](#license)\n\n---\n\n## Introduction\n\n**SLF4J** (Simple Logging Facade for Java) provides a unified logging interface for Java applications. It allows developers to write logging code independent of the underlying logging framework (e.g., Logback, Log4j, Java Util Logging).\n\nKey benefits:\n- Simplifies switching between logging frameworks.\n- Supports advanced logging features like **Markers** and **Mapped Diagnostic Contexts (MDC)**.\n- Clean, simple API.\n\n---\n\n## Features\n\n- Basic logging levels: `TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`\n- Parameterized logging\n- Integration with popular frameworks:\n    - Logback\n    - Log4j2\n    - Java Util Logging (JUL)\n- Advanced features:\n    - **Markers** for contextual logging\n    - **MDC** for diagnostic context management\n- Exception handling and logging best practices\n\n---\n\n## Repository Structure\n\n```\nslf4j-examples/\n├── src/\n│   ├── main/\n│   │   ├── java/\n│   │   │   ├── com/example/\n│   │   │   │   ├── basics/            # Basic SLF4J examples\n│   │   │   │   ├── bindings/          # Integrating with logging frameworks\n│   │   │   │   ├── advanced/          # Advanced SLF4J features\n│   │   │   │   ├── configuration/     # Configuration files\n│   ├── test/                          # Unit tests\n├── lib/                               # Optional JAR files\n├── docs/                              # Documentation\n├── build.gradle                       # Gradle build file\n├── pom.xml                            # Maven build file\n├── README.md                          # Project documentation\n├── .gitignore                         # Ignored files\n```\n\n---\n\n## Setup Guide\n\n### Prerequisites\n\n- Java 8 or higher\n- Gradle or Maven installed\n\n### Clone the Repository\n```bash\ngit clone https://github.com/rvguradiya/slf4j-examples.git\ncd slf4j-examples\n```\n\n### Build the Project\n\n#### Using Gradle:\n```bash\ngradle build\n```\n\n#### Using Maven:\n```bash\nmvn clean install\n```\n\n### Run Examples\nNavigate to the `src/main/java/com/example` directory and run the desired examples using your IDE or a command-line tool.\n\n---\n\n## Examples Overview\n\n### Basic Logging\n- **HelloWorldLogger**: Simple example demonstrating SLF4J logging.\n- **ParameterizedLogging**: Demonstrates how to use placeholders for efficient logging.\n- **LoggingLevelsExample**: Explains the different logging levels.\n\n### Framework Integrations\n- **LogbackExample**: Integration with Logback.\n- **Log4j2Example**: Integration with Log4j2.\n- **JULExample**: Integration with Java Util Logging.\n\n### Advanced Features\n- **MDCExample**: Demonstrates how to use Mapped Diagnostic Contexts.\n- **MarkerExample**: Shows how to use Markers for filtering and categorization.\n- **ExceptionHandlingExample**: Best practices for logging exceptions.\n\n---\n\n## Contributing\n\nContributions are welcome! If you have additional examples or enhancements, feel free to submit a pull request.\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature-name`)\n3. Commit your changes (`git commit -m 'Add feature'`)\n4. Push to your branch (`git push origin feature-name`)\n5. Open a pull request\n\n---\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frvguradiya%2Fslf4j-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frvguradiya%2Fslf4j-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frvguradiya%2Fslf4j-examples/lists"}