Merge branch 'reformat'

This commit is contained in:
Bernd Ahlers 2014-10-21 17:05:58 +02:00
commit 7380b94581
101 changed files with 9165 additions and 8926 deletions

View File

@ -14,20 +14,20 @@ import org.graylog2.syslog4j.util.SyslogUtility;
/**
* This class provides a Singleton interface for Syslog4j client implementations.
*
* <p/>
* <p>Usage examples:</p>
*
* <p/>
* <b>Direct</b>
* <pre>
* Syslog.getInstance("udp").info("log message");
* </pre>
*
* <p/>
* <b>Via Instance</b>
* <pre>
* SyslogIF syslog = Syslog.getInstance("udp");
* syslog.info();
* </pre>
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -126,14 +126,14 @@ public final class Syslog implements SyslogConstants {
/**
* Use createInstance(protocol,config) to create your own Syslog instance.
*
* <p/>
* <p>First, create an implementation of SyslogConfigIF, such as UdpNetSyslogConfig.</p>
*
* <p/>
* <p>Second, configure that configuration instance.</p>
*
* <p/>
* <p>Third, call createInstance(protocol,config) using a short &amp; simple
* String for the protocol argument.</p>
*
* <p/>
* <p>Fourth, either use the returned instance of SyslogIF, or in later code
* call getInstance(protocol) with the protocol chosen in the previous step.</p>
*

View File

@ -3,7 +3,7 @@ package org.graylog2.syslog4j;
/**
* Syslog4jVersion provides a unique version identifier that is created during
* the build process.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -3,14 +3,14 @@ package org.graylog2.syslog4j;
/**
* SyslogBackLogHandlerIF provides a last-chance mechanism to log messages that fail
* (for whatever reason) within the rest of Syslog.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
*
* <p/>
* <p>Implementing the down(SyslogIF) method is an excellent way to add some sort of notification to
* your application when a Syslog service is unavailable.</p>
*
* <p/>
* <p>Implementing the up(SyslogIF) method can be used to notify your application when a Syslog
* service has returned.</p>
*

View File

@ -5,7 +5,7 @@ import java.io.Serializable;
/**
* SyslogCharSetIF provides control of the encoding character set within
* several class of Syslog4j.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -15,5 +15,6 @@ import java.io.Serializable;
*/
public interface SyslogCharSetIF extends Serializable {
public String getCharSet();
public void setCharSet(String charSet);
}

View File

@ -3,7 +3,7 @@ package org.graylog2.syslog4j;
/**
* SyslogConfigIF provides a common, extensible configuration interface for all
* implementations of SyslogIF.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -15,55 +15,76 @@ public interface SyslogConfigIF extends SyslogConstants, SyslogCharSetIF {
public Class getSyslogClass();
public int getFacility();
public void setFacility(int facility);
public void setFacility(String facilityName);
public int getPort();
public void setPort(int port) throws SyslogRuntimeException;
public String getLocalName();
public void setLocalName(String localName) throws SyslogRuntimeException;
public String getHost();
public void setHost(String host) throws SyslogRuntimeException;
public String getIdent();
public void setIdent(String ident);
public String getCharSet();
public void setCharSet(String charSet);
public boolean isIncludeIdentInMessageModifier();
public void setIncludeIdentInMessageModifier(boolean throwExceptionOnInitialize);
public boolean isThrowExceptionOnInitialize();
public void setThrowExceptionOnInitialize(boolean throwExceptionOnInitialize);
public boolean isThrowExceptionOnWrite();
public void setThrowExceptionOnWrite(boolean throwExceptionOnWrite);
public boolean isSendLocalTimestamp();
public void setSendLocalTimestamp(boolean sendLocalTimestamp);
public boolean isSendLocalName();
public void setSendLocalName(boolean sendLocalName);
public boolean isTruncateMessage();
public void setTruncateMessage(boolean truncateMessage);
public boolean isUseStructuredData();
public void setUseStructuredData(boolean useStructuredData);
public int getMaxMessageLength();
public void setMaxMessageLength(int maxMessageLength);
public void addMessageModifier(SyslogMessageModifierIF messageModifier);
public void insertMessageModifier(int index, SyslogMessageModifierIF messageModifier);
public void removeMessageModifier(SyslogMessageModifierIF messageModifier);
public void removeAllMessageModifiers();
public void addBackLogHandler(SyslogBackLogHandlerIF backLogHandler);
public void insertBackLogHandler(int index, SyslogBackLogHandlerIF backLogHandler);
public void removeBackLogHandler(SyslogBackLogHandlerIF backLogHandler);
public void removeAllBackLogHandlers();
}

View File

@ -5,7 +5,7 @@ import java.io.Serializable;
/**
* SyslogConstants provides several global constant values for several
* classes within Syslog4j.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -2,7 +2,7 @@ package org.graylog2.syslog4j;
/**
* SyslogIF provides a common interface for all Syslog4j client implementations.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -14,39 +14,58 @@ public interface SyslogIF extends SyslogConstants {
public void initialize(String protocol, SyslogConfigIF config) throws SyslogRuntimeException;
public String getProtocol();
public SyslogConfigIF getConfig();
public void backLog(int level, String message, Throwable reasonThrowable);
public void backLog(int level, String message, String reason);
public void log(int level, String message);
public void debug(String message);
public void info(String message);
public void notice(String message);
public void warn(String message);
public void error(String message);
public void critical(String message);
public void alert(String message);
public void emergency(String message);
public void log(int level, SyslogMessageIF message);
public void debug(SyslogMessageIF message);
public void info(SyslogMessageIF message);
public void notice(SyslogMessageIF message);
public void warn(SyslogMessageIF message);
public void error(SyslogMessageIF message);
public void critical(SyslogMessageIF message);
public void alert(SyslogMessageIF message);
public void emergency(SyslogMessageIF message);
public void flush() throws SyslogRuntimeException;
public void shutdown() throws SyslogRuntimeException;
public void setMessageProcessor(SyslogMessageProcessorIF messageProcessor);
public SyslogMessageProcessorIF getMessageProcessor();
public void setStructuredMessageProcessor(SyslogMessageProcessorIF messageProcessor);
public SyslogMessageProcessorIF getStructuredMessageProcessor();
}

View File

@ -10,7 +10,7 @@ import java.io.InputStreamReader;
/**
* This class provides a command-line interface for Syslog4j
* server implementations.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -80,13 +80,51 @@ public class SyslogMain {
String arg = args[i++];
boolean match = false;
if ("-h".equals(arg)) { if (i == args.length) { options.usage = "Must specify host with -h"; return options; } match = true; options.host = args[i++]; }
if ("-p".equals(arg)) { if (i == args.length) { options.usage = "Must specify port with -p"; return options; } match = true; options.port = args[i++]; }
if ("-l".equals(arg)) { if (i == args.length) { options.usage = "Must specify level with -l"; return options; } match = true; options.level = args[i++]; }
if ("-f".equals(arg)) { if (i == args.length) { options.usage = "Must specify facility with -f"; return options; } match = true; options.facility = args[i++]; }
if ("-i".equals(arg)) { if (i == args.length) { options.usage = "Must specify file with -i"; return options; } match = true; options.fileName = args[i++]; }
if ("-h".equals(arg)) {
if (i == args.length) {
options.usage = "Must specify host with -h";
return options;
}
match = true;
options.host = args[i++];
}
if ("-p".equals(arg)) {
if (i == args.length) {
options.usage = "Must specify port with -p";
return options;
}
match = true;
options.port = args[i++];
}
if ("-l".equals(arg)) {
if (i == args.length) {
options.usage = "Must specify level with -l";
return options;
}
match = true;
options.level = args[i++];
}
if ("-f".equals(arg)) {
if (i == args.length) {
options.usage = "Must specify facility with -f";
return options;
}
match = true;
options.facility = args[i++];
}
if ("-i".equals(arg)) {
if (i == args.length) {
options.usage = "Must specify file with -i";
return options;
}
match = true;
options.fileName = args[i++];
}
if ("-q".equals(arg)) { match = true; options.quiet = true; }
if ("-q".equals(arg)) {
match = true;
options.quiet = true;
}
if (options.protocol == null && !match) {
match = true;
@ -125,7 +163,11 @@ public class SyslogMain {
if (options.usage != null) {
usage(options.usage);
if (CALL_SYSTEM_EXIT_ON_FAILURE) { System.exit(1); } else { return; }
if (CALL_SYSTEM_EXIT_ON_FAILURE) {
System.exit(1);
} else {
return;
}
}
if (!options.quiet) {
@ -134,7 +176,11 @@ public class SyslogMain {
if (!Syslog.exists(options.protocol)) {
usage("Protocol \"" + options.protocol + "\" not supported");
if (CALL_SYSTEM_EXIT_ON_FAILURE) { System.exit(1); } else { return; }
if (CALL_SYSTEM_EXIT_ON_FAILURE) {
System.exit(1);
} else {
return;
}
}
SyslogIF syslog = Syslog.getInstance(options.protocol);

View File

@ -4,7 +4,7 @@ import java.io.Serializable;
/**
* SyslogMessageIF provides a common interface for all Syslog4j event implementations.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -3,7 +3,7 @@ package org.graylog2.syslog4j;
/**
* SyslogMessageModifierConfigIF provides a common configuration interface for all
* Syslog4j message modifier implementations.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -13,8 +13,10 @@ package org.graylog2.syslog4j;
*/
public interface SyslogMessageModifierConfigIF extends SyslogConstants, SyslogCharSetIF {
public String getPrefix();
public void setPrefix(String prefix);
public String getSuffix();
public void setSuffix(String suffix);
}

