{"id":23399007,"url":"https://github.com/timbunce/log-log4perl-layout-json","last_synced_at":"2025-04-11T17:35:07.861Z","repository":{"id":21401225,"uuid":"24719142","full_name":"timbunce/Log-Log4perl-Layout-JSON","owner":"timbunce","description":"OLD Perl Log::Log4perl::Layout::JSON - Now maintained at https://github.com/mschout/Log-Log4perl-Layout-JSON","archived":false,"fork":false,"pushed_at":"2016-08-14T12:29:19.000Z","size":180,"stargazers_count":2,"open_issues_count":4,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T13:39:29.844Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timbunce.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-02T13:05:31.000Z","updated_at":"2021-09-21T08:28:47.000Z","dependencies_parsed_at":"2022-08-21T10:41:05.529Z","dependency_job_id":null,"html_url":"https://github.com/timbunce/Log-Log4perl-Layout-JSON","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timbunce%2FLog-Log4perl-Layout-JSON","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timbunce%2FLog-Log4perl-Layout-JSON/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timbunce%2FLog-Log4perl-Layout-JSON/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timbunce%2FLog-Log4perl-Layout-JSON/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timbunce","download_url":"https://codeload.github.com/timbunce/Log-Log4perl-Layout-JSON/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248450365,"owners_count":21105667,"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":[],"created_at":"2024-12-22T09:51:34.252Z","updated_at":"2025-04-11T17:35:07.829Z","avatar_url":"https://github.com/timbunce.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Log::Log4perl::Layout::JSON\n\nLayout a log message as a JSON hash, including MDC data\n\n[![Build Status](https://secure.travis-ci.org/timbunce/Log-Log4perl-Layout-JSON.png)](http://travis-ci.org/timbunce/Log-Log4perl-Layout-JSON)\n[![Coverage Status](https://coveralls.io/repos/timbunce/Log-Log4perl-Layout-JSON/badge.png)](https://coveralls.io/r/timbunce/Log-Log4perl-Layout-JSON)\n\n# SYNOPSIS\n\nExample configuration:\n\n    log4perl.rootLogger = INFO, Test\n    log4perl.appender.Test = Log::Log4perl::Appender::String\n    log4perl.appender.Test.layout = Log::Log4perl::Layout::JSON\n\n\n    # Specify which fields to include in the JSON hash:\n    # (using PatternLayout placeholders)\n\n    log4perl.appender.Test.layout.field.message = %m\n    log4perl.appender.Test.layout.field.category = %c\n    log4perl.appender.Test.layout.field.class = %C\n    log4perl.appender.Test.layout.field.file = %F{1}\n    log4perl.appender.Test.layout.field.sub = %M{1}\n\n\n    # Specify a prefix string for the JSON (optional)\n    # http://blog.gerhards.net/2012/03/cee-enhanced-syslog-defined.html\n\n    log4perl.appender.Test.layout.prefix = @cee:\n\n\n    # Include the data in the Log::Log4perl::MDC hash (optional)\n    log4perl.appender.Test.layout.include_mdc = 1\n\n    # Use this field name for MDC data (else MDC data is placed at top level)\n    log4perl.appender.Test.layout.name_for_mdc = mdc\n\n\n    # Use canonical order for hash keys (optional)\n\n    log4perl.appender.Test.layout.canonical = 1\n\n# DESCRIPTION\n\nThis class implements a \"Log::Log4perl\" layout format, similar to\nLog::Log4perl::Layout::PatternLayout except that the output is a JSON\nhash.\n\nThe JSON hash is ASCII encoded, with no newlines or other whitespace,\nand is suitable for output, via Log::Log4perl appenders, to files and\nsyslog etc.\n\nContextual data in the Log::Log4perl::MDC hash can be included.\n\n## EXAMPLE\n\n    local Log::Log4perl::MDC-\u003eget_context-\u003e{request} = {\n        request_uri =\u003e $req-\u003erequest_uri,\n        query_parameters =\u003e $req-\u003equery_parameters\n    };\n\n    # ...\n\n    for my $id (@list_of_ids) {\n\n        local Log::Log4perl::MDC-\u003eget_context-\u003e{id} = $id;\n\n        do_something_useful($id);\n\n    }\n\nUsing code like that shown above, any log messages produced by\n`do_something_useful()` will automatically include 'contextual data'\nshowing the request URI, the hash of decoded query parameters, and the\ncurrent value of $id.\n\nIf there's a `$SIG{__WARN__}` handler setup to log warnings via\n\"Log::Log4perl\" then any warnings from perl, such as uninitialized\nvalues, will also be logged with this context data included.\n\nThe use of \"local\" ensures that contextual data doesn't stay in the MDC\nbeyond the relevant scope. (For more complex cases you could use\nsomething like Scope::Guard or simply take care to delete old data.)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimbunce%2Flog-log4perl-layout-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimbunce%2Flog-log4perl-layout-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimbunce%2Flog-log4perl-layout-json/lists"}