Jump to content

The ultimate community for Ruby on Rails developers.


Photo

how to configure the ROR logs

Logs

  • Please log in to reply
4 replies to this topic

#1 balvvant

balvvant

    Passenger

  • Members
  • 1 posts

Posted 30 August 2013 - 12:11 PM

Hi,
I am new to rails. We are using rails 3.2 and Ruby 1.9. Till date we are using default ROR logger which logs in a environment specific .log file.
But due to some reasons my seniors have decided to redirect these request to a standalone server. The network people have configured a server with port 514. So if the ip of server is 10.10.1.154 then the server is configured in such a ways that any data posted on this server at port 514 will be stored in a DB.

I need to configure my ROR logs so that they send the data to above server instead of default log file. Can anyone please help me on this?

Thank you in advance for your help.



#2 MrPepper

MrPepper

    Dispatcher

  • Members
  • 31 posts
  • LocationEast Coast

Posted 03 September 2013 - 04:34 PM

Sorry I am not a Rails master.. But did some quick googling and found this:

http://stackoverflow...gging-directory

What I've also notice is many saving their logs to a database such as a SQL DB. But if you have a file server setup I dont see why you can't tell RoR to save to that network drive. 



#3 katafrakt

katafrakt

    Signalman

  • Members
  • 16 posts
  • LocationKraków, PL

Posted 04 September 2013 - 08:23 AM

So, it is not about simply changing the destination of log files but you need to change the way the logs are persisted (make a net request instead of writing to a file) - do I understand correctly?



#4 MrPepper

MrPepper

    Dispatcher

  • Members
  • 31 posts
  • LocationEast Coast

Posted 04 September 2013 - 03:50 PM

Sounds about right Katafrakt.



#5 katafrakt

katafrakt

    Signalman

  • Members
  • 16 posts
  • LocationKraków, PL

Posted 05 September 2013 - 10:25 AM

In that case you probably have to write custom Logger to do it. Here is a stub (not tested though)

class ServerLogger < Logger
	def initialize(logdev, shift_age = 0, shift_size = 1048576)
		super(logdev, shift_age, shift_size)
		@logdev = ServerLogDevice.new('10.10.1.154', 514)
	end
end

class ServerLogDevice
	def initialize(addres, port)
		@address = address
		@port = port
	end

	def write(message)
		# post message to your server here
	end
end





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users