Source Code for Apache Log4j Core Implementation

Apache Log4j Core Implementation provides the functional components of the logging system. Users are free to create their own plugins and include them in the logging configuration. Apache Log4j Core is a required module to use Apache Log4j.

Bytecode (Java 8) for Apache Log4j Core Implementation is provided in a separate JAR file like log4j-core-2.14.1.jar.

Source Code files for Apache Log4j API are provided in both binary packge like apache-log4j-2.14.1-bin.zip and source package like apache-log4j-2.14.1-src.zip. You can download them at Apache Log4j Website.

You can also browse Source Code files for Apache Log4j Core Implementation 2.14.1 below.

✍: FYIcenter.com

org/apache/logging/log4j/core/net/Facility.java

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache license, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the license for the specific language governing permissions and
 * limitations under the license.
 */
package org.apache.logging.log4j.core.net;

import org.apache.logging.log4j.util.EnglishEnums;

/**
 *  The facility codes used by the Syslog system.
 *
 * <table>
 *     <tr>
 *         <th>Numerical Code</th>
 *         <th>Facility</th>
 *     </tr>
 *     <tr>
 *         <td>0</td>
 *         <td>kernel messages</td>
 *     </tr>
 *     <tr>
 *         <td>1</td>
 *         <td>user-level messages</td>
 *     </tr>
 *     <tr>
 *         <td>2</td>
 *         <td>mail system</td>
 *     </tr>
 *     <tr>
 *         <td>3</td>
 *         <td>system daemons</td>
 *     </tr>
 *     <tr>
 *         <td>4</td>
 *         <td>security/authorization messages</td>
 *     </tr>
 *     <tr>
 *         <td>5</td>
 *         <td>messages generated internally by syslogd</td>
 *     </tr>
 *     <tr>
 *         <td>6</td>
 *         <td>line printer subsystem</td>
 *     </tr>
 *     <tr>
 *         <td>7</td>
 *         <td>network news subsystem</td>
 *     </tr>
 *     <tr>
 *         <td>8</td>
 *         <td>UUCP subsystem</td>
 *     </tr>
 *     <tr>
 *         <td>9</td>
 *         <td>clock daemon</td>
 *     </tr>
 *     <tr>
 *         <td>10</td>
 *         <td>security/authorization messages</td>
 *     </tr>
 *     <tr>
 *         <td>11</td>
 *         <td>FTP daemon</td>
 *     </tr>
 *     <tr>
 *         <td>12</td>
 *         <td>NTP subsystem</td>
 *     </tr>
 *     <tr>
 *         <td>13</td>
 *         <td>log audit</td>
 *     </tr>
 *     <tr>
 *         <td>14</td>
 *         <td>log alert</td>
 *     </tr>
 *     <tr>
 *         <td>15</td>
 *         <td>clock daemon (note 2)</td>
 *     </tr>
 *     <tr>
 *         <td>16</td>
 *         <td>local use 0 (local0)</td>
 *     </tr>
 *     <tr>
 *         <td>17</td>
 *         <td>local use 1 (local1)</td>
 *     </tr>
 *     <tr>
 *         <td>18</td>
 *         <td>local use 2 (local2)</td>
 *     </tr>
 *     <tr>
 *         <td>19</td>
 *         <td>local use 3 (local3)</td>
 *     </tr>
 *     <tr>
 *         <td>20</td>
 *         <td>local use 4 (local4)</td>
 *     </tr>
 *     <tr>
 *         <td>21</td>
 *         <td>local use 5 (local5)</td>
 *     </tr>
 *     <tr>
 *         <td>22</td>
 *         <td>local use 6 (local6)</td>
 *     </tr>
 *     <tr>
 *         <td>23</td>
 *         <td>local use 7 (local7)</td>
 *     </tr>
 * </table>
 */
public enum Facility {

    /** Kernel messages. */
    KERN(0),

    /** User level messages. */
    USER(1),

    /** Mail system. */
    MAIL(2),

    /** System daemons. */
    DAEMON(3),

    /** Security/Authorization messages. */
    AUTH(4),

    /** Messages generated by syslogd. */
    SYSLOG(5),

    /** Line printer subsystem. */
    LPR(6),

    /** Network news subsystem. */
    NEWS(7),

    /** UUCP subsystem. */
    UUCP(8),

    /** Clock daemon. */
    CRON(9),

    /** Security/Authorization messages. */
    AUTHPRIV(10),

    /** FTP daemon. */
    FTP(11),

    /** NTP subsystem. */
    NTP(12),

    /** Log audit. */
    LOG_AUDIT(13),

    /** Log alert. */
    LOG_ALERT(14),

    /** Clock daemon. */
    CLOCK(15),

    /** Local use 0. */
    LOCAL0(16),

    /** Local use 1. */
    LOCAL1(17),

    /** Local use 2. */
    LOCAL2(18),

    /** Local use 3. */
    LOCAL3(19),

    /** Local use 4. */
    LOCAL4(20),

    /** Local use 5. */
    LOCAL5(21),

    /** Local use 6. */
    LOCAL6(22),

    /** Local use 7. */
    LOCAL7(23);

    private final int code;

    Facility(final int code) {
        this.code = code;
    }

    /**
     * Returns the Facility for the given string.
     *
     * @param name The Facility enum name, case-insensitive. If null, returns, null
     * @return a Facility enum value or null if name is null
     */
    public static Facility toFacility(final String name) {
        return toFacility(name, null);
    }

    /**
     * Returns the Facility for the given string.
     *
     * @param name The Facility enum name, case-insensitive. If null, returns, defaultFacility
     * @param defaultFacility the Facility to return if name is null
     * @return a Facility enum value or null if name is null
     */
    public static Facility toFacility(final String name, final Facility defaultFacility) {
        return EnglishEnums.valueOf(Facility.class, name, defaultFacility);
    }

    /**
     * Retrieve the value of the enumeration.
     * @return The value associated with the enumeration.
     */
    public int getCode() {
        return this.code;
    }

    /**
     * Determine if this enumeration matches the specified name (ignoring case).
     * @param name The name to check.
     * @return true if the name matches this enumeration, ignoring case.
     */
    public boolean isEqual(final String name) {
        return this.name().equalsIgnoreCase(name);
    }

}

org/apache/logging/log4j/core/net/Facility.java

 

⇒ Source Code for Apache Log4j JDK Logging Adapter

⇐ Source Code for Apache Log4j API

⇑ Downloading and Reviewing Apache Log4j Packages

⇑⇑ FAQ for Apache Log4j

2015-11-03, 50929👍, 0💬