Skip to content

Loading…

does yaws have any plan to integrate lager? #90

Closed
qiyun opened this Issue · 6 comments

3 participants

@qiyun

I know yaws has its own logging mechanism. Just curious whether there is any plan to integrate lager into it.

@klacke
Owner
@qiyun

The one thing missing in yaws logging is the rotation of several logging files. e.g., we'd like to keep logging files for one month and separate them by days. yaws doesn't have that builtin while lager already have that.

@klacke
Owner
@qiyun

Internal log rotation

Lager can rotate its own logs or have it done via an external process. To use internal rotation, use the last 3 values in the file backend’s configuration tuple. For example

{"error.log", error, 10485760, "$D0", 5}

This tells lager to log error and above messages to “error.log” and to rotate the file at midnight or when it reaches 10mb, whichever comes first and to keep 5 rotated logs, in addition to the current one.

@qiyun

So if we change 5 to 30, we can have 30 separate logging files keeping track for the last 30 days. This would be a nice feature to have if the traffic is high and generates a lot of logging.

@capflam
Collaborator

Hi,

It is possible to set a special module that handles access and auth logging (the logger_mod parameter in the configuration file). So, it should be easy to experiment lager.

Here is a simple example: https://gist.github.com/2509769
The following lager configuration will do what you suggest:

{lager,
 [
  {handlers,
   [
    {lager_file_backend,
     [
      {"/var/log/yaws/access.log", notice, 10485760, "$D0", 30}
     ]}
   ]}
 ]}

The main drawback I see with lager, and lager_file_backend in particular, is that it filters messages on their severities. We cannot dispatch messages into different files according to their types (the facility for syslog). But, it is always possible to write our own backend (I'm not a lager expert, so sorry if I made a mistake).

@klacke klacke closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.