{"id":22282579,"url":"https://github.com/carbonfive/log_weasel","last_synced_at":"2025-06-13T13:32:34.621Z","repository":{"id":47469043,"uuid":"1357119","full_name":"carbonfive/log_weasel","owner":"carbonfive","description":"Instrument Rails and Resque with shared transaction IDs to trace execution of a unit of work across applications and application instances.","archived":false,"fork":false,"pushed_at":"2024-07-12T18:57:27.000Z","size":185,"stargazers_count":33,"open_issues_count":1,"forks_count":9,"subscribers_count":72,"default_branch":"master","last_synced_at":"2025-05-21T06:19:40.308Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/carbonfive.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":"2011-02-11T23:35:34.000Z","updated_at":"2025-02-21T15:46:34.000Z","dependencies_parsed_at":"2022-08-20T23:10:48.390Z","dependency_job_id":null,"html_url":"https://github.com/carbonfive/log_weasel","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/carbonfive/log_weasel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbonfive%2Flog_weasel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbonfive%2Flog_weasel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbonfive%2Flog_weasel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbonfive%2Flog_weasel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carbonfive","download_url":"https://codeload.github.com/carbonfive/log_weasel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbonfive%2Flog_weasel/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259653773,"owners_count":22890891,"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-03T16:33:39.390Z","updated_at":"2025-06-13T13:32:34.573Z","avatar_url":"https://github.com/carbonfive.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Log Weasel\n\nInstrument Rails and Resque with shared transaction IDs to trace execution of a unit of work across\napplications and application instances.\n\nThis particularly handy if you're using a system like \u003ca href=\"http://www.splunk.com\"\u003eSplunk\u003c/a\u003e to manage your log\nfiles across many applications and application instances.\n\n## Installation\n\nAdd log_weasel to your Gemfile:\n\n\u003cpre\u003e\ngem 'log_weasel'\n\u003c/pre\u003e\n\nUse bundler to install it:\n\n\u003cpre\u003e\nbundle install\n\u003c/pre\u003e\n\n## Rails 3\n\nFor Rails 3, we provide a Railtie that automatically configures and loads Log Weasel.\n\nTo see Log Weasel transaction IDs in your Rails logs either use the BufferedLogger provided or\ncustomize the formatting of your logger to include \u003ccode\u003eLogWeasel::Transaction.id\u003c/code\u003e.\n\n\u003cpre\u003e\nYourApp::Application.configure do\n  config.log_weasel.key = 'YOUR_APP'    # Optional. Defaults to Rails application name.\n\n  logger = LogWeasel::BufferedLogger.new \"#{Rails.root}/log/#{Rails.env}.log\"\n  config.logger                   = logger\n  config.action_controller.logger = logger\n  config.active_record.logger     = logger\nend\n\u003c/pre\u003e\n\n\n## Other\n\n### Configure\n\nLoad and configure Log Weasel with:\n\n\u003cpre\u003e\nLogWeasel.configure do |config|\n  config.key = \"YOUR_APP\"\nend\n\u003c/pre\u003e\n\n\u003ccode\u003econfig.key\u003c/code\u003e is a string that will be included in your transaction IDs and is particularly\nuseful in an environment where a unit of work may span multiple applications. It is optional but you must call\n\u003ccode\u003eLogWeasel.configure\u003c/code\u003e.\n\n### Rack\n\nLog Weasel provides Rack middleware to create and destroy a transaction ID for every HTTP request. You can use it\nin a any web framework that supports Rack (Rails, Sinatra,...) by using \u003ccode\u003eLogWeasel::Middleware\u003c/code\u003e in your middleware\nstack.\n\n## Resque\n\nWhen you configure Log Weasel as described above either in Rails or by explicitly calling \u003ccode\u003eLogWeasel.configure\u003c/code\u003e,\nit modifies Resque to include transaction IDs in all worker logs.\n\nStart your Resque worker with \u003ccode\u003eVERBOSE=1\u003c/code\u003e and you'll see transaction IDs in your Resque logs.\n\n## Airbrake\n\nIf you are using \u003ca href=\"http://airbrake.io/p\"\u003eAirbrake\u003c/a\u003e, Log Weasel will add the parameter\n\u003ccode\u003elog_weasel_id\u003c/code\u003e to Airbrake errors so that you can track execution through your application stack that\nresulted in the error. No additional configuration required.\n\n## Example\n\nIn this example we have a Rails app pushing jobs to Resque and a Resque worker that run with the Rails environment loaded.\n\n### HelloController\n\n\u003cpre\u003e\nclass HelloController \u0026lt; ApplicationController\n\n  def index\n    Resque.enqueue EchoJob, 'hello from HelloController'\n    Rails.logger.info(\"HelloController#index: pushed EchoJob\")\n  end\n\nend\n\u003c/pre\u003e\n\n### EchoJob\n\n\u003cpre\u003e\nclass EchoJob\n  @queue = :default_queue\n\n  def self.perform(args)\n    Rails.logger.info(\"EchoJob.perform: #{args.inspect}\")\n  end\nend\n\u003c/pre\u003e\n\nStart Resque with:\n\n\u003cpre\u003e\nQUEUE=default_queue rake resque:work VERBOSE=1\n\u003c/pre\u003e\n\nRequesting \u003ccode\u003ehttp://localhost:3030/hello/index\u003c/code\u003e, our development log shows:\n\n\u003cpre\u003e\n[2011-02-14 14:37:42] YOUR_APP-WEB-192587b585fa66b19638 48353 INFO\n\nStarted GET \"/hello/index\" for 127.0.0.1 at 2011-02-14 14:37:42 -0800\n[2011-02-14 14:37:42] YOUR_APP-WEB-192587b585fa66b19638 48353 INFO   Processing by HelloController#index as HTML\n[2011-02-14 14:37:42] YOUR_APP-WEB-192587b585fa66b19638 48353 INFO HelloController#index: pushed EchoJob\n[2011-02-14 14:37:42] YOUR_APP-WEB-192587b585fa66b19638 48353 INFO Rendered hello/index.html.erb within layouts/application (1.8ms)\n[2011-02-14 14:37:42] YOUR_APP-WEB-192587b585fa66b19638 48353 INFO Completed 200 OK in 14ms (Views: 6.4ms | ActiveRecord: 0.0ms)\n[2011-02-14 14:37:45] YOUR_APP-WEB-192587b585fa66b19638 48461 INFO EchoJob.perform: \"hello from HelloController\"\n\u003c/pre\u003e\n\nFire up a Rails console and push a job directly with:\n\n\u003cpre\u003e\n\u003e Resque.enqueue EchoJob, 'hi from Rails console'\n\u003c/pre\u003e\n\nand our development log shows:\n\n\u003cpre\u003e\n[2011-02-14 14:37:10] YOUR_APP-RESQUE-a8e54bfb76718d09f8ed 48453 INFO EchoJob.perform: \"hi from Rails console\"\n\u003c/pre\u003e\n\nand our resque log shows:\n\n\u003cpre\u003e\n***  got: (Job{default_queue} | EchoJob | [\"hello from HelloController\"] | {\"log_weasel_id\"=\u003e\"SAMPLE_APP-WEB-a65e45476ff2f5720e23\"})\n***  Running after_fork hook with [(Job{default_queue} | EchoJob | [\"hello from HelloController\"] | {\"log_weasel_id\"=\u003e\"SAMPLE_APP-WEB-a65e45476ff2f5720e23\"})]\n*** SAMPLE_APP-WEB-a65e45476ff2f5720e23 done: (Job{default_queue} | EchoJob | [\"hello from HelloController\"] | {\"log_weasel_id\"=\u003e\"SAMPLE_APP-WEB-a65e45476ff2f5720e23\"})\n\n***  got: (Job{default_queue} | EchoJob | [\"hi from Rails console\"] | {\"log_weasel_id\"=\u003e\"SAMPLE_APP-RESQUE-00919a012476121cf89c\"})\n***  Running after_fork hook with [(Job{default_queue} | EchoJob | [\"hi from Rails console\"] | {\"log_weasel_id\"=\u003e\"SAMPLE_APP-RESQUE-00919a012476121cf89c\"})]\n*** SAMPLE_APP-RESQUE-00919a012476121cf89c done: (Job{default_queue} | EchoJob | [\"hi from Rails console\"] | {\"log_weasel_id\"=\u003e\"SAMPLE_APP-RESQUE-00919a012476121cf89c\"})\n\u003c/pre\u003e\n\nUnits of work initiated from Resque, for example if using a scheduler like\n\u003ca href=\"https://github.com/bvandenbos/resque-scheduler\"\u003eresque-scheduler\u003c/a\u003e,\nwill include 'RESQUE' in the transaction ID to indicate that the work started in Resque.\n\n## Contributing\n\nIf you would like to contribute a fix or integrate Log Weasel transaction tracking into another frameworks\nplease fork the code, add the fix or feature in your local project and then send a pull request on github.\nPlease ensure that you include a test which verifies your changes.\n\n## Authors\n\n\u003ca href=\"http://github.com/asalant\"\u003eAlon Salant\u003c/a\u003e and \u003ca href=\"http://github.com/brettfishman\"\u003eBrett Fishman\u003c/a\u003e.\n\n## LICENSE\n\nCopyright (c) 2011 Carbon Five. See LICENSE for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarbonfive%2Flog_weasel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarbonfive%2Flog_weasel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarbonfive%2Flog_weasel/lists"}