View File

@ -3,7 +3,7 @@ package org.graylog2.syslog4j;
/**
* SyslogMessageModifierIF provides a common interface for all
* Syslog4j message modifier implementations.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -13,5 +13,6 @@ package org.graylog2.syslog4j;
*/
public interface SyslogMessageModifierIF extends SyslogConstants {
public String modify(SyslogIF syslog, int facility, int level, String message);
public boolean verify(String message);
}

View File

@ -5,7 +5,7 @@ import java.io.Serializable;
/**
* SyslogMessageProcessorIF provides an extensible interface for writing custom
* Syslog4j message processors.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -5,7 +5,7 @@ import java.io.Serializable;
/**
* SyslogPoolConfigIF is an interface which provides configuration support
* for the Apache Commons Pool.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -15,38 +15,50 @@ import java.io.Serializable;
*/
public interface SyslogPoolConfigIF extends Serializable {
public int getMaxActive();
public void setMaxActive(int maxActive);
public int getMaxIdle();
public void setMaxIdle(int maxIdle);
public long getMaxWait();
public void setMaxWait(long maxWait);
public long getMinEvictableIdleTimeMillis();
public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis);
public int getMinIdle();
public void setMinIdle(int minIdle);
public int getNumTestsPerEvictionRun();
public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun);
public long getSoftMinEvictableIdleTimeMillis();
public void setSoftMinEvictableIdleTimeMillis(long softMinEvictableIdleTimeMillis);
public boolean isTestOnBorrow();
public void setTestOnBorrow(boolean testOnBorrow);
public boolean isTestOnReturn();
public void setTestOnReturn(boolean testOnReturn);
public boolean isTestWhileIdle();
public void setTestWhileIdle(boolean testWhileIdle);
public long getTimeBetweenEvictionRunsMillis();
public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis);
public byte getWhenExhaustedAction();
public void setWhenExhaustedAction(byte whenExhaustedAction);
}

View File

