replaysMike / Binner

Open source parts inventory system for makers, electronics hobby, and professional engineers
https://binner.io
GNU General Public License v3.0
261 stars 41 forks source link

[Bug]: Logs passed to journalctl are filed every character in new log entry #206

Closed domints closed 1 year ago

domints commented 1 year ago

Binner version

v2.5.9

Operating System

Debian Buster 10, x64

Describe the bug and the steps to reproduce it

After I installed binner as per instruction I couldn't connect right away (no biggie here) so I looked up journalctl for logs: journalctl -xeu Binner as I do with anything else (I'm dotnet dev as well, have moderate experience with setting up dotnet apps in linux environment).

The output that greeted me is:

Jun 04 20:31:53 vps Binner.Web[2349]: l
Jun 04 20:31:53 vps Binner.Web[2349]: i
Jun 04 20:31:53 vps Binner.Web[2349]: s
Jun 04 20:31:53 vps Binner.Web[2349]: t
Jun 04 20:31:53 vps Binner.Web[2349]: e
Jun 04 20:31:53 vps Binner.Web[2349]: n
Jun 04 20:31:53 vps Binner.Web[2349]: i
Jun 04 20:31:53 vps Binner.Web[2349]: n
Jun 04 20:31:53 vps Binner.Web[2349]: g
Jun 04 20:31:53 vps Binner.Web[2349]:  
Jun 04 20:31:53 vps Binner.Web[2349]: o
Jun 04 20:31:53 vps Binner.Web[2349]: n
Jun 04 20:31:53 vps Binner.Web[2349]: :
Jun 04 20:31:53 vps Binner.Web[2349]:  
Jun 04 20:31:53 vps Binner.Web[2349]: h
Jun 04 20:31:53 vps Binner.Web[2349]: t
Jun 04 20:31:53 vps Binner.Web[2349]: p
Jun 04 20:31:53 vps Binner.Web[2349]: s
Jun 04 20:31:53 vps Binner.Web[2349]: :
Jun 04 20:31:53 vps Binner.Web[2349]: /
Jun 04 20:31:53 vps Binner.Web[2349]: 0
Jun 04 20:31:53 vps Binner.Web[2349]: .
Jun 04 20:31:53 vps Binner.Web[2349]: 0
Jun 04 20:31:53 vps Binner.Web[2349]: .
Jun 04 20:31:53 vps Binner.Web[2349]: 0
Jun 04 20:31:53 vps Binner.Web[2349]: .
Jun 04 20:31:53 vps Binner.Web[2349]: 0
Jun 04 20:31:53 vps Binner.Web[2349]: :
Jun 04 20:31:53 vps Binner.Web[2349]: 8
Jun 04 20:31:53 vps Binner.Web[2349]: 0
Jun 04 20:31:53 vps Binner.Web[2349]: 9
Jun 04 20:31:53 vps Binner.Web[2349]: 0

Which is to say, less than perfect. I assume NLog needs to be roconfigured, although I don't have much experience with this specific logger.

Would you like to attach your appsetings.json configuration?

It's default configuration fresh from github release.

Screenshots or Videos (Optional, but they help!)

No response

Are you able to contribute a PR? (No is ok!)

Maybe, I'll investigate and start debugging

replaysMike commented 1 year ago

sorry for the delay, just getting back into this. Likely the systemd log format that journalctl is expecting isn't compatible and journalctl shows funny output. If you tail ./Binner.log you'll see that logging looks fine.

I'm looking into if NLog has a specific formatter for systemd, or if I can just create a formatter manually for it.

replaysMike commented 1 year ago

figured out the issue - by default Nlog outputs to the console in UTF-8, if I force logs to ASCII instead then it looks right. For your nlog.config, I would replace the "ColoredConsole" target entry to the following:

<target type="Console" name="console" layout="${Layout}" encoding="ascii" />

I will add this to the next release.

replaysMike commented 1 year ago

Added in v2.6.0