我正在使用此代码启用我的Sinatra应用程序中的日志记录:
log_file = File.new('my_log_file.log', "a")
$stdout.reopen(log_file)
$stderr.reopen(log_file)
$stdout.sync=true
$stderr.sync=true
Run Code Online (Sandbox Code Playgroud)
实际的日志记录使用:
logger.debug("Starting call. Params = #{params.inspect}")
Run Code Online (Sandbox Code Playgroud)
事实证明,只记录INFO或更高级别的日志消息,并且不记录DEBUG消息.我正在寻找一种方法来设置日志级别为DEBUG.