{"id":23119709,"url":"https://github.com/eran-gil/autofac.log4net","last_synced_at":"2025-08-17T00:31:56.341Z","repository":{"id":54666864,"uuid":"87719993","full_name":"eran-gil/autofac.log4net","owner":"eran-gil","description":"Autofac module for using the log4net logging framework","archived":false,"fork":false,"pushed_at":"2023-01-06T20:05:05.000Z","size":65,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-01T01:53:49.314Z","etag":null,"topics":["autofac","autofac-container","dependency-injection","ioc","log4net","logging"],"latest_commit_sha":null,"homepage":"","language":"C#","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/eran-gil.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}},"created_at":"2017-04-09T15:50:20.000Z","updated_at":"2023-05-18T08:47:25.000Z","dependencies_parsed_at":"2023-02-06T08:31:53.512Z","dependency_job_id":null,"html_url":"https://github.com/eran-gil/autofac.log4net","commit_stats":null,"previous_names":["erangil2/autofac.log4net"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/eran-gil/autofac.log4net","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eran-gil%2Fautofac.log4net","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eran-gil%2Fautofac.log4net/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eran-gil%2Fautofac.log4net/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eran-gil%2Fautofac.log4net/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eran-gil","download_url":"https://codeload.github.com/eran-gil/autofac.log4net/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eran-gil%2Fautofac.log4net/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270791255,"owners_count":24645781,"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-16T02:00:11.002Z","response_time":91,"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":["autofac","autofac-container","dependency-injection","ioc","log4net","logging"],"created_at":"2024-12-17T05:40:41.109Z","updated_at":"2025-08-17T00:31:56.022Z","avatar_url":"https://github.com/eran-gil.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"Autofac.log4net\n=====================\n## Description\nAutofac.log4net is a library that allows easy integration of log4net with the Autofac IoC container.\nIt contains a Log4NetModule to support injection of ILog properties and constructor parameter to instances created through the Autofac container.\n\n[![CI Status](https://dev.azure.com/erangil/autofac.log4net/_apis/build/status/autofac.log4net%20CI?branchName=master)](https://dev.azure.com/erangil/autofac.log4net/_build/latest?definitionId=10\u0026branchName=master)\n\n## Requirements\n- Supports .NET 4.6.1 and above.\n- The package has 2 package dependencies:\n    - log4net \u003e= 2.0.8\n    - Autofac \u003e= 6.0.0\n## Features\n- If a class has a property or constructor parameter of type ILog, it will inject it with a logger.\n    - The logger instance will be by default the logger with the class type name.\n    - If the type/namespace of the class is mapped in the module, the logger instance will be the mapped logger.\n- There are 2 type of mappings the Log4NetModule:\n    1. Mapping by types.\n    2. Mapping by namespaces - when injecting the logger, the most specific namespace mapping will be used.\n- The module allows configuring the application to a custom logger configuration file and watching it.\n\n## License:\n[MIT License](https://github.com/erangil2/autofac.log4net/blob/master/LICENSE)\n\n## Examples\n\n#### Class with an ILog Constructor Parameter\n```cs\npublic class InjectableClass {\n    private readonly ILog _logger;\n    \n    public InjectableClass(ILog logger){\n        _logger = logger;\n    }\n}\n```\n\n#### Class with an ILog Property\n```cs\npublic class InjectableClass {\n    public ILog Logger { get; set; }\n}\n```\n\n#### Simple Module Registration\n```cs\nvar builder = new ContainerBuilder();\nbuilder.RegisterModule\u003cLog4NetModule\u003e();\n```\n\n#### Custom Module Registration\n```cs\nvar builder = new ContainerBuilder();\nvar loggingModule = new Log4NetModule(\"logger.config\", true);\nbuilder.RegisterModule(loggingModule);\n```\n\n#### Mapping Types and Namespaces to Loggers\n```cs\nvar builder = new ContainerBuilder();\nvar loggingModule = new Log4NetModule();\nloggingModule.MapTypeToLoggerName(typeof(InjectableClass), \"Logger1\");\nloggingModule.MapNamespaceToLoggerName(\"Autofac.log4net\", \"Logger2\");\nbuilder.RegisterModule(loggingModule);\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feran-gil%2Fautofac.log4net","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feran-gil%2Fautofac.log4net","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feran-gil%2Fautofac.log4net/lists"}