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

Easy use example: logging to file doesn't work & gives the following error: "zerolog: could not write event: short write" #1

Open
erezpaz125 opened this issue Oct 3, 2023 · 1 comment

Comments

@erezpaz125
Copy link

erezpaz125 commented Oct 3, 2023

Hi,

I tried using the easy use example, only without using Sentry.
Here is the exact code I used and saved in a file I named main2.go -
image

Upon running the code I see the following outcome:

  1. The expected log is printed to StdOut.
  2. The log file I expected to see created (/home/sio/Desktop/block-lcm-starter/mylog.log) Is NOT created.
  3. an error appears in the terminal below the log that was printed to StdOut. This can be seen in the following screenshot:
    image

I wanted to ask if you are aware of the issues mentioned in 2. & 3. and if there is an expected fix.

Hoping to be able to use this at work.
Thank you,
Erez

@mef13
Copy link
Owner

mef13 commented Oct 3, 2023

Hello, @erezpaz125.

I see 2 things in you issue:

  1. message zerolog: could not write event: short write is warning and does not affect to work. I fix it in version 0.2.2, can you update and confirm?
  2. File mylog.log not created because you specify to file min log level to error, but send info level message. If you want write all logs to file you can create file writter without restrictions: zslog.File("mylog.log", fileConf, zslog.NewLevels())

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