Skip to content
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

500 Server Error ! logger = "0.1.0" #87

Closed
TakWolf opened this issue Jul 26, 2016 · 7 comments
Closed

500 Server Error ! logger = "0.1.0" #87

TakWolf opened this issue Jul 26, 2016 · 7 comments

Comments

@TakWolf
Copy link

TakWolf commented Jul 26, 2016

[dependencies]
iron = "0.4.0"
router = "0.2.0"
logger = "0.1.0"
extern crate iron;
extern crate router;
extern crate logger;

use iron::prelude::*;
use iron::status;
use router::Router;
use logger::Logger;

fn handler(req: &mut Request) -> IronResult<Response> {
    Ok(Response::with((status::Ok, "Hello world!")))
}

fn main() {

    let mut router = Router::new();
    router.get("/", handler);
    router.get("/:query", handler);

    let mut chain = Chain::new(router);

    let (logger_before, logger_after) = Logger::new(None);
    chain.link_before(logger_before);
    chain.link_after(logger_after);

    Iron::new(chain).http("localhost:3000").unwrap();

}

I got a 500 server error if I link logger to chain.

@Hoverbear
Copy link

I'm not seeing this issue:

 hoverbear > cargo run
     Running `target/debug/iron-test`
GET http://localhost:3000/ -> 200 OK (0.103265 ms)
GET http://localhost:3000/foo -> 200 OK (0.151203 ms)

What is giving you the error exactly? Where do you visit?

@TakWolf
Copy link
Author

TakWolf commented Aug 2, 2016

@Hoverbear
All of the code above , I visit on Chrome with F12, I see a 500 error, but response nothing.
And there is nothing in the server console.

I don't know why. It seems that problem lies in logger , because if I don't link logger :

// chain.link_before(logger_before);
// chain.link_after(logger_after);

I will run correctly and response the message.

@TakWolf
Copy link
Author

TakWolf commented Aug 2, 2016

I have try again and this error is only on Windows.
On macOS, it work well.

image

Is this my problem?

@Hoverbear
Copy link

Perhaps it is! I've never used Windows for programming. I wonder if any of our other maintainers use Windows...

std is pretty good with compatibility. I wonder if it's related to us using term? Check out https://github.com/Stebalien/term and look at https://github.com/Stebalien/term#packaging-and-distributing ? Does that maybe help somehow?

@TakWolf
Copy link
Author

TakWolf commented Aug 2, 2016

Thanks, I will depth learn about this!

@Hoverbear
Copy link

@TakWolf Happy to help any way I can, but it's not much. :) Some folks on IRC might have some advice. At the very least I think you can get someone to confirm the issue!

@Boscop
Copy link

Boscop commented Jan 16, 2017

Why does this logger work on windows with Iron, but not iron/logger?

@TakWolf TakWolf closed this as completed Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants