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
No log files are being created #875
Comments
+1 |
3 similar comments
+1 |
+1 |
+1 |
It seems problem in node 6 in fs.stat()
|
Is it fixed? |
I fixed this problem my giving the absolute path like that: |
This is working for me. I did have an issue recently on a project with Winston using Atom where the .gitignore files were not showing in the file directory of the project in Atom because of an updated setting in the tree-view package... (Option: Hide VCS Ignored Files) Using Node 6.2.2 and Winston 2.2.0. Code:
Creates an app.log file with output: |
I just ran into this issue. The directory has to exist first. winston will create new files for you, but it doesn't appear to create new directories for you (e.g., you need to create the "logs" directory if you are trying to log in a file located at logs/app.js) |
Wish winston checked if the log folder/directory exists , then creating a log folder/directory should it not exist during startup. I think fs can do this right? |
+1 |
2 similar comments
+1 |
+1 |
http://thisdavej.com/using-winston-a-versatile-logging-library-for-node-js/ |
I was having this problem and solve it using double slashs:
|
I made severals tests with severals advanced logging mechanisms (incl. winston) and it appears that loggers are not able to write into file if you do a clean exit (process.exit(0)). |
@fvuilleumier you're right, thanks, however removing is not convenient for CLI tools for eg. But using |
There is an example for creating a file
|
@fvuilleumier @nicosommi but what about if I want to exit the application after it has logged an error? Did you manage to find a walk around? |
@danbrownbox at the end of the day a js script is just a file that gets executed till the end, so if you want to exit the application after some particular line you just need to build the proper execution flow on your function |
Doesn't work with relative path on my mac, but creates file if absolute path is provided. |
Whether I'm using absolute or relative it doesn't matter. It's not working for me when adding the transport dynamically.
However, if I add this transport in |
This answer works for me.
|
I'm the original author of this issue (different account). I'm back ... because I have the same problem and I forgot how I resolved it 🤣 |
Are you using latest |
I'd be willing to work on a PR for this in my spare time so leave it with me 👍 |
Cool! 👍 Going to close this, we can track the directory stuff in #1465 . Separate issues should be tested against |
Thanks man, it finally worked : ) |
OS: Ubuntu 14.04
NodeJS: 6.2.0
Winston: 2.2.0
The following code does not create a log file:
It logs to the terminal fine:
But no log file created.
The text was updated successfully, but these errors were encountered: