Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9162215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:09:28+00:00 2026-06-17T14:09:28+00:00

I have some Ruby code that I am testing stand alone before integrating into

  • 0

I have some Ruby code that I am testing stand alone before integrating into a Rails app. Because the final app. is in Rails I have numerous calls to Rails.logging.xxx that I want in there, but with these I can’t run the stand alone app because it doesn’t know about Rails.logging. How can I set it up so I can have these logging calls both in my CLI test app. and work in the final Rails deployment?

TY,
Fred

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:09:29+00:00Added an answer on June 17, 2026 at 2:09 pm

    Why not just create a simple stub logger that is only available in the CLI version? For example:

    class Rails
      def self.logger
         @logger ||= Logger.new('cli_logger.log')
      end
    end
    
    Rails.logger.info("Spam")
    

    Or perhaps more Rails-like:

    class Rails
      cattr_accessor :logger
    end
    
    Rails.logger = Logger.new('cli_logger.log')
    Rails.logger.info("It works")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a Ruby on Rails app, we have some details which are stored as
I have some C++ Win32 code that I want to call from Ruby. But
I have just optimised some Ruby code that was in a controller method, replacing
I have some C code which writes Ruby code into Git's post-commit hook. The
I have some code that needs to rescue multiple types of exceptions in ruby:
I have some Ruby code that is putting out JSON like this: def nearby
Little question about Ruby error handling. I have some code that roughly resembles the
I have some Ruby code that uses protected level attr_readers to be able to
I have some ruby code like this: my_hash = { key1: value, key2: value
I am newbie in Ruby.. seeking some help.. I have a code DB =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.