fukamachi / clack

Web server abstraction layer for Common Lisp
MIT License
1.05k stars 86 forks source link

When using caveman2 with clack, where do you set logger level? #89

Closed ghost closed 9 years ago

ghost commented 9 years ago

For local development, I'd like to disable error logging to the main slime repl (it gets bogged down with async requests firing off).

Is it possible to set error logging to a file? I saw something about logger-min-level, but this value isn't available in the main caveman2 package file (main.lisp) created.

By default, Hunchentoot has keyed parameters to set in their #'start call - since some of your keys match (port etc.) it may be nice to update clack with a new key(s) like :logger-min-level, so it can be controlled on server start up.

fukamachi commented 9 years ago

For the first place, what logs are you talking about? By default, Caveman2 and Clack don't output any kind of error logs in development environment (invokes CL debugger instead).

ghost commented 9 years ago

I saw setting envy to production and debug to nil stops debugger, but hunched toot supports writing Web Access logs to a file for analytics. Analytics are important  for websites, maybe caveman2 can write the access logs to a file via a key param?

-------- Original message --------
From: Eitaro Fukamachi notifications@github.com
Date:01/03/2015 8:41 AM (GMT-05:00)
To: fukamachi/clack clack@noreply.github.com
Cc: Matthew Carter m@ahungry.com
Subject: Re: [clack] When using caveman2 with clack, where do you set logger level? (#89)
For the first place, what logs are you talking about? By default, Caveman2 and Clack doesn't output any kind of error logs in development environment (invokes CL debugger instead). — Reply to this email directly or view it on GitHub.
fukamachi commented 9 years ago

Caveman2 uses Clack.Middleware.Accesslog for displaying access logs. You can specify the log-level in app.lisp of your project skeleton which was generated by Caveman2.

 (if (productionp)
     nil
     (make-instance '<clack-middleware-accesslog>
                    :log-level :info))

Since Clack.Middleware.Accesslog uses Log4CL, all facilities of it are also available for it. For instance, you can configure to output access logs to a file by adding an appender to clack.middleware.accesslog:*access-logger*.

https://github.com/7max/log4cl/blob/master/README.md#appenders

ghost commented 9 years ago

Nice, thanks!