@ -3,7 +3,7 @@ package org.graylog2.syslog4j;
/**
* SyslogRuntimeException provides an extension of RuntimeException thrown
* by the majority of the classes within Syslog4j.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -18,7 +18,7 @@ import org.graylog2.syslog4j.util.SyslogUtility;
/**
* AbstractSyslog provides a base abstract implementation of the SyslogIF.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -12,7 +12,7 @@ import org.graylog2.syslog4j.util.SyslogUtility;
/**
* AbstractSyslog provides a base abstract implementation of the SyslogConfigIF
* configuration interface.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -7,7 +7,7 @@ import org.graylog2.syslog4j.SyslogConfigIF;
/**
* AbstractSyslogConfigIF provides an interface for all Abstract Syslog
* configuration implementations.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -23,30 +23,39 @@ public interface AbstractSyslogConfigIF extends SyslogConfigIF {
public List getMessageModifiers();
public byte[] getSplitMessageBeginText();
public void setSplitMessageBeginText(byte[] beginText);
public byte[] getSplitMessageEndText();
public void setSplitMessageEndText(byte[] endText);
public boolean isThreaded();
public void setThreaded(boolean threaded);
public boolean isUseDaemonThread();
public void setUseDaemonThread(boolean useDaemonThread);
public int getThreadPriority();
public void setThreadPriority(int threadPriority);
public long getThreadLoopInterval();
public void setThreadLoopInterval(long threadLoopInterval);
public long getMaxShutdownWait();
public void setMaxShutdownWait(long maxShutdownWait);
public int getWriteRetries();
public void setWriteRetries(int writeRetries);
public int getMaxQueueSize();
/**
* Use the (default) value of -1 to allow for a queue of indefinite depth (size).
*

View File

@ -11,10 +11,10 @@ import org.graylog2.syslog4j.util.SyslogUtility;
/**
* AbstractSyslogWriter is an implementation of Runnable that supports sending
* syslog messages within a separate Thread or an object pool.
*
* <p/>
* <p>When used in "threaded" mode (see TCPNetSyslogConfig for the option),
* a queuing mechanism is used (via LinkedList).</p>
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -8,7 +8,7 @@ import org.graylog2.syslog4j.util.SyslogUtility;
* AbstractSyslogBackLogHandler is an implementation of SyslogBackLogHandlerIF
* that mainly provides the helpful "combine" method for handling the "reason"
* why a BackLog has occurred.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -6,7 +6,7 @@ import org.graylog2.syslog4j.SyslogIF;
/**
* NullSyslogBackLogHandler can be used if there's no need for a last-chance
* logging mechanism whenever the Syslog protocol fails.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -8,7 +8,7 @@ import org.graylog2.syslog4j.SyslogRuntimeException;
/**
* Syslog4jBackLogHandler is used to send Syslog backLog messages to
* another Syslog4j protocol whenever the main Syslog protocol fails.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -11,7 +11,7 @@ import org.graylog2.syslog4j.impl.backlog.AbstractSyslogBackLogHandler;
/**
* Log4jSyslogBackLogHandler is used to send Syslog backLog messages to
* Log4j whenever the Syslog protocol fails.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -116,14 +116,22 @@ public class Log4jSyslogBackLogHandler extends AbstractSyslogBackLogHandler {
protected static Level getLog4jLevel(int level) {
switch (level) {
case SyslogConstants.LEVEL_DEBUG: return Level.DEBUG;
case SyslogConstants.LEVEL_INFO: return Level.INFO;
case SyslogConstants.LEVEL_NOTICE: return Level.INFO;
case SyslogConstants.LEVEL_WARN: return Level.WARN;
case SyslogConstants.LEVEL_ERROR: return Level.ERROR;
case SyslogConstants.LEVEL_CRITICAL: return Level.ERROR;
case SyslogConstants.LEVEL_ALERT: return Level.ERROR;
case SyslogConstants.LEVEL_EMERGENCY: return Level.FATAL;
case SyslogConstants.LEVEL_DEBUG:
return Level.DEBUG;
case SyslogConstants.LEVEL_INFO:
return Level.INFO;
case SyslogConstants.LEVEL_NOTICE:
return Level.INFO;
case SyslogConstants.LEVEL_WARN:
return Level.WARN;
case SyslogConstants.LEVEL_ERROR:
return Level.ERROR;
case SyslogConstants.LEVEL_CRITICAL:
return Level.ERROR;
case SyslogConstants.LEVEL_ALERT:
return Level.ERROR;
case SyslogConstants.LEVEL_EMERGENCY:
return Level.FATAL;
default:
return Level.WARN;

View File

@ -9,7 +9,7 @@ import org.graylog2.syslog4j.impl.backlog.AbstractSyslogBackLogHandler;
/**
* PrintStreamSyslogBackLogHandler provides a last-chance mechanism to log messages that fail
* (for whatever reason) within the rest of Syslog to a PrintStream.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -5,7 +5,7 @@ import org.graylog2.syslog4j.SyslogBackLogHandlerIF;
/**
* SystemErrSyslogBackLogHandler provides a last-chance mechanism to log messages that fail
* (for whatever reason) within the rest of Syslog to System.err.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -21,6 +21,7 @@ public class SystemErrSyslogBackLogHandler extends PrintStreamSyslogBackLogHandl
public SystemErrSyslogBackLogHandler() {
super(System.err, true);
}
public SystemErrSyslogBackLogHandler(boolean appendReason) {
super(System.err, true, appendReason);
}

View File

@ -5,7 +5,7 @@ import org.graylog2.syslog4j.SyslogBackLogHandlerIF;
/**
* SystemOutSyslogBackLogHandler provides a last-chance mechanism to log messages that fail
* (for whatever reason) within the rest of Syslog to System.out.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -21,6 +21,7 @@ public class SystemOutSyslogBackLogHandler extends PrintStreamSyslogBackLogHandl
public SystemOutSyslogBackLogHandler() {
super(System.out, true);
}
public SystemOutSyslogBackLogHandler(boolean appendReason) {
super(System.out, true, appendReason);
}

View File

@ -4,26 +4,26 @@ import org.apache.log4j.helpers.LogLog;
/**
* Syslog4jAppender provides a Log4j Appender wrapper for Syslog4j.
*
* <p/>
* <p>Note: Syslog4jAppender does NOT extend Log4j's SyslogAppender.</p>
*
* <p/>
* <p>Example log4j.xml configuration:</p>
*
* <p/>
* <pre>
* <code>
&lt;appender name="Syslog4j" class="org.graylog2.syslog4j.impl.log4j.Syslog4jAppender"&gt;
&lt;param name="Facility" value="user"/&gt;
&lt;param name="Protocol" value="tcp"/&gt;
&lt;param name="Host" value="192.168.0.1"/&gt;
&lt;layout class="org.apache.log4j.PatternLayout"&gt;
&lt;param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m"/&gt;
&lt;/layout&gt;
&lt;/appender&gt;
* &lt;appender name="Syslog4j" class="org.graylog2.syslog4j.impl.log4j.Syslog4jAppender"&gt;
* &lt;param name="Facility" value="user"/&gt;
* &lt;param name="Protocol" value="tcp"/&gt;
* &lt;param name="Host" value="192.168.0.1"/&gt;
* &lt;layout class="org.apache.log4j.PatternLayout"&gt;
* &lt;param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m"/&gt;
* &lt;/layout&gt;
* &lt;/appender&gt;
* </code>
* </pre>
*
* <p/>
* <p>All available parameters are:</p>
*
* <p/>
* <ul>
* <li>ident</li>
* <li>localName</li>
@ -42,7 +42,7 @@ import org.apache.log4j.helpers.LogLog;
* <li>truncateMessage</li>
* <li>useStructuredData</li>
* </ul>
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -12,10 +12,10 @@ import org.graylog2.syslog4j.util.SyslogUtility;
/**
* Syslog4jAppenderSkeleton provides an extensible Log4j Appender wrapper for Syslog4j.
*
* <p/>
* <p>Classes which inherit Syslog4jAppenderSkeleton must implement the "initialize()" method,
* which sets up Syslog4j for use by the Log4j Appender.</p>
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -10,11 +10,11 @@ import org.graylog2.syslog4j.SyslogMessageIF;
/**
* AbstractSyslogMessage provides support for turning POJO (Plain Ol'
* Java Objects) into Syslog messages.
*
* <p/>
* <p>More information on the PCI DSS specification is available here:</p>
*
* <p/>
* <p>https://www.pcisecuritystandards.org/security_standards/pci_dss.shtml</p>
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -7,7 +7,7 @@ import org.graylog2.syslog4j.SyslogMessageModifierConfigIF;
/**
* AbstractSyslogMessageModifierConfig provides a base abstract implementation of the
* SyslogMessageModifierConfigIF.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -8,7 +8,7 @@ import org.graylog2.syslog4j.util.SyslogUtility;
/**
* ChecksumSyslogMessageModifier is an implementation of SyslogMessageModifierIF
* that provides support for Java Checksum algorithms (java.util.zip.Checksum).
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -26,6 +26,7 @@ public class ChecksumSyslogMessageModifier extends AbstractSyslogMessageModifier
return crc32;
}
public static final ChecksumSyslogMessageModifier createADLER32() {
ChecksumSyslogMessageModifier adler32 = new ChecksumSyslogMessageModifier(ChecksumSyslogMessageModifierConfig.createADLER32());

View File

@ -9,7 +9,7 @@ import org.graylog2.syslog4j.impl.message.modifier.AbstractSyslogMessageModifier
/**
* ChecksumSyslogMessageModifierConfig is an implementation of AbstractSyslogMessageModifierConfig
* that provides configuration for ChecksumSyslogMessageModifier.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -6,10 +6,10 @@ import org.graylog2.syslog4j.SyslogMessageModifierIF;
/**
* HTMLEntityEscapeSyslogMessageModifier is an implementation of SyslogMessageModifierIF
* that safely escapes HTML entity characters.
*
* <p/>
* <p>This modifier is useful for applications that display log content in browsers without
* properly escaping HTML characters.</p>
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -13,7 +13,7 @@ import org.graylog2.syslog4j.util.SyslogUtility;
/**
* HashSyslogMessageModifier is an implementation of SyslogMessageModifierIF
* that provides support for Java Cryptographic hashes (MD5, SHA1, SHA256, etc.).
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -5,7 +5,7 @@ import org.graylog2.syslog4j.impl.message.modifier.AbstractSyslogMessageModifier
/**
* HashSyslogMessageModifierConfig is an implementation of AbstractSyslogMessageModifierConfig
* that provides configuration for HashSyslogMessageModifier.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -16,7 +16,7 @@ import org.graylog2.syslog4j.util.SyslogUtility;
/**
* MacSyslogMessageModifier is an implementation of SyslogMessageModifierIF
* that provides support for Java Cryptographic signed hashes (HmacSHA1, etc.)
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -11,7 +11,7 @@ import org.graylog2.syslog4j.util.Base64;
/**
* MacSyslogMessageModifierConfig is an implementation of AbstractSyslogMessageModifierConfig
* that provides configuration for HashSyslogMessageModifier.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -6,7 +6,7 @@ import org.graylog2.syslog4j.SyslogMessageModifierIF;
/**
* SequentialSyslogMessageModifier is an implementation of SyslogMessageModifierIF
* that adds an incremented number at the end.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -5,7 +5,7 @@ import org.graylog2.syslog4j.impl.message.modifier.AbstractSyslogMessageModifier
/**
* SequentialSyslogMessageModifierConfig is an implementation of AbstractSyslogMessageModifierConfig
* that provides configuration for SequentialSyslogMessageModifier.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -6,7 +6,7 @@ import org.graylog2.syslog4j.SyslogMessageModifierIF;
/**
* PrefixSyslogMessageModifier is an implementation of SyslogMessageModifierIF
* that provides support for adding static text to the beginning of a Syslog message.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -8,7 +8,7 @@ import org.graylog2.syslog4j.SyslogRuntimeException;
* StringCaseSyslogMessageModifier is an implementation of SyslogMessageModifierIF
* that provides support for shifting a Syslog message to all upper case or all
* lower case.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -6,7 +6,7 @@ import org.graylog2.syslog4j.SyslogMessageModifierIF;
/**
* SuffixSyslogMessageModifier is an implementation of SyslogMessageModifierIF
* that provides support for adding static text to the end of a Syslog message.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -8,14 +8,14 @@ import org.graylog2.syslog4j.impl.message.AbstractSyslogMessage;
/**
* PCISyslogMessage provides support for audit trails defined by section
* 10.3 of the PCI Data Security Standard (PCI DSS) versions 1.1 and 1.2.
*
* <p/>
* <p>More information on the PCI DSS specification is available here:</p>
*
* <p/>
* <p>https://www.pcisecuritystandards.org/security_standards/pci_dss.shtml</p>
*
* <p/>
* <p>The PCI DSS specification is Copyright 2008 PCI Security Standards
* Council LLC.</p>
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -65,14 +65,38 @@ public class PCISyslogMessage extends AbstractSyslogMessage implements PCISyslog
}
protected void init(Map fields) {
if (fields.containsKey(USER_ID)) { this.userId = (String) fields.get(USER_ID); };
if (fields.containsKey(EVENT_TYPE)) { this.eventType = (String) fields.get(EVENT_TYPE); };
if (fields.containsKey(DATE) && fields.get(DATE) instanceof String) { this.date = (String) fields.get(DATE); };
if (fields.containsKey(DATE) && fields.get(DATE) instanceof Date) { setDate((Date) fields.get(DATE)); };
if (fields.containsKey(TIME)) { this.time = (String) fields.get(TIME); };
if (fields.containsKey(STATUS)) { this.status = (String) fields.get(STATUS); };
if (fields.containsKey(ORIGINATION)) { this.origination = (String) fields.get(ORIGINATION); };
if (fields.containsKey(AFFECTED_RESOURCE)) { this.affectedResource = (String) fields.get(AFFECTED_RESOURCE); };
if (fields.containsKey(USER_ID)) {
this.userId = (String) fields.get(USER_ID);
}
;
if (fields.containsKey(EVENT_TYPE)) {
this.eventType = (String) fields.get(EVENT_TYPE);
}
;
if (fields.containsKey(DATE) && fields.get(DATE) instanceof String) {
this.date = (String) fields.get(DATE);
}
;
if (fields.containsKey(DATE) && fields.get(DATE) instanceof Date) {
setDate((Date) fields.get(DATE));
}
;
if (fields.containsKey(TIME)) {
this.time = (String) fields.get(TIME);
}
;
if (fields.containsKey(STATUS)) {
this.status = (String) fields.get(STATUS);
}
;
if (fields.containsKey(ORIGINATION)) {
this.origination = (String) fields.get(ORIGINATION);
}
;
if (fields.containsKey(AFFECTED_RESOURCE)) {
this.affectedResource = (String) fields.get(AFFECTED_RESOURCE);
}
;
}
public PCISyslogMessage(String userId, String eventType, String status, String affectedResource) {

View File

@ -4,14 +4,14 @@ package org.graylog2.syslog4j.impl.message.pci;
* PCISyslogMessageIF provides a definition of the fields for audit trails
* defined by section 10.3 of the PCI Data Security Standard (PCI DSS)
* versions 1.1 and 1.2.
*
* <p/>
* <p>More information on the PCI DSS specification is available here:</p>
*
* <p/>
* <p>https://www.pcisecuritystandards.org/security_standards/pci_dss.shtml</p>
*
* <p/>
* <p>The PCI DSS specification is Copyright 2008 PCI Security Standards
* Council LLC.</p>
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -21,10 +21,16 @@ package org.graylog2.syslog4j.impl.message.pci;
*/
public interface PCISyslogMessageIF {
public String getUserId();
public String getEventType();
public String getDate();
public String getTime();
public String getStatus();
public String getOrigination();
public String getAffectedResource();
}

