{"id":24617421,"url":"https://github.com/antonsjava/slformatter","last_synced_at":"2025-08-04T12:07:08.231Z","repository":{"id":35791196,"uuid":"40072265","full_name":"antonsjava/slformatter","owner":"antonsjava","description":"Simple Line Formatter for Java logging API","archived":false,"fork":false,"pushed_at":"2023-03-31T11:13:25.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-23T13:20:09.582Z","etag":null,"topics":["java","logging"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"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/antonsjava.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":"2015-08-02T07:32:08.000Z","updated_at":"2021-12-15T20:12:40.000Z","dependencies_parsed_at":"2025-01-24T23:35:06.962Z","dependency_job_id":null,"html_url":"https://github.com/antonsjava/slformatter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/antonsjava/slformatter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonsjava%2Fslformatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonsjava%2Fslformatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonsjava%2Fslformatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonsjava%2Fslformatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antonsjava","download_url":"https://codeload.github.com/antonsjava/slformatter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonsjava%2Fslformatter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268693597,"owners_count":24291656,"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","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"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":["java","logging"],"created_at":"2025-01-24T23:24:17.509Z","updated_at":"2025-08-04T12:07:08.184Z","avatar_url":"https://github.com/antonsjava.png","language":"Java","readme":"\n# slformatter\n\nThe slformatter is Simple Line Formatter for Java logging API. It is \njava library with class extending **java.util.logging.Formatter**.\nThe formatter outputs log records in one simple line and allows you to \nformat the resulting line.\n\n## Motivation\n\nI don't like that two line output of standard java formatter. I like to \nhave some time and logger name information together with message output. \nBut I want to have it in one line with fixed length meta info and then \nmesage.\n\nIt is also useful to configure logging easily in code directly so you \ncan use logging for small standalone applications or just ad hoc 'testing'\nmain methods. \n\n## Configuration\n\nAll details of configuration is described [here](./config.md). \nThe formatter is configured by pattern string where you can specify how \noutput looks like.\n\nFollowing pattern\n```\n${date} ${time} ${level}: ${message}\n```\nproduces output like\n```\n2015.07.31 22:53:56.023 FINER: file size 12342\n2015.07.31 22:53:56.023 INFO: start copy of war file\n2015.07.31 22:53:56.023 INFO: copy MzvZuZobrPortlety.war 540.0 kB/s 75%  \n2015.07.31 22:53:57.078 INFO: copy MzvZuZobrPortlety.war 377.3 kB/s 79% \n2015.07.31 22:53:58.026 INFO: copy MzvZuZobrPortlety.war 297.0 kB/s 83% \n```\n\nIt is also possible to format length of individual parts of the pattern. \nMaximum and minimum length can be specified. \n\nFollowing pattern\n```\n${date} ${time} ${level:3:-3}: ${message}\n```\nproduces output like \n```\n2015.07.31 22:53:56.023 FIN: file size 12342\n2015.07.31 22:53:56.023 INF: start copy of war file\n2015.07.31 22:53:56.023 INF: copy MzvZuZobrPortlety.war 540.0 kB/s 75%  \n2015.07.31 22:53:57.078 INF: copy MzvZuZobrPortlety.war 377.3 kB/s 79% \n2015.07.31 22:53:58.026 INF: copy MzvZuZobrPortlety.war 297.0 kB/s 83% \n```\nLevel is cut to maximum and minimum 3 chars so all messages starts at \nsame position.\n\n## Usage\n\nSome times it is useful to configure the logging output from code itself. \nI personally like to start small peace of code and setup all log levels \nfor my loggers (which are named using class names) and info level for \nall other loggers.\n\nFollowing code define such configuration\n```\n SLConf.reset(); // reset previous conf\n        \n SLConf.rootLogger() // for root logger\n       .console() // create console handler for System.out\n       .filterWarn() // with filter for warn level\n       .pattern() // start pattern\n       .time()\n       .text(\" \").level(3, -3)\n       .text(\" \").simpleName(-20, -20)\n       .text(\" \").message()\n       .patternEnd() // end pattern\n       .handler(); // apply handler to logger\n        \n SLConf.rootLogger() // for root logger\n       .file(\"target/test.log\") // create file handler\n       .filterAll() // with all level filter\n       .pattern() // start pattern\n       .date()\n       .text(\" \").time()\n       .text(\" \").level(3, -3)\n       .text(\" \").simpleName(-20, -20)\n       .text(\" \").message()\n       .patternEnd() // end pattern\n       .handler(); // apply handler to logger\n        \n SLConf.rootLogger().info(); // set all loggers to info level\n SLConf.logger(\"sk.antons\").all(); // set my logers to all levels\n```\n\n## Usage shortcuts\n\nAs I usually needs such logging configuration I created two shortcuts \n```\n SLConf.simpleConsole(\"sk.antons\"); // set all loggers to info level \n                                    // and sk.antons loggers to all levels\n                                    // only console output\n\n SLConf.simpleFile(\"sk.antons\", \"target/test.log\"); \n                                    // set all loggers to info level \n                                    // and sk.antons loggers to all levels\n                                    // info to console and all other to file.\n\n```\n\n## Maven usage\n\n```\n   \u003cdependency\u003e\n      \u003cgroupId\u003eio.github.antonsjava\u003c/groupId\u003e\n      \u003cartifactId\u003eslformatter\u003c/artifactId\u003e\n      \u003cversion\u003eLASTVERSION\u003c/version\u003e\n   \u003c/dependency\u003e\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonsjava%2Fslformatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonsjava%2Fslformatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonsjava%2Fslformatter/lists"}