-
Notifications
You must be signed in to change notification settings - Fork 9
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
Custom appender causes weird blocking when logging #21
Comments
@pyr Hey Pierre-Yves, just saw your assigning/labelling here. Is there anything I can do to help? Do you have any idea what the issue may be? I'd be happy to try some things here if you think it could help :) |
@martinklepsch Hi, I haven't looked at it yet, assigned it to avoid forgetting, I'll tackle it tomorrow or Tuesday. Cheers. |
Hey, I hope I didn't pressure you into that now, wasn't my intention. :) Thanks though. And let me know if there's anything I should do/try. |
It seems to work for me with 0.7.20, can you try with this version. Cheers, |
I tried again with These are the dependencies I'm using in case that is useful. [org.clojure/tools.logging "0.3.1"]
[org.slf4j/slf4j-api "1.7.24"]
[ch.qos.logback/logback-classic "1.2.1"]
[com.papertrailapp/logback-syslog4j "1.0.0"]
[spootnik/unilog "0.7.20"] I also reproduced this outside the full project with this (set-env! :dependencies '[[org.clojure/tools.logging "0.3.1"]
[org.slf4j/slf4j-api "1.7.24"]
[ch.qos.logback/logback-classic "1.2.1"]
[com.papertrailapp/logback-syslog4j "1.0.0"]
[spootnik/unilog "0.7.20"]])
(comment
(require '[unilog.config :as unilog]
'[clojure.tools.logging :as log])
(do
(import 'com.papertrailapp.logback.Syslog4jAppender)
(import 'org.productivity.java.syslog4j.impl.net.tcp.ssl.SSLTCPNetSyslogConfig)
(import 'org.slf4j.LoggerFactory)
(import 'ch.qos.logback.classic.PatternLayout)
(import 'ch.qos.logback.classic.Logger)
(import 'ch.qos.logback.classic.LoggerContext)
(import 'ch.qos.logback.core.spi.ContextAware)
(import 'ch.qos.logback.core.spi.LifeCycle))
(defmethod unilog/build-appender :papertrail
[{:keys [host port ident] :as config}]
(prn 'creating-papertrail-appender)
(assoc config :appender (doto (Syslog4jAppender.)
(.setSyslogConfig (doto (SSLTCPNetSyslogConfig. host port)
(.setIdent ident)))
(.setLayout (doto (PatternLayout.)
(.setPattern "%-5level %logger{35}: %m%n%xEx"))))))
(unilog/start-logging! {:level "info"
:console true
:appenders [{:appender :papertrail
:host "logs5.papertrailapp.com"
:port 111111
:ident "my-app"
:max-message-length 128000}]})
(log/info "TEST")
) |
Hi @martinklepsch, I just tested again with 0.7.22, slf4j-api 1.7.25, logback-classic 1.2.3 and clojure.tools.logging 0.4.0. I then used |
Hey Pierre-Yves 🙂
Could you explain what you mean by that? I just tried again with the versions you listed and the appender config from the above snippet and it still takes about 5 seconds until an exception is thrown:
Notably this is an illegalArgumentException so I assume it's thrown before any network activity. Did you try the test snippet with Boot or adapted for Leiningen? Maybe Logback/SLF4J do some special stuff with Classloaders which is where Leiningen and Boot have some differences. |
Hi ! So by started/stopped one I mean that I tested with a fake syslog listening and with no listener on the port. The port out of range exception is expected since port I tested with boot and set-env just like in your example. |
Right. I just found it interesting to observe that the delay seems to be caused before any network requests are made. I'll try reproducing with a proper host/port/actual listener. |
Thanks! From my perspective: small delays when intializing a bad configuration I can understand, delays per logs I wouldn't. If a wrong port is provided there is a delay during Cheers, and sorry for the slow lead-time in getting this figured out. |
I'm currently trying to reproduce this logback.xml configuration using
build-appender
, here's what I have:I call
start-logging!
with a valid config and it does something (it blocks for a second or so) but logging anything does not result in it being added to Papertrail. Do you see any issues with my custombuild-appender
method? Few other observations:.setLayout
call the blocking-on-log described above does not occur.My guess is there's an exception somewhere that's being swallowed? FWIW I used the appender via
logback.xml
before and it worked. It ended up causing some issues in CI though (blocked the process, build timed out) which is why I'm now investigating unilog again. Thanks @mpenet for the tip :)The text was updated successfully, but these errors were encountered: