我有一个具有以下配置的环项目
:ring {:port 3000
:handler myservice.core/standalone-app
:init myservice.core/init!
:destroy myservice.core/destroy!}
这些功能很简单,只需记录即可。他们有一天可能会做更多的事情。
(defn init! [] (log/info "init!"))
(defn destroy! [] (log/info "destroy!"))
我用这个超级战争的东西来建立这个孩子。 lein ring uberwar myservice.war
jetty日志显示init!登录启动,但破坏!伐木无处可见。被破坏甚至被召唤?我该怎么说?
答案 0 :(得分:0)
事实证明我需要配置日志框架。在没有日志配置允许init的情况下似乎很奇怪!登录到stdout,但要破坏!无处可去。
我将logback作为依赖项添加到我的project.clj中,并添加了一个框架logback.xml配置文件,并且中提琴!
2015-12-23 11:42:53.192:INFO:oejs.Server:jetty-8.1.16.v20140903
2015-12-23 11:42:53.208:INFO:oejdp.ScanningAppProvider:Deployment monitor /Users/robert.kuhar/work/jetty-distribution-8.1.16.v20140903/webapps at interval 1
...
2015-12-23 11:42:53.598:INFO:oejd.DeploymentManager:Deployable added: /Users/robert.kuhar/work/jetty-distribution-8.1.16.v20140903/webapps/myservice.war
2015-12-23 11:42:53.600:INFO:oejw.WebInfConfiguration:Extract jar:file:/Users/robert.kuhar/work/jetty-distribution-8.1.16.v20140903/webapps/myservice.war!/ to /private/var/folders/1g/fnytl2x93sx6hp2f1rsf4h1r5xtqv_/T/jetty-0.0.0.0-8080-myservice.war-_myservice-any-/webapp
2015-12-23T11:42:58.851 INFO m.core - app
2015-12-23T11:42:58.856 INFO m.core - standalone-app
println init!
2015-12-23T11:42:58.857 INFO m.core - init!
...
2015-12-23 11:42:59.146:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8080
...
2015-12-23 11:45:48.432:INFO:oejs.Server:Graceful shutdown SelectChannelConnector@0.0.0.0:8080
...
2015-12-23 11:45:48.434:INFO:oejs.Server:Graceful shutdown o.e.j.w.WebAppContext{/myservice,file:/private/var/folders/1g/fnytl2x93sx6hp2f1rsf4h1r5xtqv_/T/jetty-0.0.0.0-8080-myservice.war-_myservice-any-/webapp/},/Users/robert.kuhar/work/jetty-distribution-8.1.16.v20140903/webapps/myservice.war
println destroy!
2015-12-23T11:45:49.553 INFO m.core - destroy!
...
2015-12-23 11:45:49.553:INFO:oejsh.ContextHandler:stopped o.e.j.w.WebAppContext{/myservice,file:/private/var/folders/1g/fnytl2x93sx6hp2f1rsf4h1r5xtqv_/T/jetty-0.0.0.0-8080-myservice.war-_myservice-any-/webapp/},/Users/robert.kuhar/work/jetty-distribution-8.1.16.v20140903/webapps/myservice.war
...