{"id":51124587,"url":"https://github.com/quackster/simplelogger4j","last_synced_at":"2026-06-25T06:01:33.639Z","repository":{"id":354071529,"uuid":"1133921952","full_name":"Quackster/SimpleLogger4j","owner":"Quackster","description":"A very simple logger for Java that supports console, file appending, colours and formatting.","archived":false,"fork":false,"pushed_at":"2025-09-25T23:38:18.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-27T03:06:27.891Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Quackster.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-14T02:06:10.000Z","updated_at":"2026-01-14T02:06:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Quackster/SimpleLogger4j","commit_stats":null,"previous_names":["quackster/simplelogger4j"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Quackster/SimpleLogger4j","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quackster%2FSimpleLogger4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quackster%2FSimpleLogger4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quackster%2FSimpleLogger4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quackster%2FSimpleLogger4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Quackster","download_url":"https://codeload.github.com/Quackster/SimpleLogger4j/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quackster%2FSimpleLogger4j/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34761847,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-25T02:00:05.521Z","response_time":101,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-06-25T06:01:30.638Z","updated_at":"2026-06-25T06:01:33.611Z","avatar_url":"https://github.com/Quackster.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimpleLogger4j\n\nA lightweight, dependency-free Java logger that gives you:\n\n- A simple API (`logger.info()`, `logger.error()`, etc.)\n- A pattern engine for shaping log output\n- ANSI colour support for easy visual scanning\n- String utilities for alignment, clipping, and formatting\n- Clean exception handling\n\n**Built and tested against Java 1.8**\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Installation\n\n### Gradle\n\nAdd the [JitPack](https://jitpack.io/#lovepigeons/SimpleLogger4j) repository:\n\n```groovy\nrepositories {\n    maven { url 'https://jitpack.io' }\n}\n```\n\nThen add the dependency:\n\n```groovy\ndependencies {\n    implementation 'com.github.lovepigeons:SimpleLogger4j:v1.0.4'\n}\n```\n\n### Maven\n\nAdd the [JitPack](https://jitpack.io/#lovepigeons/SimpleLogger4j) repository:\n\n```xml\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003ejitpack.io\u003c/id\u003e\n        \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n```\n\nThen add the dependency:\n\n```xml\n\u003cdependencies\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.github.lovepigeons\u003c/groupId\u003e\n        \u003cartifactId\u003eSimpleLogger4j\u003c/artifactId\u003e\n        \u003cversion\u003ev1.0.4\u003c/version\u003e\n    \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\n## API Summary\n\n```java\nSimpleLog logger = SimpleLog.of(T.class);\n\nlogger.info(\"Test arguments: {} {} {}\", 123, 123.456, \"testing\");\n\nlogger.debug(\"debug msg\");\nlogger.info(\"info msg\");\nlogger.success(\"success msg\");\nlogger.warn(\"warn msg\");\nlogger.error(\"error msg\");\nlogger.critical(\"critical msg\");\n\nlogger.error(\"error with stack\", throwable);\nlogger.critical(\"critical with stack\", throwable);\n```\n\n**Levels:** DEBUG, INFO, SUCCESS, WARN, ERROR, CRITICAL\n\n## Configuration\n\n### Creating a Logger\n\n```java\n// Uses default config (simplelogger4j.xml if exists, else internal defaults)\nSimpleLog logger = SimpleLog.of(MyClass.class);\n\n// Or specify a custom XML config file\nSimpleLog logger = SimpleLog.of(MyClass.class, \"mylog.xml\");\n```\n\n### XML Configuration\n\nCreate a `simplelogger4j.xml` file in your classpath (or specify a custom filename):\n\n```xml\n\u003cconfig\u003e\n    \u003cminLevel\u003eDEBUG\u003c/minLevel\u003e\n    \u003cpattern\u003e[%{timestamp:BRIGHT_BLACK}] [%{level:LEVEL|padRight(8)}] (%{package:CYAN}) #%{sequence:BRIGHT_BLACK} %{message}\u003c/pattern\u003e\n    \u003cconsoleColour\u003etrue\u003c/consoleColour\u003e\n    \u003cappenders\u003e\n        \u003cconsole enabled=\"true\"/\u003e\n        \u003cfile enabled=\"true\" path=\"app.log\" bufferSize=\"16384\" append=\"true\"/\u003e\n    \u003c/appenders\u003e\n    \u003clevelPalette\n        debug=\"BLUE\"\n        info=\"\"\n        warn=\"BRIGHT_YELLOW\"\n        success=\"GREEN\"\n        error=\"RED\"\n        critical=\"BG_BRIGHT_RED\"\n    /\u003e\n\u003c/config\u003e\n```\n\n**Configuration options:**\n\n- `minLevel` - Minimum log level to output (DEBUG, INFO, SUCCESS, WARN, ERROR, CRITICAL)\n- `pattern` - Output format pattern using tokens and specs\n- `consoleColour` - Enable/disable ANSI colours for console output\n- `appenders/console` - Console output settings\n- `appenders/file` - File output settings with path, buffer size, and append mode\n- `levelPalette` - Colour mapping for each log level (empty string = no colour)\n\n**Configuration priority:**\n1. Custom XML file (if specified in `SimpleLog.of()`)\n2. `simplelogger4j.xml` (if found in classpath)\n3. Internal defaults\n\n### Output\n```\n2025-09-11T10:11:12 INFO     This is logged at info level\n2025-09-11T10:11:12 WARN     This is logged at warn level\n2025-09-11T10:11:12 SUCCESS  This is logged at success level\n2025-09-11T10:11:12 DEBUG    This is logged at debug level\n2025-09-11T10:11:12 ERROR    This is logged at error level\n2025-09-11T10:11:12 CRITICAL This is logged at critical level\n2025-09-11T10:11:12 ERROR    error\njava.lang.RuntimeException: Forced error!\n    at ...\n2025-09-11T10:11:12 CRITICAL error\njava.lang.RuntimeException: Forced critical error!\n    at ...\n```\n\n## Advanced Formatting with PatternEngine\n\nThe PatternEngine is where you take full control of how logs look.\nInstead of being locked into a rigid format, you describe the output with a **pattern string**.\n\n### 1. Tokens\n\nTokens are placeholders written as `%{...}`. They pull data from the log event:\n\n- `timestamp` → when the event happened\n- `level` → log level (INFO, ERROR, etc.)\n- `message` → your log text\n- `thread` → thread name\n- `class` → simple class name\n- `package` → package name\n- `sequence` → monotonic counter\n\n**Example:**\n```\n%{timestamp} %{level} %{message}\n```\n\nMight render as:\n```\n2025-09-11T10:20:45 INFO Hello, World!\n```\n\n### 2. Specs (Format Modifiers)\n\nSpecs are added after a `:`. You can chain multiple with `|`.\n\n- `datetime(pattern[, locale])` → custom date/time\n- `padRight(width[, char])` → pad to a fixed width\n- `substring(start[, end])` → clip text\n\n**Example:**\n```\n%{timestamp:datetime('yyyy-MM-dd HH:mm:ss')|padRight(20)} %{level:padRight(5)} %{message:substring(0,30)}\n```\n\n**Output:**\n```\n2025-09-11 10:20:45   INFO  Hello, World ttttttttttttttttt\n```\n\n### 3. Colouring\n\nAdd ANSI colours by name:\n\n- **Fixed colours**: Use any of the available colour names directly in your pattern\n- **Palette colouring**: Use `LEVEL` to apply colours based on log level (configured once)\n\n**Available Colours:**\n\n*Regular Colours:*\n`BLACK`, `RED`, `GREEN`, `YELLOW`, `BLUE`, `MAGENTA`, `CYAN`, `WHITE`\n\n*Bright Colours:*\n`BRIGHT_BLACK`, `BRIGHT_RED`, `BRIGHT_GREEN`, `BRIGHT_YELLOW`, `BRIGHT_BLUE`, `BRIGHT_MAGENTA`, `BRIGHT_CYAN`, `BRIGHT_WHITE`\n\n*Background Colours:*\n`BG_BLACK`, `BG_RED`, `BG_GREEN`, `BG_YELLOW`, `BG_BLUE`, `BG_MAGENTA`, `BG_CYAN`, `BG_WHITE`\n\n*Bright Background Colours:*\n`BG_BRIGHT_BLACK`, `BG_BRIGHT_RED`, `BG_BRIGHT_GREEN`, `BG_BRIGHT_YELLOW`, `BG_BRIGHT_BLUE`, `BG_BRIGHT_MAGENTA`, `BG_BRIGHT_CYAN`, `BG_BRIGHT_WHITE`\n\n*All possible colours*\n\n![](https://i.imgur.com/mgU7acF.png)\n\n**Pattern using palette:**\n```\n%{timestamp:datetime('HH:mm:ss')} %{level:LEVEL} %{message}\n```\n\n**Pattern using fixed colours:**\n```\n%{timestamp:CYAN} %{level:BRIGHT_RED} %{message:GREEN}\n```\n\n### 4. Walkthrough Examples\n\n#### Example A: Simple plain text\n```\n\"%{timestamp} %{level} %{message}\"\n```\n\n**Output:**\n```\n2025-09-11T10:21:05 INFO Hello, World!\n```\n\n#### Example B: Neat columns with padding\n```\n\"%{timestamp:datetime('HH:mm:ss')|padRight(12)} %{level:padRight(7)} %{message}\"\n```\n\n**Output:**\n```\n10:21:05    INFO    Hello, World!\n10:21:06    ERROR   Something broke\n```\n\n#### Example C: Multilingual date + clipped messages\n```\n\"%{timestamp:datetime('EEEE d MMM yyyy HH:mm', 'fr-FR')|padRight(28)} %{level:padRight(5)} %{message:substring(0,30)|padRight(30,' ')}\"\n```\n\n**Output:**\n```\njeudi 11 sept. 2025 10:21       INFO  Bonjour le monde            \n```\n\n#### Example D: Colourized layout\n```\n\"%{timestamp:datetime('HH:mm:ss')|padRight(12)} [%{thread:BRIGHT_BLUE}] %{level:LEVEL|padRight(5)} %{message}\"\n```\n\n**Output:**\n```\n10:21:07    [main] INFO  Hello, World!\n```\n\nHere, `main` is bright blue, `INFO` is green (from palette).\n\n#### Example E: Columnar, with package/class dimmed\n```\n\"%{timestamp:datetime('yyyy-MM-dd')|padRight(12)} %{timestamp:datetime('HH:mm:ss')|padRight(10)} %{level:LEVEL|padRight(5)} %{package:DIM_WHITE}.%{class:BRIGHT_WHITE} - %{message:substring(0,60)|padRight(60,' ')} #%{sequence}\"\n```\n\n**Output:**\n```\n2025-09-11   10:21:08   INFO  com.example.Demo - Hello, World! tttt...             #42\n```\n\nHappy logging! 🧩\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquackster%2Fsimplelogger4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquackster%2Fsimplelogger4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquackster%2Fsimplelogger4j/lists"}