{"id":19990737,"url":"https://github.com/raisedapp/Hangfire.JobsLogger","last_synced_at":"2025-05-04T10:30:41.445Z","repository":{"id":38083189,"uuid":"215084167","full_name":"raisedapp/Hangfire.JobsLogger","owner":"raisedapp","description":"A Hangfire extension to store a log during job execution.","archived":false,"fork":false,"pushed_at":"2023-02-24T16:34:39.000Z","size":1174,"stargazers_count":34,"open_issues_count":8,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-07T03:06:15.301Z","etag":null,"topics":["hangfire","hangfire-extension","logging","nuget","recurring-job"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/Hangfire.JobsLogger","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/raisedapp.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":"2019-10-14T15:50:07.000Z","updated_at":"2024-07-12T10:50:51.000Z","dependencies_parsed_at":"2024-06-18T21:46:34.001Z","dependency_job_id":"c6a97bc8-2807-475f-a7ca-25d5c2327a92","html_url":"https://github.com/raisedapp/Hangfire.JobsLogger","commit_stats":{"total_commits":97,"total_committers":4,"mean_commits":24.25,"dds":"0.11340206185567014","last_synced_commit":"b0f0f1bd3202e9285928edecdf9fa88782a67992"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raisedapp%2FHangfire.JobsLogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raisedapp%2FHangfire.JobsLogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raisedapp%2FHangfire.JobsLogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raisedapp%2FHangfire.JobsLogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raisedapp","download_url":"https://codeload.github.com/raisedapp/Hangfire.JobsLogger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252319943,"owners_count":21729039,"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":["hangfire","hangfire-extension","logging","nuget","recurring-job"],"created_at":"2024-11-13T04:51:26.987Z","updated_at":"2025-05-04T10:30:40.747Z","avatar_url":"https://github.com/raisedapp.png","language":"C#","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=RMLQM296TCM38\u0026item_name=For+the+development+of+Hangfire.JobsLogger\u0026currency_code=USD\u0026source=url"],"categories":["C\\#"],"sub_categories":[],"readme":"# Hangfire.JobsLogger\n[![NuGet](https://buildstats.info/nuget/Hangfire.JobsLogger)](https://www.nuget.org/packages/Hangfire.JobsLogger)\n[![Actions Status Master](https://github.com/raisedapp/Hangfire.JobsLogger/workflows/CI-HF-JOBSLOGGER/badge.svg?branch=master)](https://github.com/raisedapp/Hangfire.JobsLogger/actions)\n[![Actions Status Develop](https://github.com/raisedapp/Hangfire.JobsLogger/workflows/CI-HF-JOBSLOGGER/badge.svg?branch=develop)](https://github.com/raisedapp/Hangfire.JobsLogger/actions)\n[![Official Site](https://img.shields.io/badge/site-hangfire.io-blue.svg)](http://hangfire.io)\n[![License MIT](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)\n\n## Overview\nA Hangfire extension to store a log during job execution\n\n![joblogshistory](content/job_logs_history.png)\n\n## Installation\nInstall a package from Nuget. \n```\nInstall-Package Hangfire.JobsLogger\n```\n\n## Usage\n\n### DotNetCore\n\nFor service side:\n```csharp\nservices.AddHangfire(config =\u003e config.UseSqlServerStorage(Configuration.GetConnectionString(\"HangfireConnection\"))\n                                                 .UseJobsLogger();\n```\n\n### NetFramework\n\nFor startup side:\n```csharp\nGlobalConfiguration.Configuration.UseSqlServerStorage(\"HangfireConnection\").UseJobsLogger();\n```\n\n### Example\n\n```csharp\nusing Hangfire.JobsLogger;\n\nRecurringJob.AddOrUpdate(() =\u003e taskExample.TaskMethod(null), Cron.Minutely);\n\n//...\n\nprivate readonly ILogger _log = ApplicationLogging.CreateLogger\u003cTaskExample\u003e();\n\npublic void TaskMethod(PerformContext context)\n{\n  var jobId = context.BackgroundJob.Id;\n\n  foreach (int i in Enumerable.Range(1, 10)) \n  {\n    context.LogTrace($\"{i} - Trace Message.. {DateTime.UtcNow.Ticks}\");\n    context.LogDebug($\"{i} - Debug Message.. {DateTime.UtcNow.Ticks}\");\n    context.LogInformation($\"{i} - Information Message.. {DateTime.UtcNow.Ticks}\");\n    context.LogWarning($\"{i} - Warning Message.. {DateTime.UtcNow.Ticks}\");\n    context.LogError($\"{i} - Error Message.. {DateTime.UtcNow.Ticks}\");\n    context.LogCritical($\"{i} - Critical Message.. {DateTime.UtcNow.Ticks}\");\n\n    //Traditional ILogger Usage\n    _log.LogTrace(jobId: jobId, $\"{i} - Trace Message.. {DateTime.UtcNow.Ticks}\");\n    _log.LogDebug(jobId: jobId, $\"{i} - Debug Message.. {DateTime.UtcNow.Ticks}\");\n    _log.LogInformation(jobId: jobId, $\"{i} - Information Message.. {DateTime.UtcNow.Ticks}\");\n    _log.LogWarning(jobId: jobId, $\"{i} - Warning Message.. {DateTime.UtcNow.Ticks}\");\n    _log.LogError(jobId: jobId, $\"{i} - Error Message.. {DateTime.UtcNow.Ticks}\");\n    _log.LogCritical(jobId: jobId, $\"{i} - Critical Message.. {DateTime.UtcNow.Ticks}\");\n  }\n}\n```\n\n**Note**\nHangfire is responsible for injecting an instance of the PerformContext class.\n\nThe logs can be consulted in the detail of the logs on the enqueued state card:\n![jobdetail](content/job_detail.png)\n\n#### Options\n\nIn the UseJobsLogger method you can use an instance of the Hangfire.JobsLogger.JobsLoggerOptions class to specify some options of this plugin.\n\nBelow is a description of them:\n\n`Option` | `Description` | `Default Value`\n--- | --- | ---\n**LogLevel** | Set the log level to be stored in hangfire | **Microsoft.Extensions.Logging.LogLevel.Trace**\n**LogTraceColor** |  Color that will be used to display log messages of this type | **System.Drawing.Color.LightGreen**\n**LogDebugColor** |  Color that will be used to display log messages of this type | **System.Drawing.Color.DarkGreen**\n**LogInformationColor** |  Color that will be used to display log messages of this type | **System.Drawing.Color.Blue**\n**LogWarningColor** |  Color that will be used to display log messages of this type | **System.Drawing.Color.DarkOrange**\n**LogErrorColor** |  Color that will be used to display log messages of this type | **System.Drawing.Color.Red**\n**LogCriticalColor** |  Color that will be used to display log messages of this type | **System.Drawing.Color.DarkRed**\n\n## Credits\n * Brayan Mota\n * Lucas Ferreras\n \n## Thanks\n\nThis project would not have been possible, without the collaboration of the following projects:\n\n * [Hangfire.Console](https://github.com/pieceofsummer/Hangfire.Console)\n * [Hangfire.Heartbeat](https://github.com/ahydrax/Hangfire.Heartbeat)\n * [Hangfire.RecurringJobAdmin](https://github.com/bamotav/Hangfire.RecurringJobAdmin)\n * [Hangfire.LiteDb](https://github.com/codeyu/Hangfire.LiteDB)\n * [Hangfire.Tags](https://github.com/face-it/Hangfire.Tags)\n \n## Donation\nIf this project help you reduce time to develop, you can give me a cup of coffee :) \n\n[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=RMLQM296TCM38\u0026item_name=For+the+development+of+Hangfire.JobsLogger\u0026currency_code=USD\u0026source=url)\n\n## License\nThis project is under MIT license. You can obtain the license copy [here](https://github.com/raisedapp/Hangfire.JobsLogger/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraisedapp%2FHangfire.JobsLogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraisedapp%2FHangfire.JobsLogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraisedapp%2FHangfire.JobsLogger/lists"}