Skip to content

Commit

Permalink
Do not use date in the log file name
Browse files Browse the repository at this point in the history
This allows us use proper log rotate tools e.g logrotate(8)
  • Loading branch information
sergeyklay committed Dec 10, 2018
1 parent 946b53b commit b49c91b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/providers/Logger/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function ($filename = null, $format = null) use ($logLevels) {
$filename = rtrim($filename, '.') . '.log';
}

$logger = new File(app_path(sprintf("storage/logs/%s-%s", date('Ymd'), $filename)));
$logger = new File(app_path(sprintf("storage/logs/%s", $filename)));

$logger->setFormatter(new Line($format, $date));
$logger->setLogLevel($level);
Expand Down
3 changes: 3 additions & 0 deletions storage/setup/logrotate.d/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[phalcon-docs]
indent_style = tab
tab_width = 4
20 changes: 20 additions & 0 deletions storage/setup/logrotate.d/phalcon-docs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# ----------------------------------------------------------------------
# logrotate configuration example for Phalcon Documentation Website.
#
# Note: This is just example. Do not use it as is at production systems.
# ----------------------------------------------------------------------

/var/log/acme/*.log {
daily
rotate 7
compress
delaycompress
missingok
create 660 nginx www-data
nodateext
sharedscripts
postrotate
/bin/kill -SIGUSR1 `cat /var/run/php-fpm/php-fpm.pid 2>/dev/null` 2>/dev/null || true
/bin/kill -USR1 $(cat /var/run/nginx.pid 2>/dev/null) 2>/dev/null || :
endscript
}
6 changes: 3 additions & 3 deletions storage/setup/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -----------------------------------------------------------
# Nginx configuration for Phalcon Documentation Website
# -----------------------------------------------------------
# Note: This file is used at Scrutinizer CI
# Use this configuration only if you know what you are doing
#
# Note: This file is used at Scrutinizer CI only.
# Do not use it as is at production systems.
# -----------------------------------------------------------

server {
Expand Down

0 comments on commit b49c91b

Please sign in to comment.