View File

@ -12,7 +12,7 @@ import org.graylog2.syslog4j.util.SyslogUtility;
* AbstractSyslogMessageProcessor provides the ability to split a syslog message
* into multiple messages when the message is greater than the syslog
* maximum message length (1024 bytes including the header).
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -3,12 +3,12 @@ package org.graylog2.syslog4j.impl.message.processor;
/**
* SyslogMessageProcessor wraps AbstractSyslogMessageProcessor.
*
* <p/>
* <p>Those wishing to replace (or improve upon) this implementation
* can write a custom SyslogMessageProcessorIF and set it per
* instance via the SyslogIF.setMessageProcessor(..) method or set it globally
* via the SyslogMessageProcessor.setDefault(..) method.</p>
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -11,14 +11,14 @@ import org.graylog2.syslog4j.impl.message.structured.StructuredSyslogMessage;
* than the syslog maximum message length (1024 bytes including the header). It
* adds support for structured syslog messages as specified by
* draft-ietf-syslog-protocol-23. More information here:
*
* <p/>
* <p>http://tools.ietf.org/html/draft-ietf-syslog-protocol-23</p>
*
* <p/>
* <p>Those wishing to replace (or improve upon) this implementation
* can write a custom SyslogMessageProcessorIF and set it per
* instance via the SyslogIF.setStructuredMessageProcessor(..) method or set it globally
* via the StructuredSyslogMessageProcessor.setDefault(..) method.</p>
*
* <p/>
* <p>
* Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy of the
* LGPL license is available in the META-INF folder in all distributions of

View File

@ -13,11 +13,11 @@ import org.graylog2.syslog4j.impl.message.AbstractSyslogMessage;
* support for turning POJO (Plain Ol' Java Objects) into Syslog messages. It
* adds support for structured syslog messages as specified by
* draft-ietf-syslog-protocol-23. More information here:
*
* <p/>
* <p>
* http://tools.ietf.org/html/draft-ietf-syslog-protocol-23#section-6
* </p>
*
* <p/>
* <p>
* Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy of the
* LGPL license is available in the META-INF folder in all distributions of
@ -43,11 +43,11 @@ public class StructuredSyslogMessage extends AbstractSyslogMessage implements St
/**
* Constructs the {@link StructuredSyslogMessage} using MSGID,
* STRUCTURED-DATA and MSG fields, as described in:
*
* <p/>
* <p>
* http://tools.ietf.org/html/draft-ietf-syslog-protocol-23#section-6
* </p>
*
* <p/>
* The Map must be a String -> (Map of String -> String), which encompasses
* the STRUCTURED-DATA field described in above document.
*
@ -194,7 +194,7 @@ public class StructuredSyslogMessage extends AbstractSyslogMessage implements St
/**
* Returns the MSGID field of the structured message format, as described
* in:
*
* <p/>
* <p>
* http://tools.ietf.org/html/draft-ietf-syslog-protocol-23#section-6
* </p>
@ -208,7 +208,7 @@ public class StructuredSyslogMessage extends AbstractSyslogMessage implements St
/**
* Returns the structured data map. The Map is a String -> (Map of String ->
* String), which encompasses the STRUCTURED-DATA field, as described in:
*
* <p/>
* <p>
* http://tools.ietf.org/html/draft-ietf-syslog-protocol-23#section-6
* </p>
@ -221,7 +221,7 @@ public class StructuredSyslogMessage extends AbstractSyslogMessage implements St
/**
* Returns the MSG field of the structured message format, as described in:
*
* <p/>
* <p>
* http://tools.ietf.org/html/draft-ietf-syslog-protocol-23#section-6
* </p>

View File

@ -5,7 +5,7 @@ import org.graylog2.syslog4j.SyslogMessageIF;
/**
* StructuredSyslogMessageIF is a "marker" interface to identify structured
* SyslogMessageIF implementations.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -11,7 +11,7 @@ import org.graylog2.syslog4j.SyslogRuntimeException;
/**
* MultipleSyslog is an aggregator Syslog implementation for allowing a single
* Syslog call to send to multiple Syslog implementations.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -12,7 +12,7 @@ import org.graylog2.syslog4j.SyslogRuntimeException;
/**
* MultipleSyslogConfig is a configuration Object for allowing a single
* Syslog call to send to multiple Syslog implementations.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -9,7 +9,7 @@ import org.graylog2.syslog4j.util.SyslogUtility;
/**
* AbstractNetSyslog is an abstract extension of AbstractSyslog
* that provides support for network-based syslog clients.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -5,7 +5,7 @@ import org.graylog2.syslog4j.impl.AbstractSyslogConfig;
/**
* AbstractNetSyslogConfig is an abstract extension of AbstractSyslogConfig
* that provides configuration support for network-based syslog clients.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -5,7 +5,7 @@ import org.graylog2.syslog4j.impl.AbstractSyslogConfigIF;
/**
* AbstractNetSyslogConfigIF is a configuration interface supporting network-based
* Syslog implementations.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -15,5 +15,6 @@ import org.graylog2.syslog4j.impl.AbstractSyslogConfigIF;
*/
public interface AbstractNetSyslogConfigIF extends AbstractSyslogConfigIF {
public boolean isCacheHostAddress();
public void setCacheHostAddress(boolean cacheHostAddress);
}

