[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] oxenstored: Allow oxenstored to use syslog at levels other than Debug



commit 6f1355fe8d5140308a26e23370459dd749f5efbf
Author:     David Scott <dave.scott@xxxxxxxxxxxxx>
AuthorDate: Tue Mar 19 16:57:34 2013 +0000
Commit:     David Scott <dave.scott@xxxxxxxxxxxxx>
CommitDate: Tue Mar 19 21:16:04 2013 +0000

    oxenstored: Allow oxenstored to use syslog at levels other than Debug
    
    We now log different kinds of events at different levels. The convention
    is now:
    
    new/end_connection:    Debug
    coalesce:              Debug
    conflict:              Debug
    commit:                Debug
    regular ops:           Info
    start/end_transaction: Debug
    error (ENOENT):        Debug
    error (any other):     Warn
    watch:                 Info
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 tools/ocaml/xenstored/logging.ml |   34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/tools/ocaml/xenstored/logging.ml b/tools/ocaml/xenstored/logging.ml
index e26f804..3d4a329 100644
--- a/tools/ocaml/xenstored/logging.ml
+++ b/tools/ocaml/xenstored/logging.ml
@@ -275,7 +275,7 @@ let init_access_log post_rotate = match 
!access_log_destination with
        | Syslog facility ->
                access_logger := Some (make_syslog_logger facility)
 
-let access_logging ~con ~tid ?(data="") access_type =
+let access_logging ~con ~tid ?(data="") ~level access_type =
         try
                maybe
                        (fun logger ->
@@ -285,18 +285,18 @@ let access_logging ~con ~tid ?(data="") access_type =
                                let data = sanitize_data data in
                                let prefix = prefix !access_log_destination 
date in
                                let msg = Printf.sprintf "%s %s %s %s" prefix 
tid access_type data in
-                               logger.write msg)
+                               logger.write ~level msg)
                        !access_logger
        with _ -> ()
 
-let new_connection = access_logging Newconn
-let end_connection = access_logging Endconn
+let new_connection = access_logging ~level:Debug Newconn
+let end_connection = access_logging ~level:Debug Endconn
 let read_coalesce ~tid ~con data =
        if !access_log_read_ops
-       then access_logging Coalesce ~tid ~con ~data:("read "^data)
-let write_coalesce data = access_logging Coalesce ~data:("write "^data)
-let conflict = access_logging Conflict
-let commit = access_logging Commit
+        then access_logging Coalesce ~tid ~con ~data:("read "^data) 
~level:Debug
+let write_coalesce data = access_logging Coalesce ~data:("write "^data) 
~level:Debug
+let conflict = access_logging Conflict ~level:Debug
+let commit = access_logging Commit ~level:Debug
 
 let xb_op ~tid ~con ~ty data =
        let print = match ty with
@@ -306,21 +306,21 @@ let xb_op ~tid ~con ~ty data =
                | Xenbus.Xb.Op.Introduce | Xenbus.Xb.Op.Release | 
Xenbus.Xb.Op.Getdomainpath | Xenbus.Xb.Op.Isintroduced | Xenbus.Xb.Op.Resume ->
                        !access_log_special_ops
                | _ -> true in
-       if print then access_logging ~tid ~con ~data (XbOp ty)
+       if print then access_logging ~tid ~con ~data (XbOp ty) ~level:Info
 
 let start_transaction ~tid ~con = 
        if !access_log_transaction_ops && tid <> 0
-       then access_logging ~tid ~con (XbOp Xenbus.Xb.Op.Transaction_start)
+       then access_logging ~tid ~con (XbOp Xenbus.Xb.Op.Transaction_start) 
~level:Debug
 
 let end_transaction ~tid ~con = 
        if !access_log_transaction_ops && tid <> 0
-       then access_logging ~tid ~con (XbOp Xenbus.Xb.Op.Transaction_end)
+       then access_logging ~tid ~con (XbOp Xenbus.Xb.Op.Transaction_end) 
~level:Debug
 
 let xb_answer ~tid ~con ~ty data =
-       let print = match ty with
-               | Xenbus.Xb.Op.Error when String.startswith "ENOENT " data -> 
!access_log_read_ops
-               | Xenbus.Xb.Op.Error -> true
-               | Xenbus.Xb.Op.Watchevent -> true
-               | _ -> false
+       let print, level = match ty with
+               | Xenbus.Xb.Op.Error when String.startswith "ENOENT" data -> 
!access_log_read_ops , Warn
+               | Xenbus.Xb.Op.Error -> true , Warn
+               | Xenbus.Xb.Op.Watchevent -> true , Info
+               | _ -> false, Debug
        in
-       if print then access_logging ~tid ~con ~data (XbOp ty)
+       if print then access_logging ~tid ~con ~data (XbOp ty) ~level
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.