17
votes
3answers
15k views

Use Rack::CommonLogger in Sinatra

I have a small web-server that I wrote with Sinatra. I want to be able to log messages to a log file. I've read through http://www.sinatrarb.com/api/index.html and www.sinatrarb.com/intro.html, and ...
27
votes
2answers
14k views

Logging in Sinatra

I'm having trouble figuring out how to log messages with Sinatra. I'm not looking to log requests, but rather custom messages at certain points in my app. For example, when fetching a URL I would like ...
7
votes
5answers
5k views

Log every SQL query to database in Rails

I want to save to a log file some SQL query rails performs, (namely the CREATE, UPDATE and DELETE ones) therefore I need to intercept all queries and then filter them maybe with some regexp and log ...
29
votes
1answer
14k views

Setting up the logger in rails 3

I'm trying to figure out how to use the logger with rails 3. I need to log to a file not have it in the console, but I just can't figure out how to set it up and then how to write something to that ...
19
votes
4answers
5k views

How can I have ruby logger log output to stdout as well as file?

Someting like a tee functionality in logger.
7
votes
2answers
5k views

Rails console is not outputting SQL Statements to my Development Log

When I access my Webrick server via the localhost, or when I run rails migrations, my development.log is correctly written to. However, when I bootup my rails console with "rails c" and then try and ...
24
votes
6answers
14k views

How do I log the entire trace back of a Ruby exception using the default Rails logger?

I am working on rails project and I am trying to get exceptions to be logged to the rails log files. I know I can call logger.error $! to get the first line of the exception logged to the file. But, ...
10
votes
6answers
9k views

How can we watch the Rails development log?

A member of my team is developing a Rails app on Windows XP. We are finding that when we run the app, either launching it within NetBeans or by opening a console and calling script/server, the Rails ...
5
votes
3answers
3k views

Include params/request information in Rails logger?

I'm trying to get some more information into my Rails logs, specifically the requested URI or current params, if available (and I appreciate that they won't always be). However I just don't seem able ...
5
votes
2answers
4k views

Properly using Log4r in Ruby Application

I must really be missing something obvious, but I'm having trouble with general use of Log4r in my Ruby application. I am able to log without issue, but the overhead seems clunky the way I have it ...
4
votes
5answers
1k views

How to silence the call to a rails controller's action all together

I've figured out how to silence the contents of an action by wrapping everything inside the action's method in a logger.silence block. However, I still get the call to the action showing up in the ...
4
votes
5answers
2k views

Automatically Logging Exceptions in Ruby

Is there a library or easy way to catch exceptions thrown in a Ruby program and log it to a file? I've looked over log4r and logger, but the docs on both don't provide any examples on how I would do ...
9
votes
1answer
1k views

Rake: logging any task executing

how can I create database logging for every rake task without changing source of tasks ? I need to store datetime , task name , parameters . Is there some kind of observer etc ?
5
votes
4answers
2k views

Ruby, run linux commands one by one, by SSH and LOG everything

I want to write code in Ruby witch net::ssh that run commands one by one on remote linux machine and log everything (called command, stdout and stderr on linux machine). So I write function: def ...
1
vote
2answers
891 views

How to rspec mock ruby rails logger class

Hi I and trying to rspec mock the following class: class Person def initialize(personid) Rails.logger.debug "Creating person with id #{personid}" end end Using this: ...

1 2
15 30 50 per page