Forum: Ruby on Rails How can I let rails working on non-block mode?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7fbd0e99b27064b14793f028022974e5?d=identicon&s=25 Zhao Yi (youhaodeyi)
on 2009-03-30 05:26
When I run "ruby script/server" to start rails server, the current shell
will be blocked and all the output from rails will be written to the
current console. Does rails support a non-block mode and let the output
to be written to a specified log file?
60ddadf1a8a8ebac760e7e4cc1e342b3?d=identicon&s=25 Siddick Ebramsha (siddick)
on 2009-03-30 08:40
Zhao Yi wrote:
> When I run "ruby script/server" to start rails server, the current shell
> will be blocked and all the output from rails will be written to the
> current console. Does rails support a non-block mode and let the output
> to be written to a specified log file?

Use the -d option with the `ruby script/server` program. Then  WEBrick
server will run as a daemon.
7fbd0e99b27064b14793f028022974e5?d=identicon&s=25 Zhao Yi (youhaodeyi)
on 2009-03-30 09:13
Siddick Ebramsha wrote:
> Zhao Yi wrote:
>> When I run "ruby script/server" to start rails server, the current shell
>> will be blocked and all the output from rails will be written to the
>> current console. Does rails support a non-block mode and let the output
>> to be written to a specified log file?
>
> Use the -d option with the `ruby script/server` program. Then  WEBrick
> server will run as a daemon.

Yes it works, but how I can log its output?
thanks.
60ddadf1a8a8ebac760e7e4cc1e342b3?d=identicon&s=25 Siddick Ebramsha (siddick)
on 2009-03-30 09:24
The logs will be in the log/development.log file.
7fbd0e99b27064b14793f028022974e5?d=identicon&s=25 Zhao Yi (youhaodeyi)
on 2009-03-30 09:28
Siddick Ebramsha wrote:
> The logs will be in the log/development.log file.

Can I specify a log file?
40db9e75b3f5899258e3bdc0c9210154?d=identicon&s=25 Conrad Taylor (conradwt)
on 2009-03-30 09:58
(Received via mailing list)
On Mon, Mar 30, 2009 at 12:28 AM, Zhao Yi
<rails-mailing-list@andreas-s.net>wrote:

>
> Siddick Ebramsha wrote:
> > The logs will be in the log/development.log file.
>
> Can I specify a log file?


Hi, you should be able to configure the log_path by adding it to the
initializer block in your environment.rb.  For example,

Rails::Initializer.run do |config|

  ...

  # Note:  By default, the log_path is set to log/#{environment}.log
  config.log_path = <some_absolute_file_path>

end

Good luck,

*-Conrad
*
7fbd0e99b27064b14793f028022974e5?d=identicon&s=25 Zhao Yi (youhaodeyi)
on 2009-03-31 04:29
If I use "-d" to start the rails server, how can I stop it?
7fbd0e99b27064b14793f028022974e5?d=identicon&s=25 Zhao Yi (youhaodeyi)
on 2009-03-31 05:02
>
> Hi, you should be able to configure the log_path by adding it to the
> initializer block in your environment.rb.  For example,
>
> Rails::Initializer.run do |config|
>
>   ...
>
>   # Note:  By default, the log_path is set to log/#{environment}.log
>   config.log_path = <some_absolute_file_path>
>
> end
>

This log is rails log. What I want is application log. For example, in
my controller, I use puts to print message to the console, I will to log
this output.
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-03-31 10:52
(Received via mailing list)
On Mar 31, 4:02 am, Zhao Yi <rails-mailing-l...@andreas-s.net> wrote:
> > end
>
> This log is rails log. What I want is application log. For example, in
> my controller, I use puts to print message to the console, I will to log
> this output.

Don't use puts, use Rails.logger.info (or whatever log level you
want). Or you can create and pass around your own logger object but
why bother ?

Fred
7fbd0e99b27064b14793f028022974e5?d=identicon&s=25 Zhao Yi (youhaodeyi)
on 2009-03-31 12:50
Siddick Ebramsha wrote:
>
> Use the -d option with the `ruby script/server` program. Then  WEBrick
> server will run as a daemon.

How can i stop the rails server if using -d option?
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-03-31 14:12
(Received via mailing list)
On Mar 31, 11:50 am, Zhao Yi <rails-mailing-l...@andreas-s.net> wrote:
> Siddick Ebramsha wrote:
>
> > Use the -d option with the `ruby script/server` program. Then  WEBrick
> > server will run as a daemon.
>
> How can i stop the rails server if using -d option?

just kill it. grab the pid from ps (or the pidfile if there is one,
can't remember if there is)

Fred
This topic is locked and can not be replied to.