You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2006/07/26 15:35:07 UTC

DO NOT REPLY [Bug 40115] New: - patch for: syslogAppender.setFacility(final int facility)

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


DO NOT REPLY [Bug 40115] - patch for: syslogAppender.setFacility(final int facility)

Posted by bu...@apache.org.
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


carnold@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX




-- 
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


DO NOT REPLY [Bug 40115] - patch for: syslogAppender.setFacility(final int facility)

Posted by bu...@apache.org.
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





------- Additional Comments From carnold@apache.org  2006-08-31 05:23 -------
I don't know how this would affect the configurators which might now see the setFacility(int) method and 
think that facility in property or XML files would need to be int and would no longer accept 
facility=daemon and the like.  My guess is that it would probably mess them up and am hesitant to accept 
the patch without more review.

-- 
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