View File

@ -7,7 +7,7 @@ import org.graylog2.syslog4j.impl.net.AbstractNetSyslog;
/**
* TCPNetSyslog is an extension of AbstractSyslog that provides support for
* TCP/IP-based syslog clients.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -7,7 +7,7 @@ import org.graylog2.syslog4j.util.SyslogUtility;
/**
* TCPNetSyslogConfig is an extension of AbstractNetSyslogConfig that provides
* configuration support for TCP/IP-based syslog clients.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -5,7 +5,7 @@ import org.graylog2.syslog4j.impl.net.AbstractNetSyslogConfigIF;
/**
* TCPNetSyslogConfigIF is a configuration interface supporting TCP/IP-based
* Syslog implementations.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -15,26 +15,34 @@ import org.graylog2.syslog4j.impl.net.AbstractNetSyslogConfigIF;
*/
public interface TCPNetSyslogConfigIF extends AbstractNetSyslogConfigIF {
public byte[] getDelimiterSequence();
public void setDelimiterSequence(byte[] delimiterSequence);
public boolean isPersistentConnection();
public void setPersistentConnection(boolean persistentConnection);
public boolean isSoLinger();
public void setSoLinger(boolean soLinger);
public int getSoLingerSeconds();
public void setSoLingerSeconds(int soLingerSeconds);
public boolean isKeepAlive();
public void setKeepAlive(boolean keepAlive);
public boolean isReuseAddress();
public void setReuseAddress(boolean reuseAddress);
public boolean isSetBufferSize();
public void setSetBufferSize(boolean setBufferSize);
public int getFreshConnectionInterval();
public void setFreshConnectionInterval(int interval);
}

View File

@ -16,10 +16,10 @@ import org.graylog2.syslog4j.util.SyslogUtility;
/**
* TCPNetSyslogWriter is an implementation of Runnable that supports sending
* TCP-based messages within a separate Thread.
*
* <p/>
* <p>When used in "threaded" mode (see TCPNetSyslogConfig for the option),
* a queuing mechanism is used (via LinkedList).</p>
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -9,7 +9,7 @@ import org.graylog2.syslog4j.impl.pool.generic.GenericSyslogPoolFactory;
/**
* PooledTCPNetSyslog is an extension of TCPNetSyslog which provides support
* for Apache Commons Pool.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -7,7 +7,7 @@ import org.graylog2.syslog4j.impl.net.tcp.TCPNetSyslogConfig;
/**
* NetSyslogPoolFactory is an implementation of SyslogPoolConfigIF
* which provides configuration support for the Apache Commons Pool.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -6,7 +6,7 @@ import org.graylog2.syslog4j.impl.net.tcp.TCPNetSyslog;
/**
* SSLTCPNetSyslog is an extension of AbstractSyslog that provides support for
* TCP/IP-based (over SSL/TLS) syslog clients.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -5,7 +5,7 @@ import org.graylog2.syslog4j.impl.net.tcp.TCPNetSyslogConfig;
/**
* SSLTCPNetSyslogConfig is an extension of TCPNetSyslogConfig that provides
* configuration support for TCP/IP-based (over SSL/TLS) syslog clients.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -5,7 +5,7 @@ import org.graylog2.syslog4j.impl.net.tcp.TCPNetSyslogConfigIF;
/**
* SSLTCPNetSyslogConfigIF is a configuration interface supporting TCP/IP-based
* (over SSL/TLS) Syslog implementations.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -15,14 +15,18 @@ import org.graylog2.syslog4j.impl.net.tcp.TCPNetSyslogConfigIF;
*/
public interface SSLTCPNetSyslogConfigIF extends TCPNetSyslogConfigIF {
public String getKeyStore();
public void setKeyStore(String keyStore);
public String getKeyStorePassword();
public void setKeyStorePassword(String keyStorePassword);
public String getTrustStore();
public void setTrustStore(String trustStore);
public String getTrustStorePassword();
public void setTrustStorePassword(String trustStorePassword);
}

View File

