Topic: [SOLVED] Setting up a custom log

Hey folks,

i want to create a custom log so that i can write something like


but i am stuck right now.

I found this interesting howto:

(Section: Create Audit Log)

The Howto is fantastic, but i am stuck at this point:

To use the new AuditLogger, instantiate it with a File  instance:

logfile ='/path/to/audit.log', 'a')    
audit_log =

This is fine for a quick try in the console, but how do i use this in rails?

To be specific, where do i have to put this

logfile ='/path/to/audit.log', 'a')    
audit_log =

in rails, so that i can use



Thx for every help!

Last edited by j0llyr0g3r (2008-10-24 12:56:22)

Re: [SOLVED] Setting up a custom log


am i the only one trying to set up a custom log-file in the rails-world?

I would also appreciate a RTFM, if you tell me which one.......

Re: [SOLVED] Setting up a custom log

I also used the tips from … audit-logs

This goes to your environment.rb :

audit_logfile ="#{RAILS_ROOT}/log/audit.log", 'a')
audit_logfile.sync = true

To use it, simply call
AUDIT_LOG.error 'hello world'


Re: [SOLVED] Setting up a custom log

Hi and thx @der_flo.

Works like a charm, i still have to get use to the fact, that rails-config files are in ruby themselves.....