haskell-hvr / hslogger

Logging framework for Haskell
https://hackage.haskell.org/package/hslogger
BSD 3-Clause "New" or "Revised" License
64 stars 36 forks source link

Syslog handler doesn't work with metalog #17

Open orlitzky opened 10 years ago

orlitzky commented 10 years ago

I use metalog http://metalog.sourceforge.net/ on my development machines so I don't have to fiddle with logrotate all the time. I noticed that the following doesn't log anything when using metalog:

  Prelude> :set prompt "ghci> "
  ghci> :m +System.Log.Logger
  ghci> :m +System.Log.Handler.Syslog
  ghci> sl <- openlog rootLoggerName [] USER DEBUG
  ghci> updateGlobalLogger rootLoggerName (addHandler sl)
  ghci> errorM rootLoggerName "This won't show up with metalog."

If however I stop metalog and start syslog-ng, everything works as expected.

l29ah commented 8 months ago

Still an issue with 1.3.1.0.

l29ah commented 8 months ago

[pid 26413] connect(4, {sa_family=AF_UNIX, sun_path="/dev/log"}, 110) = -1 EPROTOTYPE (Protocol wrong type for socket)

l29ah commented 8 months ago

The problematic code is at https://github.com/haskell-hvr/hslogger/blob/master/src/System/Log/Handler/Syslog.hs#L185

l29ah commented 8 months ago

Okay, nvm: after patching up opening it fails the same way, gotta investigate more.

l29ah commented 8 months ago

metalog doesn't like the syntax of messages sent by hslogger, not sure why: i don't understand how it relates to the Syslog Protocol RFC, since seems like neither logger(1) nor hslogger emit compliant messages, but metalog is satisfied by the former's.