logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 40115] New: - patch for: syslogAppender.setFacility(final int facility)
Date Wed, 26 Jul 2006 13:35:07 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40115>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40115

           Summary: patch for: syslogAppender.setFacility(final int
                    facility)
           Product: Log4j
           Version: 1.3alpha
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Appender
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: ch@westend.com


Hello

I'd like to have a setFacility() that accepts LOG_DAEMON etc and not "deamon" as
string. Attached is a patch.

bye,

-christian-


--- src/java/org/apache/log4j/net/SyslogAppender.java.orig      2006-07-26
14:15:46.270450392 +0200
+++ src/java/org/apache/log4j/net/SyslogAppender.java   2006-07-26
14:51:33.063088304 +0200
@@ -327,6 +327,28 @@
   }
 
   /**
+   * Set the syslog facility. This is the <b>Facility</b> option.
+   *
+   * <p>The <code>facility</code> parameter must be one of predefined class
+   * fields LOG_KERN, LOG_USER, LOG_MAIL, LOG_DAEMON, LOG_AUTH, LOG_SYSLOG,
+   * LOG_LPR, LOG_NEWS, LOG_UUCP, LOG_CRON, LOG_AUTHPRIV, LOG_FTP,
+   * LOG_LOCAL0, LOG_LOCAL1, LOG_LOCAL2, LOG_LOCAL3, LOG_LOCAL4, LOG_LOCAL5,
+   * LOG_LOCAL6, LOG_LOCAL7.
+   *
+   * See RFC 3164 for more information about the
+   * <b>Facility</b> option.
+   * */
+  public void setFacility(final int facility) {
+    syslogFacility = facility;
+    if (getFacilityString(syslogFacility) == null) {
+      System.err.println("[" + facility + 
+                "] is an unknown syslog facility. Defaulting to [USER].");
+      syslogFacility = LOG_USER;
+    }
+    facilityStr = getFacilityString(syslogFacility);
+  }
+
+  /**
    * Returns the value of the <b>Facility</b> option.
    *
    * See {@link #setFacility} for the set of allowed values.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message