@ -8,10 +8,10 @@ import org.graylog2.syslog4j.impl.net.tcp.TCPNetSyslogWriter;
/**
* SSLTCPNetSyslogWriter is an implementation of Runnable that supports sending
* TCP/IP-based (over SSL/TLS) messages within a separate Thread.
*
* <p/>
* <p>When used in "threaded" mode (see TCPNetSyslogConfig for the option),
* a queuing mechanism is used (via LinkedList).</p>
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -8,7 +8,7 @@ import org.graylog2.syslog4j.impl.net.tcp.ssl.SSLTCPNetSyslogWriter;
/**
* PooledSSLTCPNetSyslogConfig is an extension of PooledTCPNetSyslogConfig
* which provides configuration support for the Apache Commons Pool.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -13,7 +13,7 @@ import org.graylog2.syslog4j.impl.net.AbstractNetSyslog;
/**
* UDPNetSyslog is an extension of AbstractSyslog that provides support for
* UDP/IP-based syslog clients.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -5,7 +5,7 @@ import org.graylog2.syslog4j.impl.net.AbstractNetSyslogConfig;
/**
* UDPNetSyslogConfig is an extension of AbstractNetSyslogConfig that provides
* configuration support for UDP/IP-based syslog clients.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -10,7 +10,7 @@ import org.graylog2.syslog4j.impl.AbstractSyslogWriter;
/**
* AbstractSyslogPoolFactory is an abstract implementation of the Apache Commons Pool
* BasePoolableObjectFactory.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -9,7 +9,7 @@ import org.graylog2.syslog4j.impl.pool.AbstractSyslogPoolFactory;
/**
* GenericSyslogPoolFactory is an implementation of the Apache Commons Pool
* BasePoolableObjectFactory using a GenericObjectPool.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -13,10 +13,10 @@ import com.sun.jna.Native;
/**
* UnixSyslog is an extension of AbstractSyslog that provides support for
* Unix-based syslog clients.
*
* <p/>
* <p>This class requires the JNA (Java Native Access) library to directly
* access the native C libraries utilized on Unix platforms.</p>
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -31,7 +31,9 @@ public class UnixSyslog extends AbstractSyslog {
protected interface CLibrary extends Library {
public void openlog(final Memory ident, int option, int facility);
public void syslog(int priority, final String format, final String message);
public void closelog();
}

View File

@ -6,7 +6,7 @@ import org.graylog2.syslog4j.impl.AbstractSyslogConfig;
/**
* UnixSyslogConfig is an extension of AbstractNetSyslogConfig that provides
* configuration support for Unix-based syslog clients.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -14,10 +14,10 @@ import com.sun.jna.Structure;
/**
* UnixSocketSyslog is an extension of AbstractSyslog that provides support for
* Unix socket-based syslog clients.
*
* <p/>
* <p>This class requires the JNA (Java Native Access) library to directly
* access the native C libraries utilized on Unix platforms.</p>
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -43,9 +43,13 @@ public class UnixSocketSyslog extends AbstractSyslog {
protected interface CLibrary extends Library {
public int socket(int domain, int type, int protocol);
public int connect(int sockfd, SockAddr sockaddr, int addrlen);
public int write(int fd, ByteBuffer buffer, int count);
public int close(int fd);
public String strerror(int errno);
}

View File

@ -6,7 +6,7 @@ import org.graylog2.syslog4j.impl.AbstractSyslogConfig;
/**
* UnixSocketSyslogConfig is an extension of AbstractNetSyslogConfig that provides
* configuration support for Unix socket-based syslog clients.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -15,7 +15,7 @@ import org.graylog2.syslog4j.util.SyslogUtility;
/**
* This class provides a Singleton-based interface for Syslog4j
* server implementations.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -9,7 +9,7 @@ import org.graylog2.syslog4j.SyslogRuntimeException;
/**
* SyslogServerConfigIF provides a common, extensible configuration interface for all
* implementations of SyslogServerIF.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -21,30 +21,40 @@ public interface SyslogServerConfigIF extends SyslogConstants, SyslogCharSetIF {
public Class getSyslogServerClass();
public String getHost();
public void setHost(String host) throws SyslogRuntimeException;
public int getPort();
public void setPort(int port) throws SyslogRuntimeException;
public boolean isUseDaemonThread();
public void setUseDaemonThread(boolean useDaemonThread);
public int getThreadPriority();
public void setThreadPriority(int threadPriority);
public List getEventHandlers();
public long getShutdownWait();
public void setShutdownWait(long shutdownWait);
public void addEventHandler(SyslogServerEventHandlerIF eventHandler);
public void insertEventHandler(int pos, SyslogServerEventHandlerIF eventHandler);
public void removeEventHandler(SyslogServerEventHandlerIF eventHandler);
public void removeAllEventHandlers();
public boolean isUseStructuredData();
public void setUseStructuredData(boolean useStructuredData);
public Object getDateTimeFormatter();
public void setDateTimeFormatter(Object dateTimeFormatter);
}

View File

@ -4,5 +4,6 @@ import java.io.Serializable;
public abstract interface SyslogServerEventHandlerIF extends Serializable {
public void initialize(SyslogServerIF syslogServer);
public void destroy(SyslogServerIF syslogServer);
}

View File

@ -7,7 +7,7 @@ import org.graylog2.syslog4j.SyslogCharSetIF;
/**
* SyslogServerEventIF provides an extensible interface for Syslog4j
* server events.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -24,18 +24,24 @@ public interface SyslogServerEventIF extends SyslogCharSetIF {
public byte[] getRaw();
public int getFacility();
public void setFacility(int facility);
public Date getDate();
public void setDate(Date date);
public int getLevel();
public void setLevel(int level);
public String getHost();
public void setHost(String host);
public boolean isHostStrippedFromMessage();
public String getMessage();
public void setMessage(String message);
}

View File

@ -4,7 +4,7 @@ import org.graylog2.syslog4j.SyslogRuntimeException;
/**
* SyslogServerIF provides a common interface for all Syslog4j server implementations.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -16,11 +16,13 @@ public interface SyslogServerIF extends Runnable {
public void initialize(String protocol, SyslogServerConfigIF config) throws SyslogRuntimeException;
public String getProtocol();
public SyslogServerConfigIF getConfig();
public void run();
public Thread getThread();
public void setThread(Thread thread);
public void shutdown();

View File

@ -8,7 +8,7 @@ import org.graylog2.syslog4j.util.SyslogUtility;
/**
* This class provides a command-line interface for Syslog4j
* server implementations.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -61,13 +61,47 @@ public class SyslogServerMain {
String arg = args[i++];
boolean match = false;
if ("-h".equals(arg)) { if (i == args.length) { options.usage = "Must specify host with -h"; return options; } match = true; options.host = args[i++]; }
if ("-p".equals(arg)) { if (i == args.length) { options.usage = "Must specify port with -p"; return options; } match = true; options.port = args[i++]; }
if ("-t".equals(arg)) { if (i == args.length) { options.usage = "Must specify value (in milliseconds)"; return options; } match = true; options.timeout = args[i++]; }
if ("-o".equals(arg)) { if (i == args.length) { options.usage = "Must specify file with -o"; return options; } match = true; options.fileName = args[i++]; }
if ("-h".equals(arg)) {
if (i == args.length) {
options.usage = "Must specify host with -h";
return options;
}
match = true;
options.host = args[i++];
}
if ("-p".equals(arg)) {
if (i == args.length) {
options.usage = "Must specify port with -p";
return options;
}
match = true;
options.port = args[i++];
}
if ("-t".equals(arg)) {
if (i == args.length) {
options.usage = "Must specify value (in milliseconds)";
return options;
}
match = true;
options.timeout = args[i++];
}
if ("-o".equals(arg)) {
if (i == args.length) {
options.usage = "Must specify file with -o";
return options;
}
match = true;
options.fileName = args[i++];
}
if ("-a".equals(arg)) { match = true; options.append = true; }
if ("-q".equals(arg)) { match = true; options.quiet = true; }
if ("-a".equals(arg)) {
match = true;
options.append = true;
}
if ("-q".equals(arg)) {
match = true;
options.quiet = true;
}
if (!match) {
if (options.protocol != null) {
@ -97,7 +131,11 @@ public class SyslogServerMain {
if (options.usage != null) {
usage(options.usage);
if (CALL_SYSTEM_EXIT_ON_FAILURE) { System.exit(1); } else { return; }
if (CALL_SYSTEM_EXIT_ON_FAILURE) {
System.exit(1);
} else {
return;
}
}
if (!options.quiet) {
@ -106,7 +144,11 @@ public class SyslogServerMain {
if (!SyslogServer.exists(options.protocol)) {
usage("Protocol \"" + options.protocol + "\" not supported");
if (CALL_SYSTEM_EXIT_ON_FAILURE) { System.exit(1); } else { return; }
if (CALL_SYSTEM_EXIT_ON_FAILURE) {
System.exit(1);
} else {
return;
}
}
SyslogServerIF syslogServer = SyslogServer.getInstance(options.protocol);

View File

@ -4,7 +4,10 @@ import java.net.SocketAddress;
public interface SyslogServerSessionEventHandlerIF extends SyslogServerEventHandlerIF {
public Object sessionOpened(SyslogServerIF syslogServer, SocketAddress socketAddress);
public void event(Object session, SyslogServerIF syslogServer, SocketAddress socketAddress, SyslogServerEventIF event);
public void exception(Object session, SyslogServerIF syslogServer, SocketAddress socketAddress, Exception exception);
public void sessionClosed(Object session, SyslogServerIF syslogServer, SocketAddress socketAddress, boolean timeout);
}

View File

@ -6,7 +6,7 @@ import java.net.SocketAddress;
/**
* SyslogServerEventHandlerIF provides an extensible interface for Syslog4j
* server event handlers.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -16,5 +16,6 @@ import java.net.SocketAddress;
*/
public interface SyslogServerSessionlessEventHandlerIF extends SyslogServerEventHandlerIF {
public void event(SyslogServerIF syslogServer, SocketAddress socketAddress, SyslogServerEventIF event);
public void exception(SyslogServerIF syslogServer, SocketAddress socketAddress, Exception exception);
}

