How to Stop Write Log in Smashing Project ?
manikandanselva opened this issue ยท 9 comments
Hi,
im getting huge size of log file from smashing on follow location Smashingproject/log/thin.log
How to disable log in Smashing?
Hi,
Please mind smashing has a --environment production
tag that reduces the amount of log. You can also specify another file to write the log lines, with --log
, and you can specify /dev/null as file to erase every input.
@atilleh Where do you specify the --enviroment production
or --log
flags?
@atilleh Where do you specify the
--enviroment production
or--log
flags?
Hey,
As describe here, Smashing uses Thin library to serve its content : https://github.com/Smashing/smashing/wiki/How-To%3A-Run-on-a-different-port%2C-or-in-production ; following the provided link, you can see that a -e / --environment option is available : https://github.com/macournoyer/thin
When starting Smashing, you usually use one of the following commands :
smashing start -p PORT
bundle exec smashing start -p PORT
You can specify as well the environment parameter:
smashing start -p PORT -e production
bundle exec smashing start -p PORT --environment production
Same for --log FILE_PATH
parameter.
@atilleh Thanks for the info. Really appreciate it. I was excepting the POST log messages to go away. Any ideas why it is continuing to log debug messages?
$ bundle exec smashing start --environment production --log /dev/null
Thin web server (v1.7.2 codename Bachmanity)
Maximum connections set to 1024
Listening on 0.0.0.0:3030, CTRL+C to stop
127.0.0.1 - - [12/Mar/2020:11:54:58 -0700] "POST /widgets/in_t HTTP/1.1" 204 - 0.0048
127.0.0.1 - - [12/Mar/2020:11:54:58 -0700] "POST /widgets/out_h HTTP/1.1" 204 - 0.0003
127.0.0.1 - - [12/Mar/2020:11:54:58 -0700] "POST /widgets/airspeed HTTP/1.1" 204 - 0.0001
127.0.0.1 - - [12/Mar/2020:11:54:58 -0700] "POST /widgets/flow1 HTTP/1.1" 204 - 0.0002
127.0.0.1 - - [12/Mar/2020:11:54:58 -0700] "POST /widgets/current HTTP/1.1" 204 - 0.0017
127.0.0.1 - - [12/Mar/2020:11:54:58 -0700] "POST /widgets/flow2 HTTP/1.1" 204 - 0.0003
127.0.0.1 - - [12/Mar/2020:11:54:58 -0700] "POST /widgets/out_t HTTP/1.1" 204 - 0.0002
127.0.0.1 - - [12/Mar/2020:11:54:58 -0700] "POST /widgets/status HTTP/1.1" 204 - 0.0002
127.0.0.1 - - [12/Mar/2020:11:54:58 -0700] "POST /widgets/in_h HTTP/1.1" 204 - 0.0002
127.0.0.1 - - [12/Mar/2020:11:54:58 -0700] "POST /widgets/queue HTTP/1.1" 204 - 0.0002
These are not debug messages, but incoming requests logs. Smashing provides through Thin several options you can get by adding --help after the start directive, on your command line.
These options contain the two following ones:
bundle exec smashing start --help
....
-q, --quiet Silence all logging
-d, --daemonize Run daemonized in the background
Both of them are producing the effect you want : requests are not displayed anymore.
The -q
option keeps the smashing process attached so you cannot do anything else except stop the process. On the other hand, -d
makes Smashing run in background - it will keep messages, but you won't see them anymore.
I would suggest you to use the following command:
bundle exec smashing start --environment production --log /var/log/smashing.log -d
It will be detached and messages will be logged in smashing.log for further investigations in case of issues.
Thank you @atilleh !
@atilleh would you like yo add your great tips to the project Wiki?
@kinow yeah, of course. Gonna prepare few documentations about architecture, automation, tips and under the hood tricks.
Closing as there's a workaround โ๏ธ