iilyak commented on code in PR #4483:
URL: https://github.com/apache/couchdb/pull/4483#discussion_r1163013695


##########
src/couch_log/src/couch_log_writer_syslog.erl:
##########
@@ -55,28 +57,44 @@ init() ->
                         undefined
                 end
         end,
-
+    Level = list_to_atom(config:get("log", "syslog_report_level", "info")),
     {ok, #st{
         socket = Socket,
         host = Host,
         port = config:get_integer("log", "syslog_port", 514),
         hostname = net_adm:localhost(),
         os_pid = os:getpid(),
         appid = config:get("log", "syslog_appid", "couchdb"),
-        facility = get_facility(config:get("log", "syslog_facility", "local2"))
+        facility = get_facility(config:get("log", "syslog_facility", 
"local2")),
+        report_level = Level,
+        enterprise_number = config:get("log", "syslog_enterprise_number")
     }}.
 
 terminate(_Reason, St) ->
     gen_udp:close(St#st.socket).
 
-write(Entry, St) ->
+write(#log_entry{level = report} = Entry, #st{enterprise_number = undefined} = 
St) ->
+    do_write(Entry#log_entry{level = error}, St);

Review Comment:
   Is there a reason for changing a log level to `error`? I think more often 
then not the syslog error is used to signal about errors. I don't think the 
case when `enterprise_number` is not configured is an error. Omitting 
configuration of `enterprise_number` is a way to say I don't want structured 
logging, please give me the report as formatted key/value pairs. This is useful 
for cases when syslog server doesn't fully support SDATA. 
   
   We could use `level = St#st.report_level`. In this case it would be up to 
the administrator to decide what level they want in case of a syslog server 
without SDATA support.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to