View File

@ -23,7 +23,7 @@ import org.graylog2.syslog4j.util.SyslogUtility;
/**
* AbstractSyslogServer provides a base abstract implementation of the SyslogServerIF.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -10,7 +10,7 @@ import org.graylog2.syslog4j.server.SyslogServerEventHandlerIF;
/**
* AbstractSyslogServerConfig provides a base abstract implementation of the SyslogServerConfigIF
* configuration interface.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -13,7 +13,7 @@ import org.graylog2.syslog4j.util.SyslogUtility;
/**
* SyslogServerEvent provides an implementation of the SyslogServerEventIF interface.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -39,7 +39,8 @@ public class SyslogServerEvent implements SyslogServerEventIF {
protected String message = null;
protected InetAddress inetAddress = null;
protected SyslogServerEvent() { }
protected SyslogServerEvent() {
}
public SyslogServerEvent(final String message, InetAddress inetAddress) {
initialize(message, inetAddress);

View File

@ -12,7 +12,7 @@ import org.graylog2.syslog4j.util.SyslogUtility;
/**
* SystemOutSyslogServerEventHandler provides a simple example implementation
* of the SyslogServerEventHandlerIF which writes the events to System.out.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -13,11 +13,11 @@ import org.graylog2.syslog4j.server.impl.event.SyslogServerEvent;
* SyslogServerStructuredEvent provides an implementation of the
* SyslogServerEventIF interface that supports receiving of structured syslog
* messages, as defined in:
*
* <p/>
* <p>
* http://tools.ietf.org/html/draft-ietf-syslog-protocol-23#section-6
* </p>
*
* <p/>
* <p>
* Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy of the
* LGPL license is available in the META-INF folder in all distributions of

View File

@ -5,7 +5,7 @@ import org.graylog2.syslog4j.server.impl.AbstractSyslogServerConfig;
/**
* AbstractNetSyslogServerConfig provides a base abstract implementation of the AbstractSyslogServerConfig
* configuration interface.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -21,7 +21,7 @@ import org.graylog2.syslog4j.util.SyslogUtility;
/**
* TCPNetSyslogServer provides a simple threaded TCP/IP server implementation.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -4,7 +4,7 @@ import org.graylog2.syslog4j.server.impl.net.AbstractNetSyslogServerConfig;
/**
* TCPNetSyslogServerConfig provides configuration for TCPNetSyslogServer.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -4,7 +4,7 @@ import org.graylog2.syslog4j.server.SyslogServerConfigIF;
/**
* TCPNetSyslogServerConfigIF provides configuration for TCPNetSyslogServer.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -17,14 +17,18 @@ public interface TCPNetSyslogServerConfigIF extends SyslogServerConfigIF {
public final static byte MAX_ACTIVE_SOCKETS_BEHAVIOR_REJECT = 1;
public int getTimeout();
public void setTimeout(int timeout);
public int getBacklog();
public void setBacklog(int backlog);
public int getMaxActiveSockets();
public void setMaxActiveSockets(int maxActiveSockets);
public byte getMaxActiveSocketsBehavior();
public void setMaxActiveSocketsBehavior(byte maxActiveSocketsBehavior);
}

View File

@ -11,7 +11,7 @@ import org.graylog2.syslog4j.server.impl.net.tcp.TCPNetSyslogServer;
/**
* SSLTCPNetSyslogServer provides a simple threaded TCP/IP server implementation
* which uses SSL/TLS.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -4,7 +4,7 @@ import org.graylog2.syslog4j.server.impl.net.tcp.TCPNetSyslogServerConfig;
/**
* SSLTCPNetSyslogServerConfig provides configuration for SSLTCPNetSyslogServer.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -4,7 +4,7 @@ import org.graylog2.syslog4j.server.impl.net.tcp.TCPNetSyslogServerConfigIF;
/**
* SSLTCPNetSyslogServerConfigIF provides configuration for SSLTCPNetSyslogServer.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -14,14 +14,18 @@ import org.graylog2.syslog4j.server.impl.net.tcp.TCPNetSyslogServerConfigIF;
*/
public interface SSLTCPNetSyslogServerConfigIF extends TCPNetSyslogServerConfigIF {
public String getKeyStore();
public void setKeyStore(String keyStore);
public String getKeyStorePassword();
public void setKeyStorePassword(String keyStorePassword);
public String getTrustStore();
public void setTrustStore(String trustStore);
public String getTrustStorePassword();
public void setTrustStorePassword(String trustStorePassword);
}

View File

