services: guix: Add 'log-file' configuration option.
authorLudovic Courtès <ludo@gnu.org>
Mon, 19 Dec 2016 22:54:39 +0000 (23:54 +0100)
committerLudovic Courtès <ludo@gnu.org>
Mon, 19 Dec 2016 22:57:20 +0000 (23:57 +0100)
* gnu/services/base.scm (<guix-configuration>)[log-file]: New field.
(guix-shepherd-service): Pass #:log-file to 'make-forkexec-constructor'.
* gnu/services/admin.scm (simple-rotation-config): Take a list of
files and join them with commas.
(%default-rotations): Add /var/log/guix-daemon.log.
* doc/guix.texi (Base Services): Document it.

doc/guix.texi
gnu/services/admin.scm
gnu/services/base.scm

index 7c37468..bb96385 100644 (file)
@@ -8299,6 +8299,10 @@ The list of URLs where to look for substitutes by default.
 @item @code{extra-options} (default: @code{'()})
 List of extra command-line options for @command{guix-daemon}.
 
+@item @code{log-file} (default: @code{"/var/log/guix-daemon.log"})
+File where @command{guix-daemon}'s standard output and standard error
+are written.
+
 @item @code{lsof} (default: @var{lsof})
 The lsof package to use.
 
index d8086b7..deaf677 100644 (file)
@@ -58,8 +58,8 @@
 }
 "))
 
-(define (simple-rotation-config file)
-  (string-append file " {
+(define (simple-rotation-config files)
+  #~(string-append #$(string-join files ",") " {
         sharedscripts
 }
 "))
@@ -72,7 +72,8 @@
                            (display #$(syslog-rotation-config %rotated-files)
                                     port)
                            (display #$(simple-rotation-config
-                                       "/var/log/shepherd.log")
+                                       '("/var/log/shepherd.log"
+                                         "/var/log/guix-daemon.log"))
                                     port)))))))
 
 (define (default-jobs rottlog)
index f2bac29..1b1ce0d 100644 (file)
@@ -1089,6 +1089,8 @@ failed to register hydra.gnu.org public key: ~a~%" status))))))))
                     (default %default-substitute-urls))
   (extra-options    guix-configuration-extra-options ;list of strings
                     (default '()))
+  (log-file         guix-configuration-log-file   ;string
+                    (default "/var/log/guix-daemon.log"))
   (lsof             guix-configuration-lsof       ;<package>
                     (default lsof)))
 
@@ -1101,7 +1103,7 @@ failed to register hydra.gnu.org public key: ~a~%" status))))))))
     (($ <guix-configuration> guix build-group build-accounts
                              authorize-key? keys
                              use-substitutes? substitute-urls extra-options
-                             lsof)
+                             log-file lsof)
      (list (shepherd-service
             (documentation "Run the Guix daemon.")
             (provision '(guix-daemon))
@@ -1118,7 +1120,9 @@ failed to register hydra.gnu.org public key: ~a~%" status))))))))
 
                 ;; Add 'lsof' (for the GC) to the daemon's $PATH.
                 #:environment-variables
-                (list (string-append "PATH=" #$lsof "/bin"))))
+                (list (string-append "PATH=" #$lsof "/bin"))
+
+                #:log-file #$log-file))
             (stop #~(make-kill-destructor)))))))
 
 (define (guix-accounts config)