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

Logging to file does not work #2

Closed
thomaschaaf opened this issue Apr 1, 2012 · 7 comments
Closed

Logging to file does not work #2

thomaschaaf opened this issue Apr 1, 2012 · 7 comments

Comments

@thomaschaaf
Copy link

I am trying to use the logging functions from devnull in my project https://github.com/komola/sysctrl

The configuration etc. is done in: https://github.com/komola/sysctrl/blob/master/app.coffee (Line 1 to 8) the file https://github.com/komola/sysctrl/blob/master/logger.coffee makes it available from everywhere. That way I can simply require the logger and get the same instance.

The file logger.log was created but no logs are sent there.

@3rd-Eden
Copy link
Member

3rd-Eden commented Apr 1, 2012

Hmzz, that's odd. I'll see if I can reproduce it. Which version of Node are your running?

Because I do have some tests written against it: https://github.com/observing/devnull/blob/master/tests/streamer.transport.test.js

@thomaschaaf
Copy link
Author

I am running the latest 0.6.14. I will try and write something smaller to see if that works. Maybe I submitted this to early (sorry)

@3rd-Eden
Copy link
Member

3rd-Eden commented Apr 1, 2012

I'm able to reproduce it because it only supports once instance of a logger type, by default it uses the process.stdout which is also Stream instance.

So as work around you can do:

new Logger({ base: false })

So it disables logging to stdout, i'll to lift this limitation.

Thanks for reporting it.

@thomaschaaf
Copy link
Author

I wanted to add logging to https://github.com/komola/node-eyefi see app.js. But sadly that creates an error:

fs.js:307
binding.write(fd, buffer, offset, length, position, wrapper);
^
TypeError: Bad argument
at [object Object]. (fs.js:307:11)
at [object Object].flush (fs.js:1312:10)
at Object.oncomplete (fs.js:1304:10)

@3rd-Eden
Copy link
Member

3rd-Eden commented Apr 9, 2012

Do you have the complete stacktrace for me? As this doesn't referrer to anything that devnull does.

@thomaschaaf
Copy link
Author

All I really did was pull the latest version did an npm install an started it with node app.js

When I take away the logger.log function it works. I created the stream just as you described in your README.
I did the same thing on 2 machines. One debian and one os x. With 0.6.14 and 0.6.11.

Stdout works fine but the file stream doesn't.

@3rd-Eden
Copy link
Member

3rd-Eden commented Apr 9, 2012

I can't really reproduce it, if we take a look at https://github.com/observing/devnull/blob/master/example/stream.js which does the same as your code, it runs perfectly, without any issues.

So if you have test cases that narrows it down, it would be great!

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

2 participants