@ -15,7 +15,7 @@ import org.graylog2.syslog4j.util.SyslogUtility;
/**
* UDPNetSyslogServer provides a simple non-threaded UDP/IP server implementation.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -4,7 +4,7 @@ import org.graylog2.syslog4j.server.impl.net.AbstractNetSyslogServerConfig;
/**
* UDPNetSyslogServerConfig provides configuration for UDPNetSyslogServer.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@ package org.graylog2.syslog4j.util;
/**
* OSDetectUtility provides operating system detection used to determine
* whether Syslog4j is running on a Unix platform.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>

View File

@ -11,7 +11,7 @@ import org.graylog2.syslog4j.SyslogRuntimeException;
/**
* SyslogUtility provides several common utility methods used within
* Syslog4j.
*
* <p/>
* <p>Syslog4j is licensed under the Lesser GNU Public License v2.1. A copy
* of the LGPL license is available in the META-INF folder in all
* distributions of Syslog4j and in the base directory of the "doc" ZIP.</p>
@ -41,28 +41,49 @@ public final class SyslogUtility implements SyslogConstants {
public static final String getFacilityString(int syslogFacility) {
switch (syslogFacility) {
case FACILITY_KERN: return "kern";
case FACILITY_USER: return "user";
case FACILITY_MAIL: return "mail";
case FACILITY_DAEMON: return "daemon";
case FACILITY_AUTH: return "auth";
case FACILITY_SYSLOG: return "syslog";
case FACILITY_LPR: return "lpr";
case FACILITY_NEWS: return "news";
case FACILITY_UUCP: return "uucp";
case FACILITY_CRON: return "cron";
case FACILITY_AUTHPRIV: return "authpriv";
case FACILITY_FTP: return "ftp";
case FACILITY_LOCAL0: return "local0";
case FACILITY_LOCAL1: return "local1";
case FACILITY_LOCAL2: return "local2";
case FACILITY_LOCAL3: return "local3";
case FACILITY_LOCAL4: return "local4";
case FACILITY_LOCAL5: return "local5";
case FACILITY_LOCAL6: return "local6";
case FACILITY_LOCAL7: return "local7";
case FACILITY_KERN:
return "kern";
case FACILITY_USER:
return "user";
case FACILITY_MAIL:
return "mail";
case FACILITY_DAEMON:
return "daemon";
case FACILITY_AUTH:
return "auth";
case FACILITY_SYSLOG:
return "syslog";
case FACILITY_LPR:
return "lpr";
case FACILITY_NEWS:
return "news";
case FACILITY_UUCP:
return "uucp";
case FACILITY_CRON:
return "cron";
case FACILITY_AUTHPRIV:
return "authpriv";
case FACILITY_FTP:
return "ftp";
case FACILITY_LOCAL0:
return "local0";
case FACILITY_LOCAL1:
return "local1";
case FACILITY_LOCAL2:
return "local2";
case FACILITY_LOCAL3:
return "local3";
case FACILITY_LOCAL4:
return "local4";
case FACILITY_LOCAL5:
return "local5";
case FACILITY_LOCAL6:
return "local6";
case FACILITY_LOCAL7:
return "local7";
default: return "UNKNOWN";
default:
return "UNKNOWN";
}
}
@ -76,27 +97,48 @@ public final class SyslogUtility implements SyslogConstants {
_facilityName = facilityName.trim();
}
if("KERN".equalsIgnoreCase(_facilityName)) { return FACILITY_KERN;
} else if("USER".equalsIgnoreCase(facilityName)) { return FACILITY_USER;
} else if("MAIL".equalsIgnoreCase(facilityName)) { return FACILITY_MAIL;
} else if("DAEMON".equalsIgnoreCase(facilityName)) { return FACILITY_DAEMON;
} else if("AUTH".equalsIgnoreCase(facilityName)) { return FACILITY_AUTH;
} else if("SYSLOG".equalsIgnoreCase(facilityName)) { return FACILITY_SYSLOG;
} else if("LPR".equalsIgnoreCase(facilityName)) { return FACILITY_LPR;
} else if("NEWS".equalsIgnoreCase(facilityName)) { return FACILITY_NEWS;
} else if("UUCP".equalsIgnoreCase(facilityName)) { return FACILITY_UUCP;
} else if("CRON".equalsIgnoreCase(facilityName)) { return FACILITY_CRON;
} else if("AUTHPRIV".equalsIgnoreCase(facilityName)) { return FACILITY_AUTHPRIV;
} else if("FTP".equalsIgnoreCase(facilityName)) { return FACILITY_FTP;
} else if("LOCAL0".equalsIgnoreCase(facilityName)) { return FACILITY_LOCAL0;
} else if("LOCAL1".equalsIgnoreCase(facilityName)) { return FACILITY_LOCAL1;
} else if("LOCAL2".equalsIgnoreCase(facilityName)) { return FACILITY_LOCAL2;
} else if("LOCAL3".equalsIgnoreCase(facilityName)) { return FACILITY_LOCAL3;
} else if("LOCAL4".equalsIgnoreCase(facilityName)) { return FACILITY_LOCAL4;
} else if("LOCAL5".equalsIgnoreCase(facilityName)) { return FACILITY_LOCAL5;
} else if("LOCAL6".equalsIgnoreCase(facilityName)) { return FACILITY_LOCAL6;
} else if("LOCAL7".equalsIgnoreCase(facilityName)) { return FACILITY_LOCAL7;
} else { return -1;
if ("KERN".equalsIgnoreCase(_facilityName)) {
return FACILITY_KERN;
} else if ("USER".equalsIgnoreCase(facilityName)) {
return FACILITY_USER;
} else if ("MAIL".equalsIgnoreCase(facilityName)) {
return FACILITY_MAIL;
} else if ("DAEMON".equalsIgnoreCase(facilityName)) {
return FACILITY_DAEMON;
} else if ("AUTH".equalsIgnoreCase(facilityName)) {
return FACILITY_AUTH;
} else if ("SYSLOG".equalsIgnoreCase(facilityName)) {
return FACILITY_SYSLOG;
} else if ("LPR".equalsIgnoreCase(facilityName)) {
return FACILITY_LPR;
} else if ("NEWS".equalsIgnoreCase(facilityName)) {
return FACILITY_NEWS;
} else if ("UUCP".equalsIgnoreCase(facilityName)) {
return FACILITY_UUCP;
} else if ("CRON".equalsIgnoreCase(facilityName)) {
return FACILITY_CRON;
} else if ("AUTHPRIV".equalsIgnoreCase(facilityName)) {
return FACILITY_AUTHPRIV;
} else if ("FTP".equalsIgnoreCase(facilityName)) {
return FACILITY_FTP;
} else if ("LOCAL0".equalsIgnoreCase(facilityName)) {
return FACILITY_LOCAL0;
} else if ("LOCAL1".equalsIgnoreCase(facilityName)) {
return FACILITY_LOCAL1;
} else if ("LOCAL2".equalsIgnoreCase(facilityName)) {
return FACILITY_LOCAL2;
} else if ("LOCAL3".equalsIgnoreCase(facilityName)) {
return FACILITY_LOCAL3;
} else if ("LOCAL4".equalsIgnoreCase(facilityName)) {
return FACILITY_LOCAL4;
} else if ("LOCAL5".equalsIgnoreCase(facilityName)) {
return FACILITY_LOCAL5;
} else if ("LOCAL6".equalsIgnoreCase(facilityName)) {
return FACILITY_LOCAL6;
} else if ("LOCAL7".equalsIgnoreCase(facilityName)) {
return FACILITY_LOCAL7;
} else {
return -1;
}
}
@ -110,15 +152,24 @@ public final class SyslogUtility implements SyslogConstants {
_levelName = levelName.trim();
}
if("DEBUG".equalsIgnoreCase(_levelName)) { return LEVEL_DEBUG;
} else if("INFO".equalsIgnoreCase(_levelName)) { return LEVEL_INFO;
} else if("NOTICE".equalsIgnoreCase(_levelName)) { return LEVEL_NOTICE;
} else if("WARN".equalsIgnoreCase(_levelName)) { return LEVEL_WARN;
} else if("ERROR".equalsIgnoreCase(_levelName)) { return LEVEL_ERROR;
} else if("CRITICAL".equalsIgnoreCase(_levelName)) { return LEVEL_CRITICAL;
} else if("ALERT".equalsIgnoreCase(_levelName)) { return LEVEL_ALERT;
} else if("EMERGENCY".equalsIgnoreCase(_levelName)) { return LEVEL_EMERGENCY;
} else { return -1;
if ("DEBUG".equalsIgnoreCase(_levelName)) {
return LEVEL_DEBUG;
} else if ("INFO".equalsIgnoreCase(_levelName)) {
return LEVEL_INFO;
} else if ("NOTICE".equalsIgnoreCase(_levelName)) {
return LEVEL_NOTICE;
} else if ("WARN".equalsIgnoreCase(_levelName)) {
return LEVEL_WARN;
} else if ("ERROR".equalsIgnoreCase(_levelName)) {
return LEVEL_ERROR;
} else if ("CRITICAL".equalsIgnoreCase(_levelName)) {
return LEVEL_CRITICAL;
} else if ("ALERT".equalsIgnoreCase(_levelName)) {
return LEVEL_ALERT;
} else if ("EMERGENCY".equalsIgnoreCase(_levelName)) {
return LEVEL_EMERGENCY;
} else {
return -1;
}
}
@ -182,14 +233,22 @@ public final class SyslogUtility implements SyslogConstants {
public static final String getLevelString(int level) {
switch (level) {
case SyslogConstants.LEVEL_DEBUG: return "DEBUG";
case SyslogConstants.LEVEL_INFO: return "INFO";
case SyslogConstants.LEVEL_NOTICE: return "NOTICE";
case SyslogConstants.LEVEL_WARN: return "WARN";
case SyslogConstants.LEVEL_ERROR: return "ERROR";
case SyslogConstants.LEVEL_CRITICAL: return "CRITICAL";
case SyslogConstants.LEVEL_ALERT: return "ALERT";
case SyslogConstants.LEVEL_EMERGENCY: return "EMERGENCY";
case SyslogConstants.LEVEL_DEBUG:
return "DEBUG";
case SyslogConstants.LEVEL_INFO:
return "INFO";
case SyslogConstants.LEVEL_NOTICE:
return "NOTICE";
case SyslogConstants.LEVEL_WARN:
return "WARN";
case SyslogConstants.LEVEL_ERROR:
return "ERROR";
case SyslogConstants.LEVEL_CRITICAL:
return "CRITICAL";
case SyslogConstants.LEVEL_ALERT:
return "ALERT";
case SyslogConstants.LEVEL_EMERGENCY:
return "EMERGENCY";
default:
return "UNKNOWN";