mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
- Log to STDERR, but redirect STDERR/STDOUT according to the log
settings.
This commit is contained in:
parent
a4a4490baf
commit
71ce64cf16
2 changed files with 18 additions and 2 deletions
15
bin/logstash
15
bin/logstash
|
@ -68,8 +68,19 @@ if settings.daemonize
|
|||
end
|
||||
end
|
||||
|
||||
agent = LogStash::Agent.new(config)
|
||||
if settings.logfile
|
||||
agent.log_to(settings.logfile)
|
||||
logfile = File.open(settings.logfile, "w")
|
||||
STDOUT.reopen(logfile)
|
||||
STDERR.reopen(logfile)
|
||||
elsif settings.daemonize
|
||||
# Write to /dev/null if
|
||||
devnull = File.open("/dev/null", "w")
|
||||
STDOUT.reopen(devnull)
|
||||
STDERR.reopen(devnull)
|
||||
end
|
||||
|
||||
agent = LogStash::Agent.new(config)
|
||||
#if settings.logfile
|
||||
#agent.log_to(settings.logfile)
|
||||
#end
|
||||
agent.run
|
||||
|
|
|
@ -133,6 +133,11 @@ if settings.logfile
|
|||
logfile = File.open(settings.logfile, "w")
|
||||
STDOUT.reopen(logfile)
|
||||
STDERR.reopen(logfile)
|
||||
elsif settings.daemonize
|
||||
# Write to /dev/null if
|
||||
devnull = File.open("/dev/null", "w")
|
||||
STDOUT.reopen(devnull)
|
||||
STDERR.reopen(devnull)
|
||||
end
|
||||
|
||||
Rack::Handler::Thin.run(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue