New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StaticFiles Middleware #63
Comments
It also doesn't crash on the server, after reconnecting to the server and listing my processes |
Commented out https://github.com/nickel-org/nickel.rs/blob/master/src/static_files_handler.rs#L51 and used my local nickel for building my app.
So it's indeed the printing to stdout which causes this problem. |
Not sure if we can use the code optimization level to decide if we should use println! or not.
|
In addition we should not forbid println! in "production mode", but prefer to set stdout to a logpath. |
iron uses https://github.com/iron/static-file/blob/master/src/lib.rs#L88 |
Okay cool, so for now we should use the same approach. |
Getting some weird error for: https://github.com/Benny1992/nickel.rs/blob/master/src/static_files_handler.rs#L55, also added the log crate into static_files_handlers.rs Error: Could not compile `nickel`.
--- stderr
<log macros>:3:21: 3:24 error: failed to resolve. Maybe a missing `extern crate log`?
<log macros>:3 static LOC: ::log::LogLocation = ::log::LogLocation {
^~~
<log macros>:1:1: 13:2 note: in expansion of log!
<log macros>:2:46: 2:76 note: expansion site
<log macros>:1:1: 3:2 note: in expansion of debug!
src/static_files_handler.rs:55:17: 55:116 note: expansion site
<log macros>:3:21: 3:39 error: use of undeclared type name `log::LogLocation`
<log macros>:3 static LOC: ::log::LogLocation = ::log::LogLocation {
^~~~~~~~~~~~~~~~~~
<log macros>:1:1: 13:2 note: in expansion of log!
<log macros>:2:46: 2:76 note: expansion site
<log macros>:1:1: 3:2 note: in expansion of debug!
src/static_files_handler.rs:55:17: 55:116 note: expansion site
<log macros>:3:42: 3:45 error: failed to resolve. Maybe a missing `extern crate log`?
<log macros>:3 static LOC: ::log::LogLocation = ::log::LogLocation {
^~~
<log macros>:1:1: 13:2 note: in expansion of log!
<log macros>:2:46: 2:76 note: expansion site
<log macros>:1:1: 3:2 note: in expansion of debug!
src/static_files_handler.rs:55:17: 55:116 note: expansion site
<log macros>:3:42: 3:60 error: `log::LogLocation` does not name a structure
<log macros>:3 static LOC: ::log::LogLocation = ::log::LogLocation {
^~~~~~~~~~~~~~~~~~
<log macros>:1:1: 13:2 note: in expansion of log!
<log macros>:2:46: 2:76 note: expansion site
<log macros>:1:1: 3:2 note: in expansion of debug!
src/static_files_handler.rs:55:17: 55:116 note: expansion site
<log macros>:2:51: 2:54 error: failed to resolve. Maybe a missing `extern crate log`?
<log macros>:2 ($($arg:tt)*) => (if cfg!(not(ndebug)) { log!(::log::DEBUG, $($arg)*) })
^~~
<log macros>:1:1: 13:2 note: in expansion of log!
<log macros>:2:46: 2:76 note: expansion site
<log macros>:1:1: 3:2 note: in expansion of debug!
src/static_files_handler.rs:55:17: 55:116 note: expansion site
<log macros>:2:51: 2:63 error: unresolved name `log::DEBUG`.
<log macros>:2 ($($arg:tt)*) => (if cfg!(not(ndebug)) { log!(::log::DEBUG, $($arg)*) })
^~~~~~~~~~~~
<log macros>:1:1: 13:2 note: in expansion of log!
<log macros>:2:46: 2:76 note: expansion site
<log macros>:1:1: 3:2 note: in expansion of debug!
src/static_files_handler.rs:55:17: 55:116 note: expansion site
<log macros>:4:17: 4:20 error: failed to resolve. Maybe a missing `extern crate log`?
<log macros>:4 (lvl != ::log::DEBUG || cfg!(not(ndebug))) &&
^~~
<log macros>:1:1: 8:2 note: in expansion of log_enabled!
<log macros>:9:12: 9:31 note: expansion site
<log macros>:1:1: 13:2 note: in expansion of log!
<log macros>:2:46: 2:76 note: expansion site
<log macros>:1:1: 3:2 note: in expansion of debug!
src/static_files_handler.rs:55:17: 55:116 note: expansion site
<log macros>:4:17: 4:29 error: unresolved name `log::DEBUG`.
<log macros>:4 (lvl != ::log::DEBUG || cfg!(not(ndebug))) &&
^~~~~~~~~~~~
<log macros>:1:1: 8:2 note: in expansion of log_enabled!
<log macros>:9:12: 9:31 note: expansion site
<log macros>:1:1: 13:2 note: in expansion of log!
<log macros>:2:46: 2:76 note: expansion site
<log macros>:1:1: 3:2 note: in expansion of debug!
src/static_files_handler.rs:55:17: 55:116 note: expansion site
<log macros>:5:16: 5:19 error: failed to resolve. Maybe a missing `extern crate log`?
<log macros>:5 lvl <= ::log::log_level() &&
^~~
<log macros>:1:1: 8:2 note: in expansion of log_enabled!
<log macros>:9:12: 9:31 note: expansion site
<log macros>:1:1: 13:2 note: in expansion of log!
<log macros>:2:46: 2:76 note: expansion site
<log macros>:1:1: 3:2 note: in expansion of debug!
src/static_files_handler.rs:55:17: 55:116 note: expansion site
<log macros>:5:16: 5:32 error: unresolved name `log::log_level`.
<log macros>:5 lvl <= ::log::log_level() &&
^~~~~~~~~~~~~~~~
<log macros>:1:1: 8:2 note: in expansion of log_enabled!
<log macros>:9:12: 9:31 note: expansion site
<log macros>:1:1: 13:2 note: in expansion of log!
<log macros>:2:46: 2:76 note: expansion site
<log macros>:1:1: 3:2 note: in expansion of debug!
src/static_files_handler.rs:55:17: 55:116 note: expansion site
<log macros>:6:9: 6:12 error: failed to resolve. Maybe a missing `extern crate log`?
<log macros>:6 ::log::mod_enabled(lvl, module_path!())
^~~
<log macros>:1:1: 8:2 note: in expansion of log_enabled!
<log macros>:9:12: 9:31 note: expansion site
<log macros>:1:1: 13:2 note: in expansion of log!
<log macros>:2:46: 2:76 note: expansion site
<log macros>:1:1: 3:2 note: in expansion of debug!
src/static_files_handler.rs:55:17: 55:116 note: expansion site
<log macros>:6:9: 6:27 error: unresolved name `log::mod_enabled`.
<log macros>:6 ::log::mod_enabled(lvl, module_path!())
^~~~~~~~~~~~~~~~~~
<log macros>:1:1: 8:2 note: in expansion of log_enabled!
<log macros>:9:12: 9:31 note: expansion site
<log macros>:1:1: 13:2 note: in expansion of log!
<log macros>:2:46: 2:76 note: expansion site
<log macros>:1:1: 3:2 note: in expansion of debug!
src/static_files_handler.rs:55:17: 55:116 note: expansion site
<log macros>:10:35: 10:38 error: failed to resolve. Maybe a missing `extern crate log`?
<log macros>:10 format_args!(|args| { ::log::log(lvl, &LOC, args) }, $($arg)+)
^~~
note: in expansion of format_args!
<log macros>:10:13: 11:10 note: expansion site
<log macros>:1:1: 13:2 note: in expansion of log!
<log macros>:2:46: 2:76 note: expansion site
<log macros>:1:1: 3:2 note: in expansion of debug!
src/static_files_handler.rs:55:17: 55:116 note: expansion site
<log macros>:10:35: 10:45 error: unresolved name `log::log`.
<log macros>:10 format_args!(|args| { ::log::log(lvl, &LOC, args) }, $($arg)+)
^~~~~~~~~~
note: in expansion of format_args!
<log macros>:10:13: 11:10 note: expansion site
<log macros>:1:1: 13:2 note: in expansion of log!
<log macros>:2:46: 2:76 note: expansion site
<log macros>:1:1: 3:2 note: in expansion of debug!
src/static_files_handler.rs:55:17: 55:116 note: expansion site
error: aborting due to 14 previous errors |
Did you try with |
https://github.com/Benny1992/nickel.rs/blob/master/src/static_files_handler.rs#L1-L3 |
Oh, never mind. Sorry I'm on mobile. Can't check. |
Ah okay np :) |
This is closed by 3d53cf3 |
The problem was I tried to use |
@bennyklotz for future reference, you can do |
@Ryman okay thx :) |
Tried to setup my nickel.rs site on ẁww.bennyklotz.at:3000
Setup steps:
$ cargo build --release $ ./target/release/website &
After starting my binary in background everything worked fine, after I closed the ssh connection to my server and exited the shell "No data received" was returned.
Here my coresponding src/main.rs file and screenshots without StaticFilesHandler:
After exiting from the ssh shell it's still working:
http://s30.postimg.org/9g9k8qpkh/working_root.png
http://s27.postimg.org/9cxm4cp8z/working_rust.png
Here my coresponding src/main.rs and screenshots with StaticFilesHandler:
Before exiting fom the ssh connection everything works:
http://postimg.org/image/5v8l4o79r/
http://postimg.org/image/e20kw8xcf/
After exiting from the ssh connection it doesn't work anymore:
http://postimg.org/image/76cppvist/
http://postimg.org/image/jm9fjmc4t/
The text was updated successfully, but these errors were encountered: