# Problems with log4r and logger

**URL:** <https://www.ruby-forum.com/t/problems-with-log4r-and-logger/108360>\
**Category:** Rails\
**Created:** [July 2, 2007, 7:38pm UTC](https://www.ruby-forum.com/t/problems-with-log4r-and-logger/108360 "2007-07-02T19:38:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chirag](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecccb3/32.png) [@chirag](https://www.ruby-forum.com/u/chirag)\
**Post date:** [July 2, 2007, 7:38pm UTC](https://www.ruby-forum.com/t/problems-with-log4r-and-logger/108360/1 "2007-07-02T19:38:44Z")

</div>

I’m having problems with both logger and log4r. They both work fine on  
my local Windows machine but do not create the .log files when I try  
them on my hosted UNIX server (TextDrive)

Below is the code for both log4r and logger. Both methods write  
the .log file to the root Rails directory (not the directory where the  
code is located). I changed the permission to 777 on the Root Rails  
dir for the sake of testing and both methods still do not  
generate .log files. Any ideas?

Thanks! chirag

## Using logger

#require ‘logger’  
def halo\_logger  
logger\_fu = Logger.new(‘logfile.log’)  
logger\_fu.debug{ “params #{params} \n” }  
end

## Using log4r

require ‘log4r’  
include Log4r

def halo\_log4r  
config = {  
“filename” =\> “fu.log”,  
“maxsize” =\> 16000,  
“trunc” =\> true  
}

```
logger_fu = Logger.new 'myLog'

#alternate way of adding a file outputter
#out = RollingFileOutputter.new("myLog", config)
#logger_fu.add(out)

```

logger\_fu.outputters = RollingFileOutputter.new(“myLog”, config);  
logger\_fu.level = DEBUG  
logger\_fu.debug{ “params #{params} \n” }  
end
