Skip to content

Commit ac1456a

Browse files
authored
Merge pull request #176 from jrochel/logging
always log to console (stderr) not only if -v is given
2 parents 4595efc + 2c5bd25 commit ac1456a

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
opam-version: "2.0"
22
name: "ocsigenserver"
3-
version: "2.12.0"
3+
version: "2.13.0"
44
maintainer: "[email protected]"
55
synopsis: "A full-featured and extensible Web server."
66
description: "Ocsigen Server implements most features of the HTTP protocol, and has a very powerful extension mechanism that makes it very easy to plug your own OCaml modules for generating pages. Many extensions are already implemented, like a reverse proxy, content compression, access control, authentication, etc."

src/baselib/ocsigen_config.ml.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,18 @@ let set_mimefile s = mimefile := s
8383
let () = Lwt_log.add_rule "*" Lwt_log.Warning (* without --verbose *)
8484
let set_verbose () =
8585
verbose := true;
86-
Lwt_log.add_rule "*" Lwt_log.Notice
86+
Lwt_log.add_rule "ocsigen:*" Lwt_log.Notice
8787
let set_silent () = silent := true
8888
let set_daemon () = set_silent (); daemon := true
8989
let set_veryverbose () =
9090
verbose := true;
9191
veryverbose := true;
92-
Lwt_log.add_rule "*" Lwt_log.Info
92+
Lwt_log.add_rule "ocsigen:*" Lwt_log.Info
9393
let set_debug () =
9494
verbose := true;
9595
veryverbose := true;
9696
debug := true;
97-
Lwt_log.add_rule "*" Lwt_log.Debug
97+
Lwt_log.add_rule "ocsigen:*" Lwt_log.Debug
9898

9999
let set_minthreads i = minthreads := i
100100
let set_maxthreads i = maxthreads := i

src/baselib/ocsigen_messages.ml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,7 @@ let open_files ?(user = Ocsigen_config.get_user ()) ?(group = Ocsigen_config.get
8181
| _ -> Lwt_log.null);
8282
Lwt_log.dispatch
8383
(fun sect lev ->
84-
let show =
85-
match lev with
86-
| Lwt_log.Error | Lwt_log.Fatal ->
87-
not (Ocsigen_config.get_silent ())
88-
| _ ->
89-
Ocsigen_config.get_verbose ()
90-
in
91-
if show then stderr else Lwt_log.null)];
84+
if Ocsigen_config.get_silent () then Lwt_log.null else stderr)];
9285

9386
let gid = match group with
9487
| None -> Unix.getgid ()
@@ -103,9 +96,16 @@ let open_files ?(user = Ocsigen_config.get_user ()) ?(group = Ocsigen_config.get
10396
(Unix.getpwnam user).Unix.pw_uid
10497
with Not_found as e -> ignore (Lwt_log.error "Error: Wrong user"); raise e)
10598
in
106-
Lwt_unix.chown (full_path access_file) uid gid >>= fun () ->
107-
Lwt_unix.chown (full_path warning_file) uid gid >>= fun () ->
108-
Lwt_unix.chown (full_path error_file) uid gid
99+
Lwt.catch
100+
(fun () ->
101+
Lwt_unix.chown (full_path access_file) uid gid >>= fun () ->
102+
Lwt_unix.chown (full_path warning_file) uid gid >>= fun () ->
103+
Lwt_unix.chown (full_path error_file) uid gid)
104+
(fun e -> match e with
105+
| Unix.Unix_error (Unix.EPERM, _, _) ->
106+
(* to allow for symlinks to /dev/null *)
107+
Lwt.return_unit
108+
| _ -> Lwt.fail e)
109109

110110
(****)
111111

src/extensions/ocsipersist-dbm/ocsipersist.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
open Ocsidbmtypes
2626
open Lwt
2727

28-
let section = Lwt_log.Section.make "ocsipersist:dbm"
28+
let section = Lwt_log.Section.make "ocsigen:ocsipersist:dbm"
2929
(** Data are divided into stores.
3030
Create one store for your project, where you will save all your data.
3131
*)

src/extensions/ocsipersist-pgsql/ocsipersist.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(** PostgreSQL (>= 9.5) backend for Ocsipersist. *)
22

3-
let section = Lwt_log.Section.make "ocsipersist:pgsql"
3+
let section = Lwt_log.Section.make "ocsigen:ocsipersist:pgsql"
44

55
module Lwt_thread = struct
66
include Lwt

src/extensions/ocsipersist-sqlite/ocsipersist.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1919
*)
2020

21-
let section = Lwt_log.Section.make "ocsipersist:sqlite"
21+
let section = Lwt_log.Section.make "ocsigen:ocsipersist:sqlite"
2222

2323
(** Module Ocsipersist: persistent data *)
2424

0 commit comments

Comments
 (0)